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
1 changed files with 23 additions and 19 deletions

View File

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