|
|
@ -3349,7 +3349,7 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) |
|
|
|
return rc; |
|
|
|
return rc; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mc->mc_xcursor->mx_cursor.mc_flags = 0; |
|
|
|
mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; |
|
|
|
if (op == MDB_NEXT_DUP) |
|
|
|
if (op == MDB_NEXT_DUP) |
|
|
|
return MDB_NOTFOUND; |
|
|
|
return MDB_NOTFOUND; |
|
|
|
} |
|
|
|
} |
|
|
@ -3419,7 +3419,7 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) |
|
|
|
if (op != MDB_PREV || rc == MDB_SUCCESS) |
|
|
|
if (op != MDB_PREV || rc == MDB_SUCCESS) |
|
|
|
return rc; |
|
|
|
return rc; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mc->mc_xcursor->mx_cursor.mc_flags = 0; |
|
|
|
mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; |
|
|
|
if (op == MDB_PREV_DUP) |
|
|
|
if (op == MDB_PREV_DUP) |
|
|
|
return MDB_NOTFOUND; |
|
|
|
return MDB_NOTFOUND; |
|
|
|
} |
|
|
|
} |
|
|
@ -3623,7 +3623,7 @@ set1: |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (mc->mc_xcursor) |
|
|
|
if (mc->mc_xcursor) |
|
|
|
mc->mc_xcursor->mx_cursor.mc_flags = 0; |
|
|
|
mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
@ -3671,7 +3671,7 @@ mdb_cursor_first(MDB_cursor *mc, MDB_val *key, MDB_val *data) |
|
|
|
return rc; |
|
|
|
return rc; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (mc->mc_xcursor) |
|
|
|
if (mc->mc_xcursor) |
|
|
|
mc->mc_xcursor->mx_cursor.mc_flags = 0; |
|
|
|
mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
@ -3718,7 +3718,7 @@ mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data) |
|
|
|
return rc; |
|
|
|
return rc; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (mc->mc_xcursor) |
|
|
|
if (mc->mc_xcursor) |
|
|
|
mc->mc_xcursor->mx_cursor.mc_flags = 0; |
|
|
|
mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
@ -3918,7 +3918,7 @@ mdb_cursor_put(MDB_cursor *mc, MDB_val *key, MDB_val *data, |
|
|
|
int exact = 0; |
|
|
|
int exact = 0; |
|
|
|
MDB_val d2; |
|
|
|
MDB_val d2; |
|
|
|
rc = mdb_cursor_set(mc, key, &d2, MDB_SET, &exact); |
|
|
|
rc = mdb_cursor_set(mc, key, &d2, MDB_SET, &exact); |
|
|
|
if (flags == MDB_NOOVERWRITE && rc == 0) { |
|
|
|
if ((flags & MDB_NOOVERWRITE) && rc == 0) { |
|
|
|
DPRINTF("duplicate key [%s]", DKEY(key)); |
|
|
|
DPRINTF("duplicate key [%s]", DKEY(key)); |
|
|
|
*data = d2; |
|
|
|
*data = d2; |
|
|
|
return MDB_KEYEXIST; |
|
|
|
return MDB_KEYEXIST; |
|
|
@ -4571,6 +4571,8 @@ mdb_xcursor_init0(MDB_cursor *mc) |
|
|
|
mx->mx_cursor.mc_dbx = &mx->mx_dbx; |
|
|
|
mx->mx_cursor.mc_dbx = &mx->mx_dbx; |
|
|
|
mx->mx_cursor.mc_dbi = mc->mc_dbi+1; |
|
|
|
mx->mx_cursor.mc_dbi = mc->mc_dbi+1; |
|
|
|
mx->mx_cursor.mc_dbflag = &mx->mx_dbflag; |
|
|
|
mx->mx_cursor.mc_dbflag = &mx->mx_dbflag; |
|
|
|
|
|
|
|
mx->mx_cursor.mc_snum = 0; |
|
|
|
|
|
|
|
mx->mx_cursor.mc_flags = C_SUB; |
|
|
|
mx->mx_dbx.md_cmp = mc->mc_dbx->md_dcmp; |
|
|
|
mx->mx_dbx.md_cmp = mc->mc_dbx->md_dcmp; |
|
|
|
mx->mx_dbx.md_dcmp = NULL; |
|
|
|
mx->mx_dbx.md_dcmp = NULL; |
|
|
|
mx->mx_dbx.md_rel = mc->mc_dbx->md_rel; |
|
|
|
mx->mx_dbx.md_rel = mc->mc_dbx->md_rel; |
|
|
@ -5548,6 +5550,8 @@ done: |
|
|
|
m3 = &m2->mc_xcursor->mx_cursor; |
|
|
|
m3 = &m2->mc_xcursor->mx_cursor; |
|
|
|
else |
|
|
|
else |
|
|
|
m3 = m2; |
|
|
|
m3 = m2; |
|
|
|
|
|
|
|
if (!(m3->mc_flags & C_INITIALIZED)) |
|
|
|
|
|
|
|
continue; |
|
|
|
if (new_root) { |
|
|
|
if (new_root) { |
|
|
|
/* root split */ |
|
|
|
/* root split */ |
|
|
|
for (i=m3->mc_top; i>0; i--) { |
|
|
|
for (i=m3->mc_top; i>0; i--) { |
|
|
|