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:15:46 UTC

[jira] [Commented] (CASSANDRA-10352) Paging with DISTINCT and IN can throw ClassCastException

    [ https://issues.apache.org/jira/browse/CASSANDRA-10352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14747318#comment-14747318 ] 

Sylvain Lebresne commented on CASSANDRA-10352:
----------------------------------------------

Forget to mention that as far as I can tell, this can only happen when we only query static columns (hence the {{DISTINCT}} in the description and test) because I believe it's the only case where {{MultiPartitionPager}} can end up a pager with the last used sub-pager exhausted (and that's because {{DISTINCT}} with statics force each partition count to 1, and this even though the query limit is much larger (or has no limit)). And if I'm wrong and there is more ways to trigger that, then all the more reason to fix.

> 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)