From 92dec0bca9b6f16fa4157c86b969a5097f418971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Sat, 16 Nov 2024 23:43:26 +0300 Subject: [PATCH] =?UTF-8?q?mdbx:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=83=D1=82=D0=B5=D1=87=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=B0=D0=BC=D1=8F=D1=82=D0=B8=20=D0=B8=D0=B7-?= =?UTF-8?q?=D0=B7=D0=B0=20=D1=80=D0=B5=D0=B3=D1=80=D0=B5=D1=81=D1=81=D0=B0?= =?UTF-8?q?=20=D0=B2=20`txn=5Fend()`=20=D0=BF=D1=80=D0=B8=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=BF=D0=B0?= =?UTF-8?q?=D1=80=D0=BA=D0=BE=D0=B2=D0=BA=D0=B8=20=D1=82=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B7=D0=B0=D0=BA=D1=86=D0=B8=D0=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Если читающая транзакция была припаркована и затем вытеснена, то при её завершении ресурсы не освобождались. --- src/proto.h | 7 +++---- src/txn.c | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/proto.h b/src/proto.h index 80f9394b..28562eb2 100644 --- a/src/proto.h +++ b/src/proto.h @@ -61,20 +61,19 @@ MDBX_INTERNAL int txn_unpark(MDBX_txn *txn); MDBX_INTERNAL int txn_check_badbits_parked(const MDBX_txn *txn, int bad_bits); #define TXN_END_NAMES \ - {"committed", "empty-commit", "abort", "reset", \ - "reset-tmp", "fail-begin", "fail-beginchild", "ousted"} + {"committed", "empty-commit", "abort", "reset", \ + "fail-begin", "fail-beginchild", "ousted", nullptr} enum { /* txn_end operation number, for logging */ TXN_END_COMMITTED, TXN_END_PURE_COMMIT, TXN_END_ABORT, TXN_END_RESET, - TXN_END_RESET_TMP, TXN_END_FAIL_BEGIN, TXN_END_FAIL_BEGINCHILD, TXN_END_OUSTED, - TXN_END_OPMASK = 0x0F /* mask for txn_end() operation number */, + TXN_END_OPMASK = 0x07 /* mask for txn_end() operation number */, TXN_END_UPDATE = 0x10 /* update env state (DBIs) */, TXN_END_FREE = 0x20 /* free txn unless it is env.basal_txn */, TXN_END_EOTDONE = 0x40 /* txn's cursors already closed */, diff --git a/src/txn.c b/src/txn.c index bd8a1a59..724fe2b1 100644 --- a/src/txn.c +++ b/src/txn.c @@ -1350,11 +1350,11 @@ int txn_end(MDBX_txn *txn, unsigned mode) { MDBX_env *env = txn->env; static const char *const names[] = TXN_END_NAMES; - DEBUG("%s txn %" PRIaTXN "%c %p on env %p, root page %" PRIaPGNO + DEBUG("%s txn %" PRIaTXN "%c-0x%X %p on env %p, root page %" PRIaPGNO "/%" PRIaPGNO, names[mode & TXN_END_OPMASK], txn->txnid, - (txn->flags & MDBX_TXN_RDONLY) ? 'r' : 'w', (void *)txn, (void *)env, - txn->dbs[MAIN_DBI].root, txn->dbs[FREE_DBI].root); + (txn->flags & MDBX_TXN_RDONLY) ? 'r' : 'w', txn->flags, (void *)txn, + (void *)env, txn->dbs[MAIN_DBI].root, txn->dbs[FREE_DBI].root); if (!(mode & TXN_END_EOTDONE)) /* !(already closed cursors) */ done_cursors(txn, false); @@ -1374,7 +1374,7 @@ int txn_end(MDBX_txn *txn, unsigned mode) { } else { if ((mode & TXN_END_OPMASK) != TXN_END_OUSTED && safe64_read(&slot->tid) == MDBX_TID_TXN_OUSTED) - mode = (mode & TXN_END_OPMASK) | TXN_END_OUSTED; + mode = (mode & ~TXN_END_OPMASK) | TXN_END_OUSTED; do { safe64_reset(&slot->txnid, false); atomic_store64(&slot->tid, txn->owner, mo_AcquireRelease);