fix CFRR iterating through resultset consisting entirely of tombstones
patch by jbellis; tested by Niel Drummand and reviewed by Brandon Williams for 
CASSANDRA-4466


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

Branch: refs/heads/trunk
Commit: 8b6ce324bf35210196e0f0ec0665ba87b0f3991f
Parents: 813553b
Author: Jonathan Ellis <jbel...@apache.org>
Authored: Tue Jul 31 10:41:26 2012 -0500
Committer: Jonathan Ellis <jbel...@apache.org>
Committed: Tue Jul 31 10:47:14 2012 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    5 +++++
 .../cassandra/hadoop/ColumnFamilyRecordReader.java |    9 ++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8b6ce324/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index c708aea..222081b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,8 @@
+1.0.12
+ * (Hadoop) fix iterating through a resultset consisting entirely
+   of tombstoned rows (CASSANDRA-4466)
+
+
 1.0.11
  * allow dropping columns shadowed by not-yet-expired supercolumn or row
    tombstones in PrecompactedRow (CASSANDRA-4396)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8b6ce324/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java 
b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
index 5d0ac72..20d6068 100644
--- a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
+++ b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
@@ -307,18 +307,21 @@ public class ColumnFamilyRecordReader extends 
RecordReader<ByteBuffer, SortedMap
                 if (isEmptyPredicate)
                 {
                     Iterator<KeySlice> it = rows.iterator();
-                    while (it.hasNext())
+                    KeySlice ks;
+                    do
                     {
-                        KeySlice ks = it.next();
+                        ks = it.next();
                         if (ks.getColumnsSize() == 0)
                         {
                             it.remove();
                         }
-                    }
+                    } while (it.hasNext());
 
                     // all ghosts, spooky
                     if (rows.isEmpty())
                     {
+                        // maybeInit assumes it can get the start-with key 
from the rows collection, so add back the last
+                        rows.add(ks);
                         maybeInit();
                         return;
                     }

Reply via email to