mirror of
https://github.com/isar/libmdbx.git
synced 2024-10-29 23:19:20 +08:00
mdbx-testing: повтор сценария с mdbx_txn_copy2pathname()
до получения успешной копии для предотвращения сбоев test/CMakeLists.txt
.
This commit is contained in:
parent
69f85af242
commit
ee8c9225d6
@ -28,25 +28,29 @@ void testcase_copy::copy_db(const bool with_compaction) {
|
||||
: "mdbx_env_copy(MDBX_CP_ASIS)",
|
||||
err);
|
||||
} else {
|
||||
const bool ro = mode_readonly() || flipcoin();
|
||||
const bool throttle = ro && flipcoin();
|
||||
const bool dynsize = flipcoin();
|
||||
const bool flush = flipcoin();
|
||||
const bool enable_renew = flipcoin();
|
||||
const MDBX_copy_flags_t flags =
|
||||
(with_compaction ? MDBX_CP_COMPACT : MDBX_CP_DEFAULTS) |
|
||||
(dynsize ? MDBX_CP_FORCE_DYNAMIC_SIZE : MDBX_CP_DEFAULTS) |
|
||||
(throttle ? MDBX_CP_THROTTLE_MVCC : MDBX_CP_DEFAULTS) |
|
||||
(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);
|
||||
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)"
|
||||
: "mdbx_txn_copy2pathname(MDBX_CP_ASIS)",
|
||||
err);
|
||||
txn_end(err != MDBX_SUCCESS || flipcoin());
|
||||
do {
|
||||
const bool ro = mode_readonly() || flipcoin();
|
||||
const bool throttle = ro && flipcoin();
|
||||
const bool dynsize = flipcoin();
|
||||
const bool flush = flipcoin();
|
||||
const bool enable_renew = flipcoin();
|
||||
const MDBX_copy_flags_t flags =
|
||||
(with_compaction ? MDBX_CP_COMPACT : MDBX_CP_DEFAULTS) |
|
||||
(dynsize ? MDBX_CP_FORCE_DYNAMIC_SIZE : MDBX_CP_DEFAULTS) |
|
||||
(throttle ? MDBX_CP_THROTTLE_MVCC : MDBX_CP_DEFAULTS) |
|
||||
(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);
|
||||
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)"
|
||||
: "mdbx_txn_copy2pathname(MDBX_CP_ASIS)",
|
||||
err);
|
||||
txn_end(err != MDBX_SUCCESS || flipcoin());
|
||||
} while (err != MDBX_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user