More for stale sub-cursor flags

Same fix for cursor_first/last.
vmware
Howard Chu 12 years ago
parent 56a41d87d4
commit 2c3488aeeb
  1. 12
      libraries/liblmdb/mdb.c

@ -4856,7 +4856,7 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data,
assert(key); assert(key);
assert(key->mv_size > 0); assert(key->mv_size > 0);
if (mc->mc_db->md_flags & MDB_DUPSORT) if (mc->mc_xcursor)
mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF);
/* See if we're already on the right page */ /* See if we're already on the right page */
@ -5031,6 +5031,9 @@ mdb_cursor_first(MDB_cursor *mc, MDB_val *key, MDB_val *data)
int rc; int rc;
MDB_node *leaf; MDB_node *leaf;
if (mc->mc_xcursor)
mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF);
if (!(mc->mc_flags & C_INITIALIZED) || mc->mc_top) { if (!(mc->mc_flags & C_INITIALIZED) || mc->mc_top) {
rc = mdb_page_search(mc, NULL, 0); rc = mdb_page_search(mc, NULL, 0);
if (rc != MDB_SUCCESS) if (rc != MDB_SUCCESS)
@ -5057,8 +5060,6 @@ mdb_cursor_first(MDB_cursor *mc, MDB_val *key, MDB_val *data)
if (rc) if (rc)
return rc; return rc;
} else { } else {
if (mc->mc_xcursor)
mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF);
if ((rc = mdb_node_read(mc->mc_txn, leaf, data)) != MDB_SUCCESS) if ((rc = mdb_node_read(mc->mc_txn, leaf, data)) != MDB_SUCCESS)
return rc; return rc;
} }
@ -5074,6 +5075,9 @@ mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data)
int rc; int rc;
MDB_node *leaf; MDB_node *leaf;
if (mc->mc_xcursor)
mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF);
if (!(mc->mc_flags & C_EOF)) { if (!(mc->mc_flags & C_EOF)) {
if (!(mc->mc_flags & C_INITIALIZED) || mc->mc_top) { if (!(mc->mc_flags & C_INITIALIZED) || mc->mc_top) {
@ -5105,8 +5109,6 @@ mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data)
if (rc) if (rc)
return rc; return rc;
} else { } else {
if (mc->mc_xcursor)
mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF);
if ((rc = mdb_node_read(mc->mc_txn, leaf, data)) != MDB_SUCCESS) if ((rc = mdb_node_read(mc->mc_txn, leaf, data)) != MDB_SUCCESS)
return rc; return rc;
} }

Loading…
Cancel
Save