From 4111d7238c8ae184d8272bd730a75923c8eb62ce Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Tue, 27 Apr 2021 22:50:36 +0300 Subject: [PATCH] mdbx: spill pages during prepare backlog for `update_gc()`. Related to https://github.com/erthink/libmdbx/issues/186 Change-Id: I88463a860da0a53420904daf1b1f39e5ca4c97e5 --- src/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index 7ae4f9b8..7016bc00 100644 --- a/src/core.c +++ b/src/core.c @@ -8479,8 +8479,16 @@ static int mdbx_prep_backlog(MDBX_txn *txn, MDBX_cursor *gc_cursor, pnl_bytes, backlog_size(txn), linear4list, backlog4cow, backlog4rebalance); + MDBX_val fake_key, fake_val; + fake_key.iov_base = fake_val.iov_base = nullptr; + fake_key.iov_len = sizeof(txnid_t); + fake_val.iov_len = pnl_bytes; + int err = mdbx_cursor_spill(gc_cursor, &fake_key, &fake_val); + if (unlikely(err != MDBX_SUCCESS)) + return err; + gc_cursor->mc_flags &= ~C_RECLAIMING; - int err = mdbx_cursor_touch(gc_cursor); + err = mdbx_cursor_touch(gc_cursor); mdbx_trace("== after-touch, backlog %u, err %d", backlog_size(txn), err); if (linear4list > 1 && err == MDBX_SUCCESS) {