Updated Branches: refs/heads/trunk 4fbed40c6 -> 59c6e500d
Fix assertion error during repair patch by slebresne; reviewed by driftx for CASSANDRA-5801 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/59c6e500 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/59c6e500 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/59c6e500 Branch: refs/heads/trunk Commit: 59c6e500ded4cba7232875a0680de4915731d133 Parents: 4fbed40 Author: Sylvain Lebresne <[email protected]> Authored: Thu Jul 25 17:13:15 2013 +0200 Committer: Sylvain Lebresne <[email protected]> Committed: Thu Jul 25 17:13:15 2013 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/io/sstable/SSTableScanner.java | 31 +++++++++----------- 2 files changed, 15 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/59c6e500/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 1294928..d05e698 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,7 @@ * fix potential spurious wakeup in AsyncOneResponse (CASSANDRA-5690) * fix schema-related trigger issues (CASSANDRA-5774) * Better validation when accessing CQL3 table from thrift (CASSANDRA-5138) + * Fix assertion error during repair (CASSANDRA-5801) 2.0.0-beta2 http://git-wip-us.apache.org/repos/asf/cassandra/blob/59c6e500/src/java/org/apache/cassandra/io/sstable/SSTableScanner.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableScanner.java b/src/java/org/apache/cassandra/io/sstable/SSTableScanner.java index 7e85a9f..5655486 100644 --- a/src/java/org/apache/cassandra/io/sstable/SSTableScanner.java +++ b/src/java/org/apache/cassandra/io/sstable/SSTableScanner.java @@ -178,21 +178,6 @@ public class SSTableScanner implements ICompactionScanner return new KeyScanningIterator(); } - private boolean isDone(long current) - { - if (current < stopAt) - return false; - - if (!hasSeeked) - { - // We're wrapping, so seek to the start now (which sets hasSeeked) - seekToStart(); - stopAt = dfile.length(); - } - // Re-test now that we might have seeked - return current >= stopAt; - } - protected class KeyScanningIterator extends AbstractIterator<OnDiskAtomIterator> { private DecoratedKey nextKey; @@ -218,9 +203,21 @@ public class SSTableScanner implements ICompactionScanner currentEntry = nextEntry; } - assert currentEntry.position <= stopAt; - if (isDone(currentEntry.position)) + if (currentEntry.position >= stopAt) + { + // We're in the wrapping, if we have just read the first part (we haven't seeked yet), + // seek to the beginning of the 2nd part and continue; + if (!hasSeeked) + { + seekToStart(); // This sets hasSeeked + stopAt = dfile.length(); + // reset currentKey and nextKey since we have seeked + currentKey = null; + nextKey = null; + return computeNext(); + } return endOfData(); + } if (ifile.isEOF()) {
