You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2011/11/08 14:54:59 UTC

svn commit: r1199242 - in /cassandra/branches/cassandra-0.8: CHANGES.txt src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java

Author: jake
Date: Tue Nov  8 13:54:59 2011
New Revision: 1199242

URL: http://svn.apache.org/viewvc?rev=1199242&view=rev
Log:
Revert CASSANDRA-3450

Modified:
    cassandra/branches/cassandra-0.8/CHANGES.txt
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1199242&r1=1199241&r2=1199242&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Tue Nov  8 13:54:59 2011
@@ -37,9 +37,9 @@
  * CFMetaData.convertToThrift method to set RowCacheProvider (CASSANDRA-3405)
  * acquire compactionlock during truncate (CASSANDRA-3399)
  * fix displaying cfdef entries for super columnfamilies (CASSANDRA-3415)
- * (Hadoop) Fix empty row filtering (CASSANDRA-3450)
  * Make counter shard merging thread safe (CASSANDRA-3178)
 
+
 0.8.7
  * Kill server on wrapped OOME such as from FileChannel.map (CASSANDRA-3201)
  * Allow using quotes in "USE <keyspace>;" CLI command (CASSANDRA-3208)

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java?rev=1199242&r1=1199241&r2=1199242&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java (original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java Tue Nov  8 13:54:59 2011
@@ -235,55 +235,50 @@ public class ColumnFamilyRecordReader ex
             {
                 startToken = split.getStartToken();
             } 
-
-            // The removal of empty CF rows could result in an empty List<KeySlice> rows.
-            // Keep trying until we return on reaching the end of the range or rows is nonEmpty.
-            while (rows == null || rows.isEmpty()) {
-                if (startToken.equals(split.getEndToken()))
+            else if (startToken.equals(split.getEndToken()))
+            {
+                rows = null;
+                return;
+            }
+            
+            KeyRange keyRange = new KeyRange(batchRowCount)
+                                .setStart_token(startToken)
+                                .setEnd_token(split.getEndToken());
+            try
+            {
+                rows = client.get_range_slices(new ColumnParent(cfName),
+                                               predicate,
+                                               keyRange,
+                                               consistencyLevel);
+                  
+                // nothing new? reached the end
+                if (rows.isEmpty())
                 {
                     rows = null;
                     return;
                 }
 
-                KeyRange keyRange = new KeyRange(batchRowCount)
-                                    .setStart_token(startToken)
-                                    .setEnd_token(split.getEndToken());
-                try
-                {
-                    rows = client.get_range_slices(new ColumnParent(cfName),
-                                                   predicate,
-                                                   keyRange,
-                                                   consistencyLevel);
-
-                    // nothing new? reached the end
-                    if (rows.isEmpty())
-                    {
-                        rows = null;
-                        return;
-                    }
-
-                    // Pre-compute the last row key, before removing empty rows
-                    ByteBuffer lastRowKey = rows.get(rows.size() - 1).key;
-
-                    // only remove empty rows if the slice predicate is empty
-                    if (isPredicateEmpty(predicate))
-                    {
-                        Iterator<KeySlice> rowsIterator = rows.iterator();
-                        while (rowsIterator.hasNext())
-                            if (rowsIterator.next().columns.isEmpty())
-                                rowsIterator.remove();
-                    }
-
-                    // reset to iterate through the new batch
-                    i = 0;
+                // Pre-compute the last row key, before removing empty rows
+                ByteBuffer lastRowKey = rows.get(rows.size() - 1).key;
 
-                    // prepare for the next slice to be read
-                    startToken = partitioner.getTokenFactory().toString(partitioner.getToken(lastRowKey));
-                }
-                catch (Exception e)
+                // only remove empty rows if the slice predicate is empty
+                if (isPredicateEmpty(predicate))
                 {
-                    throw new RuntimeException(e);
+                    Iterator<KeySlice> rowsIterator = rows.iterator();
+                    while (rowsIterator.hasNext())
+                        if (rowsIterator.next().columns.isEmpty())
+                            rowsIterator.remove();
                 }
+                
+                // reset to iterate through the new batch
+                i = 0;
+
+                // prepare for the next slice to be read
+                startToken = partitioner.getTokenFactory().toString(partitioner.getToken(lastRowKey));
+            }
+            catch (Exception e)
+            {
+                throw new RuntimeException(e);
             }
         }
 
@@ -359,10 +354,8 @@ public class ColumnFamilyRecordReader ex
     {
         if (predicate != null)
             if (predicate.isSetSlice_range())
-            {
-                if (predicate.getSlice_range().getStart() != null || predicate.getSlice_range().getFinish() != null)
+                if (predicate.getSlice_range().getStart() != null && predicate.getSlice_range().getFinish() != null)
                 return false;
-            }
             else if (predicate.isSetColumn_names())
                 return false;