[
https://issues.apache.org/jira/browse/CASSANDRA-10301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14743399#comment-14743399
]
Benedict commented on CASSANDRA-10301:
--------------------------------------
It really does follow binarySearch semantics, only during descent it honours
those semantics on the inverted indexes (i.e. if you were to reverse the array,
and its indexes (so -1 == size()), before performing binary search, which is in
essence what we are doing, just without the reversal)
I did mean "proceed" as in "proceeding" which is the antonym of "preceding" or
"to precede". I don't mind changing it to succeed, but in common parlance "to
proceed" is more common than "to succeed" for this meaning (succeed is more
commonly associated with _success_ not sequence)
I'm not remotely as upset with this as you are, but I'm also perfectly happy to
move the call out into the BTSI next method, and will formulate a patch to do
so. I very much doubt this would have prevented the mistake, but it is at least
no worse.
> Search for items past end of descending BTreeSearchIterator can fail
> --------------------------------------------------------------------
>
> Key: CASSANDRA-10301
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10301
> Project: Cassandra
> Issue Type: Bug
> Components: Core
> Reporter: Benedict
> Assignee: Benedict
> Priority: Blocker
> Fix For: 3.0.0 rc1
>
>
> A very simple problem, but obvious and with simple fix once it is made
> apparent.
> The internal {{seekTo}} method uses {{binarySearch}} semantics for its return
> value, however when searching backwards {{-1}} is a real value that should be
> returned to the client, as it indicates "past the end" - so basing inexact
> matches from -1 leads to a conflicting meaning, and so it gets
> misinterpreted. Rebasing inexact results to -2 fixes the problem.
> This was not caught because the randomized testing apparently did not test
> for values outside the bounds of the btree. This has been fixed as well, and
> the tests did easily exhibit the problem without the fix.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)