summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorHoward Chu <hyc@openldap.org>2017-03-23 20:37:24 +0000
committerHoward Chu <hyc@openldap.org>2017-03-23 20:55:12 +0000
commit4d2154397afd90ca519bfa102b2aad515159bd50 (patch)
treeed3af7637e57c60663bb2253bd1ccb7511d07ae4 /libraries
parentb5e5fcc31dd6719a618cd825a0a9c4ecef5d045b (diff)
downloadlmdb-4d2154397afd90ca519bfa102b2aad515159bd50.tar.gz
lmdb-4d2154397afd90ca519bfa102b2aad515159bd50.tar.bz2
lmdb-4d2154397afd90ca519bfa102b2aad515159bd50.zip
ITS#8622 fix xcursor after cursor_del
Re-fix 6b1df0e4c7fadd21d1233d7157229b2d89ccaa04 from ITS#8406
Diffstat (limited to 'libraries')
-rw-r--r--libraries/liblmdb/mdb.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c
index 4a364f7..970e1ef 100644
--- a/libraries/liblmdb/mdb.c
+++ b/libraries/liblmdb/mdb.c
@@ -9302,14 +9302,17 @@ mdb_cursor_del0(MDB_cursor *mc)
}
if (mc->mc_db->md_flags & MDB_DUPSORT) {
MDB_node *node = NODEPTR(m3->mc_pg[m3->mc_top], m3->mc_ki[m3->mc_top]);
- /* If this node is a fake page, it needs to be reinited
- * because its data has moved. But just reset mc_pg[0]
- * if the xcursor is already live.
+ /* If this node has dupdata, it may need to be reinited
+ * because its data has moved.
+ * If the xcursor was not initd it must be reinited.
+ * Else if node points to a subDB, nothing is needed.
+ * Else (xcursor was initd, not a subDB) needs mc_pg[0] reset.
*/
- if ((node->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) {
- if (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED)
- m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(node);
- else
+ if (node->mn_flags & F_DUPDATA) {
+ if (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) {
+ if (!(node->mn_flags & F_SUBDATA))
+ m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(node);
+ } else
mdb_xcursor_init1(m3, node);
}
}