From cea29fe485c05183f3f775f3dc4da9d7ddb87528 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sat, 19 Dec 2020 20:16:45 +0300 Subject: [PATCH] mdbx: fix assertion inside `mdbx_page_retire()`. Change-Id: I5d8f92b9fde1c961252757ea508403b5f51e7646 --- src/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core.c b/src/core.c index 540c8ad0..f6e07982 100644 --- a/src/core.c +++ b/src/core.c @@ -4188,8 +4188,13 @@ static int mdbx_page_retire(MDBX_cursor *mc, MDBX_page *mp) { const unsigned i = mdbx_pnl_exist(txn->tw.spill_pages, pgno << 1); if (i) { /* This page is no longer spilled */ +#if MDBX_PNL_ASCENDING mdbx_tassert(txn, i == MDBX_PNL_SIZE(txn->tw.spill_pages) || txn->tw.spill_pages[i + 1] >= (pgno + npages) << 1); +#else + mdbx_tassert(txn, i == 1 || txn->tw.spill_pages[i - 1] >= (pgno + npages) + << 1); +#endif txn->tw.spill_pages[i] |= 1; if (i == MDBX_PNL_SIZE(txn->tw.spill_pages)) MDBX_PNL_SIZE(txn->tw.spill_pages) -= 1;