ITS#8355 fix subcursors

make sure C_DEL gets reset in subcursor after it moves.
mdb.RE/0.9
Howard Chu 9 years ago
parent 90a07a398b
commit 6c0900c353
  1. 8
      libraries/liblmdb/mdb.c

@ -5668,8 +5668,10 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
DPRINTF(("cursor_next: top page is %"Z"u in cursor %p", DPRINTF(("cursor_next: top page is %"Z"u in cursor %p",
mdb_dbg_pgno(mp), (void *) mc)); mdb_dbg_pgno(mp), (void *) mc));
if (mc->mc_flags & C_DEL) if (mc->mc_flags & C_DEL) {
mc->mc_flags ^= C_DEL;
goto skip; goto skip;
}
if (mc->mc_ki[mc->mc_top] + 1u >= NUMKEYS(mp)) { if (mc->mc_ki[mc->mc_top] + 1u >= NUMKEYS(mp)) {
DPUTS("=====> move to next sibling page"); 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)
DPRINTF(("cursor_prev: top page is %"Z"u in cursor %p", DPRINTF(("cursor_prev: top page is %"Z"u in cursor %p",
mdb_dbg_pgno(mp), (void *) mc)); mdb_dbg_pgno(mp), (void *) mc));
mc->mc_flags &= ~(C_EOF|C_DEL);
if (mc->mc_ki[mc->mc_top] == 0) { if (mc->mc_ki[mc->mc_top] == 0) {
DPUTS("=====> move to prev sibling page"); DPUTS("=====> move to prev sibling page");
if ((rc = mdb_cursor_sibling(mc, 0)) != MDB_SUCCESS) { 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)
} else } else
mc->mc_ki[mc->mc_top]--; mc->mc_ki[mc->mc_top]--;
mc->mc_flags &= ~C_EOF;
DPRINTF(("==> cursor points to page %"Z"u with %u keys, key index %u", DPRINTF(("==> cursor points to page %"Z"u with %u keys, key index %u",
mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top])); mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top]));

Loading…
Cancel
Save