mirror of
https://github.com/monero-project/monero.git
synced 2025-01-05 10:29:34 +00:00
Merge pull request #9290
d64a5f7
Fix lmdb txn commit code (Lee *!* Clagett)
This commit is contained in:
commit
6796e99438
2 changed files with 9 additions and 5 deletions
|
@ -179,9 +179,10 @@ namespace lmdb
|
||||||
expect<void> database::commit(write_txn txn) noexcept
|
expect<void> database::commit(write_txn txn) noexcept
|
||||||
{
|
{
|
||||||
MONERO_PRECOND(txn != nullptr);
|
MONERO_PRECOND(txn != nullptr);
|
||||||
MONERO_LMDB_CHECK(mdb_txn_commit(txn.get()));
|
const int err = mdb_txn_commit(txn.release());
|
||||||
txn.release();
|
|
||||||
release_context(ctx);
|
release_context(ctx);
|
||||||
|
if (err)
|
||||||
|
return {lmdb::error(err)};
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
} // lmdb
|
} // lmdb
|
||||||
|
|
|
@ -123,10 +123,13 @@ namespace lmdb
|
||||||
const auto wrote = f(*(*txn));
|
const auto wrote = f(*(*txn));
|
||||||
if (wrote)
|
if (wrote)
|
||||||
{
|
{
|
||||||
MONERO_CHECK(commit(std::move(*txn)));
|
const auto committed = commit(std::move(*txn));
|
||||||
return wrote;
|
if (committed)
|
||||||
|
return wrote;
|
||||||
|
if (committed != lmdb::error(MDB_MAP_FULL))
|
||||||
|
return committed.error();
|
||||||
}
|
}
|
||||||
if (wrote != lmdb::error(MDB_MAP_FULL))
|
else if (wrote != lmdb::error(MDB_MAP_FULL))
|
||||||
return wrote;
|
return wrote;
|
||||||
|
|
||||||
txn->reset();
|
txn->reset();
|
||||||
|
|
Loading…
Reference in a new issue