[ 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