2019-09-09 18:40:24 +08:00
|
|
|
#include "test.h"
|
2017-10-26 08:56:12 +08:00
|
|
|
|
|
|
|
bool testcase_try::run() {
|
|
|
|
db_open();
|
|
|
|
assert(!txn_guard);
|
|
|
|
|
|
|
|
MDBX_txn *txn = nullptr;
|
|
|
|
MDBX_txn *txn2 = nullptr;
|
2017-10-27 01:51:46 +08:00
|
|
|
int rc = mdbx_txn_begin(db_guard.get(), nullptr, 0, &txn);
|
2017-10-26 08:56:12 +08:00
|
|
|
if (unlikely(rc != MDBX_SUCCESS))
|
|
|
|
failure_perror("mdbx_txn_begin(MDBX_TRYTXN)", rc);
|
|
|
|
else {
|
|
|
|
rc = mdbx_txn_begin(db_guard.get(), nullptr, MDBX_TRYTXN, &txn2);
|
|
|
|
if (unlikely(rc != MDBX_BUSY))
|
|
|
|
failure_perror("mdbx_txn_begin(MDBX_TRYTXN)", rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
txn_guard.reset(txn);
|
|
|
|
return true;
|
|
|
|
}
|