mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-08 05:14:12 +08:00
mdbx: backport - more for cursor tracking after deletion (ITS#8406).
xcursor fixup depends on init state Change-Id: I13139c401e2ae6bbe3d7e6b9fda3739f9ec789cf
This commit is contained in:
parent
e381191c0f
commit
533ad276bb
11
mdb.c
11
mdb.c
@ -8451,6 +8451,11 @@ mdb_cursor_del0(MDB_cursor *mc)
|
|||||||
if (m3->mc_pg[mc->mc_top] == mp) {
|
if (m3->mc_pg[mc->mc_top] == mp) {
|
||||||
if (m3->mc_ki[mc->mc_top] == ki) {
|
if (m3->mc_ki[mc->mc_top] == ki) {
|
||||||
m3->mc_flags |= C_DEL;
|
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) {
|
} else if (m3->mc_ki[mc->mc_top] > ki) {
|
||||||
m3->mc_ki[mc->mc_top]--;
|
m3->mc_ki[mc->mc_top]--;
|
||||||
}
|
}
|
||||||
@ -8496,9 +8501,13 @@ mdb_cursor_del0(MDB_cursor *mc)
|
|||||||
if (mc->mc_db->md_flags & MDB_DUPSORT) {
|
if (mc->mc_db->md_flags & MDB_DUPSORT) {
|
||||||
MDB_node *node = NODEPTR(m3->mc_pg[m3->mc_top], m3->mc_ki[m3->mc_top]);
|
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
|
/* 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) {
|
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
|
||||||
mdb_xcursor_init1(m3, node);
|
mdb_xcursor_init1(m3, node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user