diff options
-rw-r--r-- | src/main/java/org/openslx/filetransfer/util/HashChecker.java | 7 | ||||
-rw-r--r-- | src/main/java/org/openslx/filetransfer/util/IncomingTransferBase.java | 10 |
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 ); |