mirror of
https://github.com/isar/libmdbx.git
synced 2025-10-25 01:08:56 +08:00
mdbx: adding cursors tracking/lists for read-only transactions.
Briefly, this commit fixes a missed flaw: - Cursor tracking is required to replacing shaded pages and adjusting the positions in writing transactions; - Thus, historically, an internal linked list was maintained for a read-write transactions, but not for a read-only. For this reason, the API for using cursors should be different for writing and reading transactions; - However, the libmdbx's API has been significantly improved, including the ability to reuse cursors and a uniform cursors behavior for any kind of transactions. My mistake is that due to working with MithrilDB, I forgot to make a same changes to libmdbx. Fixes https://github.com/erthink/libmdbx/issues/272.
This commit is contained in:
@@ -945,6 +945,7 @@ struct MDBX_txn {
|
||||
size_t mt_owner; /* thread ID that owns this transaction */
|
||||
MDBX_canary mt_canary;
|
||||
void *mt_userctx; /* User-settable context */
|
||||
MDBX_cursor **mt_cursors;
|
||||
|
||||
union {
|
||||
struct {
|
||||
@@ -953,7 +954,6 @@ struct MDBX_txn {
|
||||
} to;
|
||||
struct {
|
||||
/* In write txns, array of cursors for each DB */
|
||||
MDBX_cursor **cursors;
|
||||
pgno_t *reclaimed_pglist; /* Reclaimed GC pages */
|
||||
txnid_t last_reclaimed; /* ID of last used record */
|
||||
#if MDBX_ENABLE_REFUND
|
||||
|
||||
Reference in New Issue
Block a user