Re-fix cursor EOF

Fix in 534dcc7212 was in wrong place
robust
Howard Chu 11 years ago
parent 68e6faad5c
commit b3e8c71dc7
  1. 9
      libraries/liblmdb/mdb.c

@ -6352,7 +6352,6 @@ mdb_cursor_del(MDB_cursor *mc, unsigned int flags)
return rc; return rc;
} }
/* otherwise fall thru and delete the sub-DB */ /* otherwise fall thru and delete the sub-DB */
mc->mc_xcursor->mx_cursor.mc_flags |= C_EOF;
} }
if (leaf->mn_flags & F_SUBDATA) { if (leaf->mn_flags & F_SUBDATA) {
@ -7537,9 +7536,11 @@ mdb_cursor_del0(MDB_cursor *mc)
/* if mc points past last node in page, find next sibling */ /* if mc points past last node in page, find next sibling */
if (mc->mc_ki[mc->mc_top] >= nkeys) { if (mc->mc_ki[mc->mc_top] >= nkeys) {
rc = mdb_cursor_sibling(mc, 1); rc = mdb_cursor_sibling(mc, 1);
if (rc == MDB_NOTFOUND) if (rc == MDB_NOTFOUND) {
mc->mc_flags |= C_EOF;
rc = MDB_SUCCESS; rc = MDB_SUCCESS;
} }
}
/* Adjust other cursors pointing to mp */ /* Adjust other cursors pointing to mp */
for (m2 = mc->mc_txn->mt_cursors[dbi]; !rc && m2; m2=m2->mc_next) { for (m2 = mc->mc_txn->mt_cursors[dbi]; !rc && m2; m2=m2->mc_next) {
@ -7556,11 +7557,13 @@ mdb_cursor_del0(MDB_cursor *mc)
} }
if (m3->mc_ki[mc->mc_top] >= nkeys) { if (m3->mc_ki[mc->mc_top] >= nkeys) {
rc = mdb_cursor_sibling(m3, 1); rc = mdb_cursor_sibling(m3, 1);
if (rc == MDB_NOTFOUND) if (rc == MDB_NOTFOUND) {
m3->mc_flags |= C_EOF;
rc = MDB_SUCCESS; rc = MDB_SUCCESS;
} }
} }
} }
}
mc->mc_flags |= C_DEL; mc->mc_flags |= C_DEL;
} }

Loading…
Cancel
Save