Details
-
Bug
-
Status: Resolved
-
Low
-
Resolution: Fixed
-
None
-
Low
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); }