mdbx: безусловное прерывание транзакции при опции MDBX_CP_DISPOSE_TXN.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2024-11-16 11:11:26 +03:00
parent 47f96b6afa
commit f32d3f260f

View File

@ -838,10 +838,8 @@ __cold static int copy2pathname(MDBX_txn *txn, const pathchar_t *dest_path,
__cold int mdbx_txn_copy2fd(MDBX_txn *txn, mdbx_filehandle_t fd, __cold int mdbx_txn_copy2fd(MDBX_txn *txn, mdbx_filehandle_t fd,
MDBX_copy_flags_t flags) { MDBX_copy_flags_t flags) {
int rc = check_txn(txn, MDBX_TXN_BLOCKED); int rc = check_txn(txn, MDBX_TXN_BLOCKED);
if (unlikely(rc != MDBX_SUCCESS)) if (likely(rc == MDBX_SUCCESS))
return rc; rc = copy2fd(txn, fd, flags);
rc = copy2fd(txn, fd, flags);
if (flags & MDBX_CP_DISPOSE_TXN) if (flags & MDBX_CP_DISPOSE_TXN)
mdbx_txn_abort(txn); mdbx_txn_abort(txn);
return rc; return rc;
@ -882,10 +880,8 @@ __cold int mdbx_txn_copy2pathnameW(MDBX_txn *txn, const wchar_t *dest_path,
MDBX_copy_flags_t flags) { MDBX_copy_flags_t flags) {
#endif /* Windows */ #endif /* Windows */
int rc = check_txn(txn, MDBX_TXN_BLOCKED); int rc = check_txn(txn, MDBX_TXN_BLOCKED);
if (unlikely(rc != MDBX_SUCCESS)) if (likely(rc == MDBX_SUCCESS))
return rc; rc = copy2pathname(txn, dest_path, flags);
rc = copy2pathname(txn, dest_path, flags);
if (flags & MDBX_CP_DISPOSE_TXN) if (flags & MDBX_CP_DISPOSE_TXN)
mdbx_txn_abort(txn); mdbx_txn_abort(txn);
return rc; return rc;