Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/44f79bf2 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/44f79bf2 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/44f79bf2 Branch: refs/heads/cassandra-3.11 Commit: 44f79bf2f7a3a05f802014492ecbec67c49c02d0 Parents: aeca1d2 beb9658 Author: Jeff Jirsa <j...@jeffjirsa.net> Authored: Sun Mar 12 21:54:42 2017 -0700 Committer: Jeff Jirsa <j...@jeffjirsa.net> Committed: Sun Mar 12 21:56:00 2017 -0700 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/db/commitlog/CommitLogReplayer.java | 11 +++++++++++ .../apache/cassandra/db/commitlog/CommitLogTest.java | 15 ++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/44f79bf2/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index 52a794b,2839291..140c860 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,21 -1,6 +1,22 @@@ -2.2.10 +3.0.13 + * Slice.isEmpty() returns false for some empty slices (CASSANDRA-13305) + * Add formatted row output to assertEmpty in CQL Tester (CASSANDRA-13238) +Merged from 2.2: ++ * Commitlog replay may fail if last mutation is within 4 bytes of end of segment (CASSANDRA-13282) * Fix queries updating multiple time the same list (CASSANDRA-13130) * Fix GRANT/REVOKE when keyspace isn't specified (CASSANDRA-13053) + + +3.0.12 + * Prevent data loss on upgrade 2.1 - 3.0 by adding component separator to LogRecord absolute path (CASSANDRA-13294) + * Improve testing on macOS by eliminating sigar logging (CASSANDRA-13233) + * Cqlsh copy-from should error out when csv contains invalid data for collections (CASSANDRA-13071) + * Update c.yaml doc for offheap memtables (CASSANDRA-13179) + * Faster StreamingHistogram (CASSANDRA-13038) + * Legacy deserializer can create unexpected boundary range tombstones (CASSANDRA-13237) + * Remove unnecessary assertion from AntiCompactionTest (CASSANDRA-13070) + * Fix cqlsh COPY for dates before 1900 (CASSANDRA-13185) +Merged from 2.2: * Avoid race on receiver by starting streaming sender thread after sending init message (CASSANDRA-12886) * Fix "multiple versions of ant detected..." when running ant test (CASSANDRA-13232) * Coalescing strategy sleeps too much (CASSANDRA-13090) http://git-wip-us.apache.org/repos/asf/cassandra/blob/44f79bf2/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java index d53f0f8,3cf4d0f..205c36a --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java @@@ -483,6 -439,17 +483,17 @@@ public class CommitLogReplaye int serializedSize; try { + // We rely on reading serialized size == 0 (LEGACY_END_OF_SEGMENT_MARKER) to identify the end + // of a segment, which happens naturally due to the 0 padding of the empty segment on creation. - // However, with 2.1 era commitlogs it's possible that the last mutation ended less than 4 bytes ++ // However, it's possible with 2.1 era commitlogs that the last mutation ended less than 4 bytes + // from the end of the file, which means that we'll be unable to read an a full int and instead + // read an EOF here + if(end - reader.getFilePointer() < 4) + { + logger.trace("Not enough bytes left for another mutation in this CommitLog segment, continuing"); + return false; + } + // any of the reads may hit EOF serializedSize = reader.readInt(); if (serializedSize == LEGACY_END_OF_SEGMENT_MARKER) http://git-wip-us.apache.org/repos/asf/cassandra/blob/44f79bf2/test/unit/org/apache/cassandra/db/commitlog/CommitLogTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/db/commitlog/CommitLogTest.java index c4ab6ab,9b63885..90dc258 --- a/test/unit/org/apache/cassandra/db/commitlog/CommitLogTest.java +++ b/test/unit/org/apache/cassandra/db/commitlog/CommitLogTest.java @@@ -143,11 -137,25 +143,24 @@@ public class CommitLogTes } @Test + public void testRecoveryWithShortPadding() throws Exception + { + // If we have 0-3 bytes remaining, commitlog replayer + // should pass, because there's insufficient room + // left in the segment for the legacy size marker. + testRecovery(new byte[1], null); + testRecovery(new byte[2], null); + testRecovery(new byte[3], null); + } + + @Test public void testRecoveryWithShortSize() throws Exception { - runExpecting(new WrappedRunnable() { - public void runMayThrow() throws Exception { - byte[] data = new byte[5]; - data[3] = 1; // Not a legacy marker, give it a fake (short) size - testRecovery(data, CommitLogDescriptor.VERSION_20); - } ++ byte[] data = new byte[5]; ++ data[3] = 1; // Not a legacy marker, give it a fake (short) size + runExpecting(() -> { - testRecovery(new byte[2], CommitLogDescriptor.VERSION_20); ++ testRecovery(data, CommitLogDescriptor.VERSION_20); + return null; }, CommitLogReplayException.class); }