mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
Fix off-by-one logic in btree table traversal
This commit is contained in:
parent
fa295af635
commit
f5220d281d
1 changed files with 2 additions and 2 deletions
|
@ -1255,7 +1255,7 @@ impl BTreeCursor {
|
|||
// LE | > or = | go left | Last <= key is in left subtree
|
||||
// LE | < | go right | Last <= key is in right subtree
|
||||
// LT | > or = | go left | Last < key is in left subtree
|
||||
// LT | < | go right | Last < key is in right subtree
|
||||
// LT | < | go right?| Last < key is in right subtree, except if cell rowid is exactly 1 less
|
||||
//
|
||||
// No iteration (point query):
|
||||
// EQ | > or = | go left | Last = key is in left subtree
|
||||
|
@ -1277,7 +1277,7 @@ impl BTreeCursor {
|
|||
(
|
||||
IterationState::Iterating(IterationDirection::Backwards),
|
||||
SeekOp::LT,
|
||||
) => *cell_rowid >= rowid_key,
|
||||
) => *cell_rowid >= rowid_key || *cell_rowid == rowid_key - 1,
|
||||
(_any, SeekOp::EQ) => *cell_rowid >= rowid_key,
|
||||
_ => unreachable!(
|
||||
"invalid combination of seek op and iteration state: {:?} {:?}",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue