cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [2/3] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Date Tue, 25 Feb 2014 09:46:19 GMT
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	src/java/org/apache/cassandra/service/pager/AbstractQueryPager.java


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

Branch: refs/heads/trunk
Commit: 3d93053200adc722101958db19d895f6b390f160
Parents: 6f4e0ba cd2c438
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Tue Feb 25 10:45:53 2014 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Tue Feb 25 10:45:53 2014 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../service/pager/AbstractQueryPager.java       |  8 ++--
 .../service/pager/RangeSliceQueryPager.java     | 13 ++++--
 .../service/pager/SliceQueryPager.java          | 13 +++++-
 .../unit/org/apache/cassandra/SchemaLoader.java |  9 +++-
 .../cassandra/service/QueryPagerTest.java       | 44 ++++++++++++++++++--
 6 files changed, 74 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3d930532/CHANGES.txt
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3d930532/src/java/org/apache/cassandra/service/pager/AbstractQueryPager.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/pager/AbstractQueryPager.java
index 363aec8,1b4bdbd..9a94944
--- a/src/java/org/apache/cassandra/service/pager/AbstractQueryPager.java
+++ b/src/java/org/apache/cassandra/service/pager/AbstractQueryPager.java
@@@ -332,13 -332,13 +332,13 @@@ abstract class AbstractQueryPager imple
          return Math.min(liveCount, toDiscard);
      }
  
-     protected static CellName firstName(ColumnFamily cf)
 -    protected static Column firstColumn(ColumnFamily cf)
++    protected static Cell firstCell(ColumnFamily cf)
      {
-         return cf.iterator().next().name();
+         return cf.iterator().next();
      }
  
-     protected static CellName lastName(ColumnFamily cf)
 -    protected static Column lastColumn(ColumnFamily cf)
++    protected static Cell lastCell(ColumnFamily cf)
      {
-         return cf.getReverseSortedColumns().iterator().next().name();
+         return cf.getReverseSortedColumns().iterator().next();
      }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3d930532/src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java
index 9b07163,0df1d25..7e79ffe
--- a/src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java
+++ b/src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java
@@@ -90,15 -89,20 +90,20 @@@ public class RangeSliceQueryPager exten
  
      protected boolean containsPreviousLast(Row first)
      {
-         return lastReturnedKey != null
-             && lastReturnedKey.equals(first.key)
-             && lastReturnedName.equals(isReversed() ? lastName(first.cf) : firstName(first.cf));
+         if (lastReturnedKey == null || !lastReturnedKey.equals(first.key))
+             return false;
+ 
+         // Same as SliceQueryPager, we ignore a deleted column
 -        Column firstColumn = isReversed() ? lastColumn(first.cf) : firstColumn(first.cf);
 -        return !first.cf.deletionInfo().isDeleted(firstColumn)
 -            && firstColumn.isLive(timestamp())
 -            && lastReturnedName.equals(firstColumn.name());
++        Cell firstCell = isReversed() ? lastCell(first.cf) : firstCell(first.cf);
++        return !first.cf.deletionInfo().isDeleted(firstCell)
++            && firstCell.isLive(timestamp())
++            && lastReturnedName.equals(firstCell.name());
      }
  
      protected boolean recordLast(Row last)
      {
          lastReturnedKey = last.key;
-         lastReturnedName = isReversed() ? firstName(last.cf) : lastName(last.cf);
 -        lastReturnedName = (isReversed() ? firstColumn(last.cf) : lastColumn(last.cf)).name();
++        lastReturnedName = (isReversed() ? firstCell(last.cf) : lastCell(last.cf)).name();
          return true;
      }
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3d930532/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/pager/SliceQueryPager.java
index fbc36e0,c94f7f6..3a8c81f
--- a/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java
+++ b/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java
@@@ -82,12 -81,21 +82,21 @@@ public class SliceQueryPager extends Ab
  
      protected boolean containsPreviousLast(Row first)
      {
-         return lastReturned != null && lastReturned.equals(isReversed() ? lastName(first.cf)
: firstName(first.cf));
+         if (lastReturned == null)
+             return false;
+ 
 -        Column firstColumn = isReversed() ? lastColumn(first.cf) : firstColumn(first.cf);
++        Cell firstCell = isReversed() ? lastCell(first.cf) : firstCell(first.cf);
+         // Note: we only return true if the column is the lastReturned *and* it is live.
If it is deleted, it is ignored by the
+         // rest of the paging code (it hasn't been counted as live in particular) and we
want to act as if it wasn't there.
 -        return !first.cf.deletionInfo().isDeleted(firstColumn)
 -            && firstColumn.isLive(timestamp())
 -            && lastReturned.equals(firstColumn.name());
++        return !first.cf.deletionInfo().isDeleted(firstCell)
++            && firstCell.isLive(timestamp())
++            && lastReturned.equals(firstCell.name());
      }
  
      protected boolean recordLast(Row last)
      {
-         lastReturned = isReversed() ? firstName(last.cf) : lastName(last.cf);
 -        Column lastColumn = isReversed() ? firstColumn(last.cf) : lastColumn(last.cf);
 -        lastReturned = lastColumn.name();
++        Cell lastCell = isReversed() ? firstCell(last.cf) : lastCell(last.cf);
++        lastReturned = lastCell.name();
          return true;
      }
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3d930532/test/unit/org/apache/cassandra/SchemaLoader.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3d930532/test/unit/org/apache/cassandra/service/QueryPagerTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/service/QueryPagerTest.java
index 318feb9,0645433..84f51f4
--- a/test/unit/org/apache/cassandra/service/QueryPagerTest.java
+++ b/test/unit/org/apache/cassandra/service/QueryPagerTest.java
@@@ -30,8 -30,8 +30,9 @@@ import org.apache.cassandra.Util
  import org.apache.cassandra.SchemaLoader;
  import org.apache.cassandra.OrderedJUnit4ClassRunner;
  import org.apache.cassandra.db.*;
 +import org.apache.cassandra.db.composites.*;
  import org.apache.cassandra.db.filter.*;
+ import org.apache.cassandra.db.marshal.CompositeType;
  import org.apache.cassandra.dht.*;
  import org.apache.cassandra.service.pager.*;
  import org.apache.cassandra.utils.ByteBufferUtil;
@@@ -149,14 -145,25 +151,25 @@@ public class QueryPagerTest extends Sch
  
      private static void assertRow(Row r, String key, String... names)
      {
+         ByteBuffer[] bbs = new ByteBuffer[names.length];
+         for (int i = 0; i < names.length; i++)
+             bbs[i] = bytes(names[i]);
+         assertRow(r, key, bbs);
+     }
+ 
+     private static void assertRow(Row r, String key, ByteBuffer... names)
+     {
          assertEquals(key, string(r.key.key));
          assertNotNull(r.cf);
-         assertEquals(toString(r.cf), names.length, r.cf.getColumnCount());
          int i = 0;
 -        for (Column c : r.cf)
 +        for (Cell c : r.cf)
          {
-             String expected = names[i++];
-             assertEquals("column " + i + " doesn't match: " + toString(r.cf), expected,
string(c.name()));
+             // Ignore deleted cells if we have them
+             if (!c.isLive(0))
+                 continue;
+ 
+             ByteBuffer expected = names[i++];
+             assertEquals("column " + i + " doesn't match: " + toString(r.cf), expected,
c.name());
          }
      }
  


Mime
View raw message