mdbx-testing: повтор сценария с mdbx_txn_copy2pathname() до получения успешной копии для предотвращения сбоев test/CMakeLists.txt.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2024-08-02 23:24:17 +03:00
parent 69f85af242
commit ee8c9225d6

View File

@ -28,25 +28,29 @@ void testcase_copy::copy_db(const bool with_compaction) {
: "mdbx_env_copy(MDBX_CP_ASIS)", : "mdbx_env_copy(MDBX_CP_ASIS)",
err); err);
} else { } else {
const bool ro = mode_readonly() || flipcoin(); do {
const bool throttle = ro && flipcoin(); const bool ro = mode_readonly() || flipcoin();
const bool dynsize = flipcoin(); const bool throttle = ro && flipcoin();
const bool flush = flipcoin(); const bool dynsize = flipcoin();
const bool enable_renew = flipcoin(); const bool flush = flipcoin();
const MDBX_copy_flags_t flags = const bool enable_renew = flipcoin();
(with_compaction ? MDBX_CP_COMPACT : MDBX_CP_DEFAULTS) | const MDBX_copy_flags_t flags =
(dynsize ? MDBX_CP_FORCE_DYNAMIC_SIZE : MDBX_CP_DEFAULTS) | (with_compaction ? MDBX_CP_COMPACT : MDBX_CP_DEFAULTS) |
(throttle ? MDBX_CP_THROTTLE_MVCC : MDBX_CP_DEFAULTS) | (dynsize ? MDBX_CP_FORCE_DYNAMIC_SIZE : MDBX_CP_DEFAULTS) |
(flush ? MDBX_CP_DEFAULTS : MDBX_CP_DONT_FLUSH) | (throttle ? MDBX_CP_THROTTLE_MVCC : MDBX_CP_DEFAULTS) |
(enable_renew ? MDBX_CP_RENEW_TXN : MDBX_CP_DEFAULTS); (flush ? MDBX_CP_DEFAULTS : MDBX_CP_DONT_FLUSH) |
txn_begin(ro); (enable_renew ? MDBX_CP_RENEW_TXN : MDBX_CP_DEFAULTS);
err = mdbx_txn_copy2pathname(txn_guard.get(), copy_pathname.c_str(), flags); txn_begin(ro);
if (unlikely(err != MDBX_SUCCESS && (!throttle || err != MDBX_OUSTED) && err =
(!enable_renew && err != MDBX_MVCC_RETARDED))) mdbx_txn_copy2pathname(txn_guard.get(), copy_pathname.c_str(), flags);
failure_perror(with_compaction ? "mdbx_txn_copy2pathname(MDBX_CP_COMPACT)" if (unlikely(err != MDBX_SUCCESS && (!throttle || err != MDBX_OUSTED) &&
: "mdbx_txn_copy2pathname(MDBX_CP_ASIS)", (!enable_renew && err != MDBX_MVCC_RETARDED)))
err); failure_perror(with_compaction
txn_end(err != MDBX_SUCCESS || flipcoin()); ? "mdbx_txn_copy2pathname(MDBX_CP_COMPACT)"
: "mdbx_txn_copy2pathname(MDBX_CP_ASIS)",
err);
txn_end(err != MDBX_SUCCESS || flipcoin());
} while (err != MDBX_SUCCESS);
} }
} }