[ 
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:12 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]

EDIT: Actually... I'm not so sure about not having MAX_TOKEN... it might 
actually clean things up quite a bit. Any time a range ends with what use to be 
the min token, you can make a direct translation to MAX_TOKEN.

      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 
[ColumnKey.java|https://github.com/stuhood/cassandra-old/blob/674/src/java/org/apache/cassandra/db/ColumnKey.java#L225]
  
> 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

Reply via email to