mdbx: automatically abort errored transaction in mdbx_txn_commit().

Change-Id: I2cfac73c69a8ff46870778f174555724f8363a79
This commit is contained in:
Leonid Yuriev
2020-04-24 12:37:29 +03:00
parent 673570ec2a
commit 3b741a6d5f
2 changed files with 55 additions and 13 deletions

View File

@@ -7669,10 +7669,17 @@ static __always_inline bool mdbx_txn_dbi_exists(MDBX_txn *txn, MDBX_dbi dbi,
}
int mdbx_txn_commit(MDBX_txn *txn) {
int rc = check_txn(txn, MDBX_TXN_BLOCKED - MDBX_TXN_HAS_CHILD);
STATIC_ASSERT(MDBX_TXN_FINISHED ==
MDBX_TXN_BLOCKED - MDBX_TXN_HAS_CHILD - MDBX_TXN_ERROR);
int rc = check_txn(txn, MDBX_TXN_FINISHED);
if (unlikely(rc != MDBX_SUCCESS))
return rc;
if (unlikely(txn->mt_flags & MDBX_TXN_ERROR)) {
rc = MDBX_RESULT_TRUE;
goto fail;
}
MDBX_env *env = txn->mt_env;
#if MDBX_TXN_CHECKPID
if (unlikely(env->me_pid != mdbx_getpid())) {