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 2011/04/09 22:10:05 UTC

[jira] [Issue Comment Edited] (CASSANDRA-1034) Remove assumption that Key to Token is one-to-one

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

Stu Hood edited comment on CASSANDRA-1034 at 4/9/11 8:09 PM:
-------------------------------------------------------------

I agree that using null is a necessary solution here: you need a max value for keys, since they are essentially the "child" of a one-token-range. The key range is bounded (since it has parents), but the token range is not, so I agree with sylvain that a MAX_TOKEN is probably not necessary.

One way to remove toSplitValue would be to use DecoratedKey everywhere; DecoratedKey is a compound of the Token and the key blob. The equivalent of today's Token is a DecoratedKey for that token with a null key: it compares greater than all valid child keys, so it contains them.

I hope that it won't muddy the water, but the <empty> as min and <null> as max approach is the same one I took forthe first cut of the file-format, and it worked very well. You can use the min/max values to find the beginning or end of a child range. See [ColumnKey.java|https://github.com/stuhood/cassandra-old/blob/674/src/java/org/apache/cassandra/db/ColumnKey.java#L225]

      was (Author: stuhood):
    I agree that using null is a necessary solution here: you need a max value for keys, since they are essentially the "child" of a one-token-range. The key range is bounded (since it has parents), but the token range is not, so I agree with sylvain that a MAX_TOKEN is probably not necessary.

One way to remove toSplitValue would be to use DecoratedKey everywhere; DecoratedKey is a compound of the Token and the key blob. The equivalent of today's Token is a DecoratedKey for that token with a null key: it compares greater than all valid child keys, so it contains them.

I hope that it won't muddy the water, but the <empty> as min and <null> as max approach is the same one I took forthe first cut of the file-format, and it worked very well. You can use the min/max values to find the beginning or end of a child range. See https://github.com/stuhood/cassandra-old/blob/674/src/java/org/apache/cassandra/db/ColumnKey.java
  
> Remove assumption that Key to Token is one-to-one
> -------------------------------------------------
>
>                 Key: CASSANDRA-1034
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1034
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Stu Hood
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 0.8
>
>         Attachments: 0001-Generify-AbstractBounds.patch, 0001-Make-range-accept-both-Token-and-DecoratedKey.patch, 0002-LengthPartitioner.patch, 0002-Remove-assumption-that-token-and-keys-are-one-to-one-v2.patch, 0002-Remove-assumption-that-token-and-keys-are-one-to-one.patch, 1034_v1.txt
>
>
> get_range_slices assumes that Tokens do not collide and converts a KeyRange to an AbstractBounds. For RandomPartitioner, this assumption isn't safe, and would lead to a very weird heisenberg.
> Converting AbstractBounds to use a DecoratedKey would solve this, because the byte[] key portion of the DecoratedKey can act as a tiebreaker. Alternatively, we could make DecoratedKey extend Token, and then use DecoratedKeys in places where collisions are unacceptable.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira