cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Brosius (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CASSANDRA-4804) Wrong assumption for KeyRange about range.end_token in get_range_slices().
Date Tue, 16 Oct 2012 02:15:03 GMT

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

Dave Brosius edited comment on CASSANDRA-4804 at 10/16/12 2:14 AM:
-------------------------------------------------------------------

it seems to me you should check range.isSetEnd_key() and range.isSetEnd_token() to see what
option you should use as i believe it's valid for the value to be null, meaning end of range.
+

                
      was (Author: dbrosius):
    it seems to me you should check 

                  
> Wrong assumption for KeyRange about range.end_token in get_range_slices(). 
> ---------------------------------------------------------------------------
>
>                 Key: CASSANDRA-4804
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4804
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Nikolay
>            Assignee: Nikolay
>            Priority: Minor
>             Fix For: 1.1.7, 1.2.0 beta 2
>
>         Attachments: cassa.1.1.6.diff.txt, cassa.1.2.x.diff.txt
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In get_range_slices() there is parameter KeyRange range.
> There you can pass start_key - end_key, start_token - end_token, or start_key - end_token.
> This is described in the documentation.
> in thrift/ThriftValidation.java there is validation function validateKeyRange() (line:489)
that validates correctly the KeyRange, including the case start_key - end_token.
> However in thrift/CassandraServer.java in function get_range_slices() on line: 686 wrong
assumption is made:
>    if (range.start_key == null)
>    {
>       ... // populate tokens
>    }
>    else
>    {
>       bounds = new Bounds<RowPosition>(RowPosition.forKey(range.start_key, p),
RowPosition.forKey(range.end_key, p));
>    }
> This means if there is start key, no end token is checked.
> The opposite - null is "inserted" as end_key.
> Solution:
> same file - thrift/CassandraServer.java on next function - get_paged_slice(), on line:741
same code is written correctly
>    if (range.start_key == null)
>    {
>       ... // populate tokens
>    }
>    else
>    {
>       RowPosition end = range.end_key == null ? p.getTokenFactory().fromString(range.end_token).maxKeyBound(p)
>                            : RowPosition.forKey(range.end_key, p);
>       bounds = new Bounds<RowPosition>(RowPosition.forKey(range.start_key, p),
end);
>    }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message