From 2f74f405ae092b8b8cb9c8122282364f388fcfab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Wed, 12 May 2021 00:22:50 +0300 Subject: [PATCH] mdbx: avoid returning `MDBX_TXN_FULL` error when possible. --- src/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core.c b/src/core.c index c1fadc4e..7bc15894 100644 --- a/src/core.c +++ b/src/core.c @@ -5201,7 +5201,7 @@ static int mdbx_txn_spill(MDBX_txn *const txn, MDBX_cursor *const m0, "by a cursor(s), use fewer cursors or increase " "MDBX_opt_txn_dp_limit", unspillable); - return MDBX_TXN_FULL; + goto done; } /* Подзадача: Вытолкнуть часть страниц на диск в соответствии с LRU, @@ -5362,7 +5362,9 @@ static int mdbx_txn_spill(MDBX_txn *const txn, MDBX_cursor *const m0, mdbx_ensure(txn->mt_env, txn->tw.loose_count + txn->tw.dirtyroom > need / 2); #endif /* xMDBX_DEBUG_SPILLING */ - return likely(txn->tw.loose_count + txn->tw.dirtyroom > need / 2) +done: + return likely(txn->tw.dirtyroom + txn->tw.loose_count > + ((need > CURSOR_STACK) ? CURSOR_STACK : need)) ? MDBX_SUCCESS : MDBX_TXN_FULL; }