diff options
author | Howard Chu <hyc@openldap.org> | 2016-11-29 19:19:45 +0000 |
---|---|---|
committer | Howard Chu <hyc@openldap.org> | 2016-11-29 19:19:45 +0000 |
commit | fa83b25ec536ac2642f8e0d3c6bf587008513ef4 (patch) | |
tree | 873c4ed10ee9411f539ad729ad7097359aa29fe8 | |
parent | e58db7d5568c8ac91c0f1e6c64a58ba6f84b037d (diff) | |
download | lmdb-fa83b25ec536ac2642f8e0d3c6bf587008513ef4.tar.gz lmdb-fa83b25ec536ac2642f8e0d3c6bf587008513ef4.tar.bz2 lmdb-fa83b25ec536ac2642f8e0d3c6bf587008513ef4.zip |
More for ITS#8406
xcursor fixup depends on init state
-rw-r--r-- | libraries/liblmdb/mdb.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 026019e..cb17f64 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -9154,6 +9154,11 @@ mdb_cursor_del0(MDB_cursor *mc) if (m3->mc_pg[mc->mc_top] == mp) { if (m3->mc_ki[mc->mc_top] == ki) { m3->mc_flags |= C_DEL; + if (mc->mc_db->md_flags & MDB_DUPSORT) { + /* Sub-cursor referred into dataset which is gone */ + m3->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); + } + continue; } else if (m3->mc_ki[mc->mc_top] > ki) { m3->mc_ki[mc->mc_top]--; } @@ -9199,10 +9204,14 @@ 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. + * because its data has moved. But just reset mc_pg[0] + * if the xcursor is already live. */ if ((node->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) { - mdb_xcursor_init1(m3, node); + if (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) + m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(node); + else + mdb_xcursor_init1(m3, node); } } } |