mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:24:12 +08:00
mdbx-test: add cursor_renew()
.
Change-Id: I7d7dac646aba7535391bd7585025e43cdd57d21c
This commit is contained in:
parent
2e3a552c3c
commit
1db0a6fc92
17
test/test.cc
17
test/test.cc
@ -275,22 +275,31 @@ void testcase::cursor_close() {
|
|||||||
log_trace("<< cursor_close()");
|
log_trace("<< cursor_close()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testcase::cursor_renew() {
|
||||||
|
log_trace(">> cursor_renew()");
|
||||||
|
assert(cursor_guard);
|
||||||
|
int err = mdbx_cursor_renew(txn_guard.get(), cursor_guard.get());
|
||||||
|
if (unlikely(err != MDBX_SUCCESS))
|
||||||
|
failure_perror("mdbx_cursor_renew()", err);
|
||||||
|
log_trace("<< cursor_renew()");
|
||||||
|
}
|
||||||
|
|
||||||
int testcase::breakable_restart() {
|
int testcase::breakable_restart() {
|
||||||
int rc = MDBX_SUCCESS;
|
int rc = MDBX_SUCCESS;
|
||||||
if (txn_guard)
|
if (txn_guard)
|
||||||
rc = breakable_commit();
|
rc = breakable_commit();
|
||||||
if (cursor_guard)
|
|
||||||
cursor_close();
|
|
||||||
txn_begin(false, MDBX_TXN_READWRITE);
|
txn_begin(false, MDBX_TXN_READWRITE);
|
||||||
|
if (cursor_guard)
|
||||||
|
cursor_renew();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void testcase::txn_restart(bool abort, bool readonly, MDBX_txn_flags_t flags) {
|
void testcase::txn_restart(bool abort, bool readonly, MDBX_txn_flags_t flags) {
|
||||||
if (txn_guard)
|
if (txn_guard)
|
||||||
txn_end(abort);
|
txn_end(abort);
|
||||||
if (cursor_guard)
|
|
||||||
cursor_close();
|
|
||||||
txn_begin(readonly, flags);
|
txn_begin(readonly, flags);
|
||||||
|
if (cursor_guard)
|
||||||
|
cursor_renew();
|
||||||
}
|
}
|
||||||
|
|
||||||
void testcase::txn_inject_writefault(void) {
|
void testcase::txn_inject_writefault(void) {
|
||||||
|
@ -187,6 +187,7 @@ protected:
|
|||||||
MDBX_txn_flags_t flags = MDBX_TXN_READWRITE);
|
MDBX_txn_flags_t flags = MDBX_TXN_READWRITE);
|
||||||
void cursor_open(MDBX_dbi handle);
|
void cursor_open(MDBX_dbi handle);
|
||||||
void cursor_close();
|
void cursor_close();
|
||||||
|
void cursor_renew();
|
||||||
void txn_inject_writefault(void);
|
void txn_inject_writefault(void);
|
||||||
void txn_inject_writefault(MDBX_txn *txn);
|
void txn_inject_writefault(MDBX_txn *txn);
|
||||||
void fetch_canary();
|
void fetch_canary();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user