You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2015/09/16 13:07:45 UTC
[jira] [Created] (CASSANDRA-10352) Paging with DISTINCT and IN can
throw ClassCastException
Sylvain Lebresne created CASSANDRA-10352:
--------------------------------------------
Summary: Paging with DISTINCT and IN can throw ClassCastException
Key: CASSANDRA-10352
URL: https://issues.apache.org/jira/browse/CASSANDRA-10352
Project: Cassandra
Issue Type: Bug
Reporter: Sylvain Lebresne
Assignee: Sylvain Lebresne
Fix For: 2.1.x
The ctor of {{SliceQueryPager}} has the following code:
{noformat}
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);
restoreState(state.remaining, true);
}
{noformat}
The assumption that we can only get a {{CellName}} is invalid however. When using a {{MultiPartitionPager}} (so when the query has a {{IN}} on the partition key), it's possible for a page to stop at the end of one of the underlying pager, and for that pager to be exhausted. If that's the case, the {{PagingState}} returned will have the partition key of the next key to retrieve, but a {{null}} cellname (since we haven't started to query that next key). When the next page is queried, that {{PagingState}} will trigger a {{ClassCastException}}.
The [following dtest|https://github.com/pcmanus/cassandra-dtest/commit/b98a112fc22f92aa965d2068345c708ae43b8a85] reproduces this problem.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)