Repository: cassandra Updated Branches: refs/heads/trunk 0cb27a781 -> d080a7372
Fix buffer length comparison when decompressing in netty-based streaming patch by jasobrown; reviewed by Paulo Motta for CASSANDRA-13899 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d080a737 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d080a737 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d080a737 Branch: refs/heads/trunk Commit: d080a73723d9aa402507c1ae04eef92ff6d44948 Parents: 0cb27a7 Author: Jason Brown <[email protected]> Authored: Tue Sep 26 13:30:17 2017 -0700 Committer: Jason Brown <[email protected]> Committed: Wed Oct 4 15:56:59 2017 +0900 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/streaming/compress/CompressedInputStream.java | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/d080a737/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index b146778..635c2f4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 4.0 + * Fix buffer length comparison when decompressing in netty-based streaming (CASSANDRA-13899) * Properly close StreamCompressionInputStream to release any ByteBuf (CASSANDRA-13906) * Add SERIAL and LOCAL_SERIAL support for cassandra-stress (CASSANDRA-13925) * LCS needlessly checks for L0 STCS candidates multiple times (CASSANDRA-12961) http://git-wip-us.apache.org/repos/asf/cassandra/blob/d080a737/src/java/org/apache/cassandra/streaming/compress/CompressedInputStream.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/streaming/compress/CompressedInputStream.java b/src/java/org/apache/cassandra/streaming/compress/CompressedInputStream.java index 4b9fc61..dd0ba80 100644 --- a/src/java/org/apache/cassandra/streaming/compress/CompressedInputStream.java +++ b/src/java/org/apache/cassandra/streaming/compress/CompressedInputStream.java @@ -151,13 +151,12 @@ public class CompressedInputStream extends RebufferingInputStream implements Aut private void decompress(ByteBuffer compressed) throws IOException { - final int compressedChunkLength = info.parameters.chunkLength(); int length = compressed.remaining(); - // uncompress if the buffer size is less than chunk size. else, if the buffer size is equal to the compressedChunkLength, + // uncompress if the buffer size is less than the max chunk size. else, if the buffer size is greater than or equal to the maxCompressedLength, // we assume the buffer is not compressed. see CASSANDRA-10520 final boolean releaseCompressedBuffer; - if (length - CHECKSUM_LENGTH < compressedChunkLength) + if (length - CHECKSUM_LENGTH < info.parameters.maxCompressedLength()) { buffer.clear(); compressed.limit(length - CHECKSUM_LENGTH); @@ -191,6 +190,7 @@ public class CompressedInputStream extends RebufferingInputStream implements Aut FileUtils.clean(compressed); // buffer offset is always aligned + final int compressedChunkLength = info.parameters.chunkLength(); bufferOffset = current & ~(compressedChunkLength - 1); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
