summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2023-07-11 11:26:00 +0200
committerSimon Rettberg2023-07-11 11:26:00 +0200
commit0efd7374273f56dcc03e7c29f6c78aeb33082b48 (patch)
tree61254562c89553204f1698ae991d08ba9f0157ae
parent[filetransfer] Also check meta data error string in Up-/Download loop (diff)
downloadmaster-sync-shared-0efd7374273f56dcc03e7c29f6c78aeb33082b48.tar.gz
master-sync-shared-0efd7374273f56dcc03e7c29f6c78aeb33082b48.tar.xz
master-sync-shared-0efd7374273f56dcc03e7c29f6c78aeb33082b48.zip
[filetransfer] Log when hashing/disk write is too slow
-rw-r--r--src/main/java/org/openslx/filetransfer/util/HashChecker.java7
-rw-r--r--src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java10
2 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/org/openslx/filetransfer/util/HashChecker.java b/src/main/java/org/openslx/filetransfer/util/HashChecker.java
index f6f8876..41bd05a 100644
--- a/src/main/java/org/openslx/filetransfer/util/HashChecker.java
+++ b/src/main/java/org/openslx/filetransfer/util/HashChecker.java
@@ -137,7 +137,12 @@ public class HashChecker
chunk.setStatus( ChunkStatus.HASHING );
}
if ( blocking ) {
+ long pre = System.currentTimeMillis();
queue.put( task );
+ long duration = System.currentTimeMillis() - pre;
+ if ( duration > 1000 ) {
+ LOGGER.warn( "HashChecker.queue() took " + duration + "ms" );
+ }
} else {
if ( !queue.offer( task ) ) {
return false;
@@ -224,7 +229,7 @@ public class HashChecker
public static enum HashResult
{
- NONE, // No hashing tool place
+ NONE, // No hashing took place
VALID, // Hash matches
INVALID, // Hash does not match
FAILURE // Error calculating hash
diff --git a/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java b/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java
index 9c322fd..0f78680 100644
--- a/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java
+++ b/src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java
@@ -440,7 +440,12 @@ public abstract class IncomingTransferBase extends AbstractTransfer implements H
}
// We have no hash checker, or hasher rejected block,
// or the hash for the current chunk is unknown - flush to disk
+ long pre = System.currentTimeMillis();
writeFileData( currentChunk.range.startOffset, currentChunk.range.getLength(), buffer );
+ long duration = System.currentTimeMillis() - pre;
+ if ( duration > 2000 ) {
+ LOGGER.warn( "Writing chunk to disk before hash check took " + duration + "ms. Storage backend overloaded?" );
+ }
chunks.markCompleted( currentChunk, false );
chunkStatusChanged( currentChunk );
if ( passEx != null )
@@ -584,7 +589,12 @@ public abstract class IncomingTransferBase extends AbstractTransfer implements H
chunks.markCompleted( chunk, true );
} else {
try {
+ long pre = System.currentTimeMillis();
writeFileData( chunk.range.startOffset, chunk.range.getLength(), data );
+ long duration = System.currentTimeMillis() - pre;
+ if ( duration > 2000 ) {
+ LOGGER.warn( "Writing chunk to disk after hash check took " + duration + "ms. Storage backend overloaded?" );
+ }
chunks.markCompleted( chunk, true );
} catch ( Exception e ) {
LOGGER.warn( "Cannot write to file after hash check", e );