mdbx: логирование и возврат MDBX_INCOMPATIBLE при попытке запуска вложенных транзакций в режиме MDBX_WRITEMAP (backport).

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2025-02-27 22:02:49 +03:00
parent a5c5e77c03
commit 4447793652

View File

@ -9302,8 +9302,13 @@ int mdbx_txn_begin_ex(MDBX_env *env, MDBX_txn *parent, MDBX_txn_flags_t flags,
/* Nested transactions: Max 1 child, write txns only, no writemap */ /* Nested transactions: Max 1 child, write txns only, no writemap */
rc = check_txn_rw(parent, rc = check_txn_rw(parent,
MDBX_TXN_RDONLY | MDBX_WRITEMAP | MDBX_TXN_BLOCKED); MDBX_TXN_RDONLY | MDBX_WRITEMAP | MDBX_TXN_BLOCKED);
if (unlikely(rc != MDBX_SUCCESS)) if (unlikely(rc != MDBX_SUCCESS)) {
if (rc == MDBX_BAD_TXN && (parent->mt_flags & (MDBX_TXN_RDONLY | MDBX_TXN_BLOCKED)) == 0) {
ERROR("%s mode is incompatible with nested transactions", "MDBX_WRITEMAP");
rc = MDBX_INCOMPATIBLE;
}
return rc; return rc;
}
if (env->me_options.spill_parent4child_denominator) { if (env->me_options.spill_parent4child_denominator) {
/* Spill dirty-pages of parent to provide dirtyroom for child txn */ /* Spill dirty-pages of parent to provide dirtyroom for child txn */