You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Stu Hood (JIRA)" <ji...@apache.org> on 2009/07/31 22:35:15 UTC

[jira] Updated: (CASSANDRA-242) Implement method to "evenly" split a Range

     [ https://issues.apache.org/jira/browse/CASSANDRA-242?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stu Hood updated CASSANDRA-242:
-------------------------------

    Attachment: CASSANDRA-242.diff

This patch implements 1) via a 'Collatable' abstract class, with Collatable.String and Collatable.Bytes.

The main wart is that a Collatable.Bytes object will throw a RuntimeException if you attempt to use it asString(), but it might still be a reasonable approach for plugging in a Token that is never meant to be serialized or decorated.

A third option would be to 3) Add an explicit third state for Tokens: plain, decorated and -binary-. Once a token is in a binary state, it cannot be converted back to plain or decorated. The explicitness is key.

> Implement method to "evenly" split a Range
> ------------------------------------------
>
>                 Key: CASSANDRA-242
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-242
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Core
>            Reporter: Stu Hood
>            Assignee: Stu Hood
>         Attachments: CASSANDRA-242.diff
>
>
> Two tickets currently depend on being able to deterministically split a Range object into two "even" Ranges.
> This can be accomplished with RandomPartitioner/BigIntegerToken by taking the average of the tokens, but the OrderPreservingPartitioner/StringToken implementation uses a Java Collator to define the sort order of Tokens, which means that they are not necessarily sorted in byte/char order.
> Collator.getCollationKey(String).toByteArray() gets you a sortable byte array, but there is no publicly accessible API for converting a similar byte array back into a String.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.