[
https://issues.apache.org/jira/browse/CASSANDRA-8244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14200374#comment-14200374
]
Branimir Lambov commented on CASSANDRA-8244:
--------------------------------------------
Proposed patch is uploaded for review on
https://github.com/blambov/cassandra/compare/8244-partitioner-in-token. Applies
on top of CASSANDRA-8230 on trunk.
Changes tokens and {{RingPosition}} to provide a reference to the partitioner
that created them, which is used to make sure Range/Bounds always use the
correct partitioner for the bounds they contain. Previously this was quite easy
to get wrong without noticing, see e.g. {{DataRange.allData}}. To avoid
increasing the space used by a token, this is done by moving the token type
definitions inside the partitioner, which allows them to have a static
reference to it, except {{LocalToken}} which now replaces the reference to its
comparator with a reference to the issuing partitioner.
Removes custom key construction in {{SecondaryIndex.getIndexKeyFor}} and
delegates the task to the {{indexCfs}} partitioner, the presence of which is
already tested whenever {{getIndexKeyFor}} is used.
Adds static instances of the partitioners and a mechanism to choose them
instead of instantiating a new copy in {{FBUtilities.newPartitioner}}.
Fixes {{KeyCollisionTest}} which wasn't changing the partitioner as expected,
and was also passing with the wrong partitioner.
> Token, DecoratedKey, RowPosition and all bound types should not make any
> hidden references to the database partitioner
> ----------------------------------------------------------------------------------------------------------------------
>
> Key: CASSANDRA-8244
> URL: https://issues.apache.org/jira/browse/CASSANDRA-8244
> Project: Cassandra
> Issue Type: Bug
> Reporter: Branimir Lambov
> Assignee: Branimir Lambov
> Priority: Minor
>
> Currently some of the functionality of Token refers to
> StorageService.getPartitioner() to avoid needing an extra argument. This is
> in turn implicitly used by RowPosition and then Range, causing possible
> problems, for example when ranges on secondary indices are used in a
> murmur-partitioned database.
> These references should be removed to force explicit choice of partitioner by
> callers; alternatively, the Token interface could be changed to provide a
> reference to the partitioner that created it.
> (Note: the hidden reference to partitioner in serialization is a separate
> issue.)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)