cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [4/6] git commit: fix wide row iteration when last row read was deleted patch by jbellis; reviewed by brandonwilliams for CASSANDRA-4154
Date Mon, 16 Apr 2012 21:24:35 GMT
fix wide row iteration when last row read was deleted
patch by jbellis; reviewed by brandonwilliams for CASSANDRA-4154


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

Branch: refs/heads/trunk
Commit: b184972b0f83487cb44ce7c211d3ca7cd5dbb3eb
Parents: 483a699
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Mon Apr 16 16:23:28 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Mon Apr 16 16:23:28 2012 -0500

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


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b184972b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f09a470..be3264a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 1.1-dev
+ * (Hadoop) fix wide row iteration when last row read was deleted
+   (CASSANDRA-4154)
  * fix read_repair_chance to really default to 0.1 in the cli (CASSANDRA-4114)
  * Adds caching and bloomFilterFpChange to CQL options (CASSANDRA-4042)
  * Adds posibility to autoconfigure size of the KeyCache (CASSANDRA-4087)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b184972b/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 600cf13..9459d5a 100644
--- a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
+++ b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
@@ -413,6 +413,7 @@ public class ColumnFamilyRecordReader extends RecordReader<ByteBuffer,
SortedMap
     private class WideRowIterator extends RowIterator
     {
         private PeekingIterator<Pair<ByteBuffer, SortedMap<ByteBuffer, IColumn>>>
wideColumns;
+        private ByteBuffer lastColumn = ByteBufferUtil.EMPTY_BYTE_BUFFER;
 
         private void maybeInit()
         {
@@ -428,7 +429,6 @@ public class ColumnFamilyRecordReader extends RecordReader<ByteBuffer,
SortedMap
                           .setStart_token(startToken)
                           .setEnd_token(split.getEndToken())
                           .setRow_filter(filter);
-                startColumn = ByteBufferUtil.EMPTY_BYTE_BUFFER;
             }
             else
             {
@@ -438,20 +438,19 @@ public class ColumnFamilyRecordReader extends RecordReader<ByteBuffer,
SortedMap
                           .setStart_key(lastRow.key)
                           .setEnd_token(split.getEndToken())
                           .setRow_filter(filter);
-                startColumn = Iterables.getLast(lastRow.columns).column.name;
             }
 
             try
             {
-                rows = client.get_paged_slice(cfName, keyRange, startColumn, consistencyLevel);
+                rows = client.get_paged_slice(cfName, keyRange, lastColumn, consistencyLevel);
                 int n = 0;
                 for (KeySlice row : rows)
                     n += row.columns.size();
                 logger.debug("read {} columns in {} rows for {} starting with {}",
-                             new Object[]{ n, rows.size(), keyRange, startColumn });
+                             new Object[]{ n, rows.size(), keyRange, lastColumn });
 
                 wideColumns = Iterators.peekingIterator(new WideColumnIterator(rows));
-                if (wideColumns.hasNext() && wideColumns.peek().right.keySet().iterator().next().equals(startColumn))
+                if (wideColumns.hasNext() && wideColumns.peek().right.keySet().iterator().next().equals(lastColumn))
                     wideColumns.next();
                 if (!wideColumns.hasNext())
                     rows = null;
@@ -469,7 +468,9 @@ public class ColumnFamilyRecordReader extends RecordReader<ByteBuffer,
SortedMap
                 return endOfData();
 
             totalRead++;
-            return wideColumns.next();
+            Pair<ByteBuffer, SortedMap<ByteBuffer, IColumn>> next = wideColumns.next();
+            lastColumn = next.right.values().iterator().next().name();
+            return next;
         }
 
         private class WideColumnIterator extends AbstractIterator<Pair<ByteBuffer,
SortedMap<ByteBuffer, IColumn>>>


Mime
View raw message