Skip to content

Commit

Permalink
More careful about not doing anything but forward iteration while fre…
Browse files Browse the repository at this point in the history
…elist entries are being deleted
  • Loading branch information
kriszyp committed Apr 26, 2024
1 parent 70368e4 commit 632ffa0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dependencies/lmdb/libraries/liblmdb/mdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2856,6 +2856,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp)
load_more:
if (op == MDB_SET_RANGE) { /* 1st iteration */
/* Prepare to fetch more and coalesce */
if (env->me_freelist_state & MDB_FREELIST_DELETING) break;
oldest = env->me_pgoldest;
mdb_cursor_init(&m2, txn, FREE_DBI, NULL);
#if (MDB_DEVEL) & 2 /* "& 2" so MDB_DEVEL=1 won't hide bugs breaking freeDB */
Expand Down Expand Up @@ -2926,6 +2927,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp)
if (last >= oldest || rc == MDB_NOTFOUND) {
if (!rc) env->me_freelist_end = oldest;
// no more newer transactions, go to the beginning of the range and look for older txns
if (env->me_freelist_state & MDB_FREELIST_DELETING) break;
op = MDB_SET_RANGE;
if (env->me_freelist_start <= 1) break; // should be no zero entry, break out
last = env->me_freelist_start - 1;
Expand Down

0 comments on commit 632ffa0

Please sign in to comment.