mdbx: более полная очистка курсоров при закрытии/отключении (backport).

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2025-03-02 11:44:10 +03:00
parent 1792bdc763
commit 9277daa185

View File

@ -121,8 +121,8 @@ int mdbx_cursor_unbind(MDBX_cursor *mc) {
} }
mc->next = mc; mc->next = mc;
} }
be_poor(mc);
mc->signature = cur_signature_ready4dispose; mc->signature = cur_signature_ready4dispose;
mc->flags = 0;
return MDBX_SUCCESS; return MDBX_SUCCESS;
} }
@ -171,6 +171,7 @@ void mdbx_cursor_close(MDBX_cursor *mc) {
/* Cursor closed before nested txn ends */ /* Cursor closed before nested txn ends */
tASSERT(txn, mc->signature == cur_signature_live); tASSERT(txn, mc->signature == cur_signature_live);
ENSURE(txn->env, check_txn_rw(txn, 0) == MDBX_SUCCESS); ENSURE(txn->env, check_txn_rw(txn, 0) == MDBX_SUCCESS);
be_poor(mc);
mc->signature = cur_signature_wait4eot; mc->signature = cur_signature_wait4eot;
} }
} }
@ -218,8 +219,8 @@ int mdbx_txn_release_all_cursors(const MDBX_txn *txn, bool unbind) {
txn->cursors[i] = mc->next; txn->cursors[i] = mc->next;
mc->next = mc; mc->next = mc;
if (unbind) { if (unbind) {
be_poor(mc);
mc->signature = cur_signature_ready4dispose; mc->signature = cur_signature_ready4dispose;
mc->flags = 0;
} else { } else {
mc->signature = 0; mc->signature = 0;
osal_free(mc); osal_free(mc);