Skip to content

Commit 6c0900c

Browse files
committed
ITS#8355 fix subcursors
make sure C_DEL gets reset in subcursor after it moves.
1 parent 90a07a3 commit 6c0900c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libraries/liblmdb/mdb.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5668,8 +5668,10 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
56685668

56695669
DPRINTF(("cursor_next: top page is %"Z"u in cursor %p",
56705670
mdb_dbg_pgno(mp), (void *) mc));
5671-
if (mc->mc_flags & C_DEL)
5671+
if (mc->mc_flags & C_DEL) {
5672+
mc->mc_flags ^= C_DEL;
56725673
goto skip;
5674+
}
56735675

56745676
if (mc->mc_ki[mc->mc_top] + 1u >= NUMKEYS(mp)) {
56755677
DPUTS("=====> move to next sibling page");
@@ -5748,6 +5750,8 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
57485750
DPRINTF(("cursor_prev: top page is %"Z"u in cursor %p",
57495751
mdb_dbg_pgno(mp), (void *) mc));
57505752

5753+
mc->mc_flags &= ~(C_EOF|C_DEL);
5754+
57515755
if (mc->mc_ki[mc->mc_top] == 0) {
57525756
DPUTS("=====> move to prev sibling page");
57535757
if ((rc = mdb_cursor_sibling(mc, 0)) != MDB_SUCCESS) {
@@ -5759,8 +5763,6 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
57595763
} else
57605764
mc->mc_ki[mc->mc_top]--;
57615765

5762-
mc->mc_flags &= ~C_EOF;
5763-
57645766
DPRINTF(("==> cursor points to page %"Z"u with %u keys, key index %u",
57655767
mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top]));
57665768

0 commit comments

Comments
 (0)