mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:44:12 +08:00
mdbx: fix shrinking below a lower-bound.
Change-Id: Ia6d497e2d7c6d7ee646b23b8df944a01d96445fc
This commit is contained in:
parent
86a15f4ef1
commit
dc31d7d1a3
@ -4050,9 +4050,11 @@ static int mdbx_sync_locked(MDBX_env *env, unsigned flags,
|
||||
pending->mm_geo.grow ? pending->mm_geo.grow : pending->mm_geo.shrink;
|
||||
const pgno_t aligned = pgno_align2os_pgno(
|
||||
env, pending->mm_geo.next + aligner - pending->mm_geo.next % aligner);
|
||||
if (pending->mm_geo.now > aligned) {
|
||||
shrink = pending->mm_geo.now - aligned;
|
||||
pending->mm_geo.now = aligned;
|
||||
const pgno_t bottom =
|
||||
(aligned > pending->mm_geo.lower) ? aligned : pending->mm_geo.lower;
|
||||
if (pending->mm_geo.now > bottom) {
|
||||
shrink = pending->mm_geo.now - bottom;
|
||||
pending->mm_geo.now = bottom;
|
||||
if (mdbx_meta_txnid_stable(env, head) == pending->mm_txnid_a)
|
||||
mdbx_meta_set_txnid(env, pending, pending->mm_txnid_a + 1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user