You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Nikolay (JIRA)" <ji...@apache.org> on 2012/10/14 17:47:02 UTC

[jira] [Created] (CASSANDRA-4804) Wrong assumption about KeyRange raein get_range_slices().

Nikolay created CASSANDRA-4804:
----------------------------------

             Summary: Wrong assumption about KeyRange raein get_range_slices(). 
                 Key: CASSANDRA-4804
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4804
             Project: Cassandra
          Issue Type: Bug
            Reporter: Nikolay
            Priority: Minor




--
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

[jira] [Commented] (CASSANDRA-4804) Wrong assumption for KeyRange about range.end_token in get_range_slices().

Posted by "Dave Brosius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13476661#comment-13476661 ] 

Dave Brosius commented on CASSANDRA-4804:
-----------------------------------------

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

[jira] [Updated] (CASSANDRA-4804) Wrong assumption for KeyRange about range.end_token in get_range_slices().

Posted by "Nikolay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikolay updated CASSANDRA-4804:
-------------------------------

    Description: 
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);

   }



  was:
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 no 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);

   }



    
> 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
>    Affects Versions: 1.1.5
>            Reporter: Nikolay
>            Priority: Minor
>             Fix For: 1.1.5
>
>   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

[jira] [Comment Edited] (CASSANDRA-4804) Wrong assumption for KeyRange about range.end_token in get_range_slices().

Posted by "Dave Brosius (JIRA)" <ji...@apache.org>.
    [ 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:21 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.


bah... ignore this comment. new byte[0] is the way to specify end of range.

                
      was (Author: dbrosius):
    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.
+

                  
> 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

[jira] [Updated] (CASSANDRA-4804) Wrong assumption for KeyRange about range.end_token in get_range_slices().

Posted by "Nikolay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikolay updated CASSANDRA-4804:
-------------------------------

    Labels:   (was: patch)
    
> 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
>    Affects Versions: 1.1.5
>            Reporter: Nikolay
>            Priority: Minor
>             Fix For: 1.1.5
>
>   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 no 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

[jira] [Updated] (CASSANDRA-4804) Wrong assumption for KeyRange about range.end_token in get_range_slices().

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis updated CASSANDRA-4804:
--------------------------------------

             Reviewer: dbrosius
    Affects Version/s:     (was: 1.1.6)
                           (was: 1.2.0 beta 1)
        Fix Version/s:     (was: 1.1.6)
                           (was: 1.2.0 beta 1)
                       1.2.0 beta 2
                       1.1.7
             Assignee: Nikolay

Can you review, Dave?
                
> 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

[jira] [Comment Edited] (CASSANDRA-4804) Wrong assumption for KeyRange about range.end_token in get_range_slices().

Posted by "Dave Brosius (JIRA)" <ji...@apache.org>.
    [ 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

[jira] [Updated] (CASSANDRA-4804) Wrong assumption for KeyRange about range.end_token in get_range_slices().

Posted by "Nikolay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikolay updated CASSANDRA-4804:
-------------------------------

    Summary: Wrong assumption for KeyRange about range.end_token in get_range_slices().   (was: Wrong assumption about KeyRange about range.end_token get_range_slices(). )
    
> 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
>    Affects Versions: 1.1.5
>            Reporter: Nikolay
>            Priority: Minor
>              Labels: patch
>             Fix For: 1.1.5
>
>   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 no 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

[jira] [Updated] (CASSANDRA-4804) Wrong assumption about KeyRange about range.end_token get_range_slices().

Posted by "Nikolay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikolay updated CASSANDRA-4804:
-------------------------------

    Description: 
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 no 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);

   }



  was:
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 no 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);

   }



    
> Wrong assumption about KeyRange about range.end_token get_range_slices(). 
> --------------------------------------------------------------------------
>
>                 Key: CASSANDRA-4804
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4804
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 1.1.5
>            Reporter: Nikolay
>            Priority: Minor
>              Labels: patch
>             Fix For: 1.1.5
>
>   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 no 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

[jira] [Commented] (CASSANDRA-4804) Wrong assumption for KeyRange about range.end_token in get_range_slices().

Posted by "Dave Brosius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477586#comment-13477586 ] 

Dave Brosius commented on CASSANDRA-4804:
-----------------------------------------

committed to cassandra-1.1 as commit 4d637f1f1b62593e0c52e49966e3f286bf65c3e9
                
> 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

[jira] [Updated] (CASSANDRA-4804) Wrong assumption about KeyRange about range.end_token get_range_slices().

Posted by "Nikolay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikolay updated CASSANDRA-4804:
-------------------------------

           Component/s: API
           Description: 
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 no 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);

   }


     Affects Version/s: 1.1.5
    Remaining Estimate: 1h
     Original Estimate: 1h
               Summary: Wrong assumption about KeyRange about range.end_token get_range_slices().   (was: Wrong assumption about KeyRange raein get_range_slices(). )
    
> Wrong assumption about KeyRange about range.end_token get_range_slices(). 
> --------------------------------------------------------------------------
>
>                 Key: CASSANDRA-4804
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4804
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 1.1.5
>            Reporter: Nikolay
>            Priority: Minor
>              Labels: patch
>             Fix For: 1.1.5
>
>   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 no 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

[jira] [Commented] (CASSANDRA-4804) Wrong assumption for KeyRange about range.end_token in get_range_slices().

Posted by "Dave Brosius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13476670#comment-13476670 ] 

Dave Brosius commented on CASSANDRA-4804:
-----------------------------------------

1.2 patch doesn't apply cleanly. 

remove commented out code

otherwise patch works as expected.
                
> 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

[jira] [Updated] (CASSANDRA-4804) Wrong assumption for KeyRange about range.end_token in get_range_slices().

Posted by "Nikolay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikolay updated CASSANDRA-4804:
-------------------------------

    Attachment: cassa.1.2.x.diff.txt
                cassa.1.1.6.diff.txt
    
> 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
>    Affects Versions: 1.1.6, 1.2.0 beta 1
>            Reporter: Nikolay
>            Priority: Minor
>             Fix For: 1.1.6, 1.2.0 beta 1
>
>         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

[jira] [Updated] (CASSANDRA-4804) Wrong assumption about KeyRange about range.end_token get_range_slices().

Posted by "Nikolay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikolay updated CASSANDRA-4804:
-------------------------------

    Description: 
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 no 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);

   }



  was:
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 no 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);

   }



    
> Wrong assumption about KeyRange about range.end_token get_range_slices(). 
> --------------------------------------------------------------------------
>
>                 Key: CASSANDRA-4804
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4804
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 1.1.5
>            Reporter: Nikolay
>            Priority: Minor
>              Labels: patch
>             Fix For: 1.1.5
>
>   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 no 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