You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2015/09/18 16:31:09 UTC
cassandra git commit: Fix possible ClassCastException during paging
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.1 d0c166f92 -> 0c1432ac7
Fix possible ClassCastException during paging
In the case of DISTINCT query involving static columns and a IN on
the partition key, it's possible to hit a ClassCastException when
restoring the PagingState in SliceQueryPager because it assumes the
cellname in said PagingState is a valid CellName even though it will
be empty in that case.
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0c1432ac
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0c1432ac
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0c1432ac
Branch: refs/heads/cassandra-2.1
Commit: 0c1432ac7b4b0464351fb23196cf9070c05d0bd3
Parents: d0c166f
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Sep 16 13:17:18 2015 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Sep 18 16:30:56 2015 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/service/pager/SliceQueryPager.java | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c1432ac/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f629050..deec093 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.1.10
+ * Fix potential ClassCastException during paging (CASSANDRA-10352)
* Prevent ALTER TYPE from creating circular references (CASSANDRA-10339)
* Fix cache handling of 2i and base tables (CASSANDRA-10155, 10359)
* Fix NPE in nodetool compactionhistory (CASSANDRA-9758)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0c1432ac/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java b/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java
index 520fc34..c8572d4 100644
--- a/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java
+++ b/src/java/org/apache/cassandra/service/pager/SliceQueryPager.java
@@ -59,9 +59,10 @@ public class SliceQueryPager extends AbstractQueryPager implements SinglePartiti
if (state != null)
{
- // The only case where this could be a non-CellName Composite is if it's Composites.EMPTY, but that's not
- // valid for PagingState.cellName, so we can safely cast to CellName.
- lastReturned = (CellName) cfm.comparator.fromByteBuffer(state.cellName);
+ // The cellname can be empty if this is used in a MultiPartitionPager and we're supposed to start reading this row
+ // (because the previous page has exhausted the previous pager). See #10352 for details.
+ if (state.cellName.hasRemaining())
+ lastReturned = (CellName) cfm.comparator.fromByteBuffer(state.cellName);
restoreState(state.remaining, true);
}
}