Merge branch 'cassandra-3.11' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/dd5251c4 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/dd5251c4 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/dd5251c4 Branch: refs/heads/trunk Commit: dd5251c46073d75c09e47f645b1d0ebc3a135411 Parents: 0c5faef a2399d4 Author: Jeff Jirsa <j...@jeffjirsa.net> Authored: Sun Mar 12 21:57:37 2017 -0700 Committer: Jeff Jirsa <j...@jeffjirsa.net> Committed: Sun Mar 12 21:58:36 2017 -0700 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/db/commitlog/CommitLogReader.java | 12 ++++++++++++ 2 files changed, 13 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/dd5251c4/CHANGES.txt ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/dd5251c4/src/java/org/apache/cassandra/db/commitlog/CommitLogReader.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/commitlog/CommitLogReader.java index 1da0cee,d1cb8d6..9eec477 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogReader.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogReader.java @@@ -253,6 -265,18 +253,18 @@@ public class CommitLogReade 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, 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"); ++ logger.trace("Not enough bytes left for another mutation in this CommitLog section, continuing"); + statusTracker.requestTermination(); + return; + } + // any of the reads may hit EOF serializedSize = reader.readInt(); if (serializedSize == LEGACY_END_OF_SEGMENT_MARKER)