Updated Branches:
  refs/heads/trunk d5ec013ce -> 2a91a4818

Fix comparison against IndexInterval in SSTR.getPosition()


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2a91a481
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2a91a481
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2a91a481

Branch: refs/heads/trunk
Commit: 2a91a48181b269684d491d961a0c513bf81baf25
Parents: d5ec013
Author: Sylvain Lebresne <sylv...@datastax.com>
Authored: Fri Oct 5 10:24:37 2012 +0200
Committer: Sylvain Lebresne <sylv...@datastax.com>
Committed: Fri Oct 5 10:24:37 2012 +0200

----------------------------------------------------------------------
 .../apache/cassandra/io/sstable/SSTableReader.java |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2a91a481/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java 
b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
index b89ee24..a67c1ab 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
@@ -758,15 +758,18 @@ public class SSTableReader extends SSTable
 
         // scan the on-disk index, starting at the nearest sampled position.
         // The check against IndexInterval is to be exit the loop in the EQ 
case when the key looked for is not present
-        // (bloom filter false positive).
+        // (bloom filter false positive). But note that for non-EQ cases, we 
might need to check the first key of the
+        // next index position because the searched key can be greater the 
last key of the index interval checked if it
+        // is lesser than the first key of next interval (and in that case we 
must return the position of the first key
+        // of the next interval).
         int i = 0;
         Iterator<FileDataInput> segments = ifile.iterator(sampledPosition, 
INDEX_FILE_BUFFER_BYTES);
-        while (segments.hasNext() && i < DatabaseDescriptor.getIndexInterval())
+        while (segments.hasNext() && i <= 
DatabaseDescriptor.getIndexInterval())
         {
             FileDataInput in = segments.next();
             try
             {
-                while (!in.isEOF() && i < 
DatabaseDescriptor.getIndexInterval())
+                while (!in.isEOF() && i <= 
DatabaseDescriptor.getIndexInterval())
                 {
                     i++;
 

Reply via email to