mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-19 22:08:20 +08:00
mdbx: оформление опции сборки MDBX_NOSUCCESS_PURE_COMMIT
(выключено по умолчанию).
This commit is contained in:
parent
c60f6afe5f
commit
6d92a778a5
@ -411,7 +411,7 @@ int mdbx_txn_commit_ex(MDBX_txn *txn, MDBX_commit_latency *latency) {
|
||||
if (likely(rc == MDBX_SUCCESS))
|
||||
goto done;
|
||||
if (rc == MDBX_RESULT_TRUE) {
|
||||
#if defined(MDBX_NOSUCCESS_EMPTY_COMMIT) && MDBX_NOSUCCESS_EMPTY_COMMIT
|
||||
#if MDBX_NOSUCCESS_PURE_COMMIT
|
||||
rc = txn_end(txn, end_mode);
|
||||
if (unlikely(rc != MDBX_SUCCESS))
|
||||
goto fail;
|
||||
@ -419,7 +419,7 @@ int mdbx_txn_commit_ex(MDBX_txn *txn, MDBX_commit_latency *latency) {
|
||||
goto provide_latency;
|
||||
#else
|
||||
goto done;
|
||||
#endif /* MDBX_NOSUCCESS_EMPTY_COMMIT */
|
||||
#endif /* MDBX_NOSUCCESS_PURE_COMMIT */
|
||||
}
|
||||
|
||||
fail:
|
||||
|
@ -257,6 +257,14 @@
|
||||
#error MDBX_HAVE_BUILTIN_CPU_SUPPORTS must be defined as 0 or 1
|
||||
#endif /* MDBX_HAVE_BUILTIN_CPU_SUPPORTS */
|
||||
|
||||
/** if enabled then treats the commit of pure (nothing changes) transactions as special
|
||||
* cases and return \ref MDBX_RESULT_TRUE instead of \ref MDBX_SUCCESS. */
|
||||
#ifndef MDBX_NOSUCCESS_PURE_COMMIT
|
||||
#define MDBX_NOSUCCESS_PURE_COMMIT 0
|
||||
#elif !(MDBX_NOSUCCESS_PURE_COMMIT == 0 || MDBX_NOSUCCESS_PURE_COMMIT == 1)
|
||||
#error MDBX_NOSUCCESS_PURE_COMMIT must be defined as 0 or 1
|
||||
#endif /* MDBX_NOSUCCESS_PURE_COMMIT */
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Win32 File Locking API for \ref MDBX_LOCKING */
|
||||
|
@ -1436,7 +1436,7 @@ int txn_basal_commit(MDBX_txn *txn, struct commit_timestamp *ts) {
|
||||
(txn->flags & (MDBX_TXN_DIRTY | MDBX_TXN_SPILLS)) == 0) {
|
||||
TXN_FOREACH_DBI_ALL(txn, i) { tASSERT(txn, !(txn->dbi_state[i] & DBI_DIRTY)); }
|
||||
/* fast completion of pure transaction */
|
||||
return MDBX_RESULT_TRUE;
|
||||
return MDBX_NOSUCCESS_PURE_COMMIT ? MDBX_RESULT_TRUE : MDBX_SUCCESS;
|
||||
}
|
||||
|
||||
DEBUG("committing txn %" PRIaTXN " %p on env %p, root page %" PRIaPGNO "/%" PRIaPGNO, txn->txnid, (void *)txn,
|
||||
|
Loading…
x
Reference in New Issue
Block a user