This repository has been archived by the owner on Sep 22, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mdbx: fix extra-rare
MDBX_KEY_EXIST
during mdbx_commit()
.
The MDX_KEYEXISTS error could occur inside mdbx_update_gc() in the extremely rare case: - no GC records was reclaimed before mdbx_txn_commit() called; - there were few loose pages during the transaction; - some reader prohibit reclaiming, therefore mdbx_page_alloc(MDBX_ALLOC_GC), which called for obtain present GC-record's Id, returns MDBX_NOTFOUND; - immediately then the reader completes its transaction and unlocks reclaiming; - mdbx_update_gc() decide that no reclaimable GC entries, i.e. no GC-entries with ID < find_oldest(), and it is safe to use find_oldest() - 1 to store loose page list; - but find_oldest() actually returns new/larger ID than expected, So KEYEXISTS will returned if using this ID. Change-Id: I9726217d6b5983f1e31a211c0eeb3edc8ff94282
- Loading branch information