From 0b5cdee6eff3a1147b21eee411c193437f6a624a 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: Fri, 1 Jul 2022 11:37:13 +0300 Subject: [PATCH] mdbx: fix `mdbx_env_compact()` hand when DB is corrupted or the volume of an output pages aliquot to `MDBX_ENVCOPY_WRITEBUF`. --- src/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index fd367c86..826b0d72 100644 --- a/src/core.c +++ b/src/core.c @@ -19557,7 +19557,8 @@ __cold static int mdbx_env_compact(MDBX_env *env, MDBX_txn *read_txn, } if (rc == MDBX_SUCCESS) rc = mdbx_env_cwalk(&ctx, &root, 0); - mdbx_env_cthr_toggle(&ctx); + if (ctx.mc_wlen[ctx.mc_head & 1]) + mdbx_env_cthr_toggle(&ctx); mdbx_env_cthr_toggle(&ctx); thread_err = mdbx_thread_join(thread); mdbx_assert(env, (ctx.mc_tail == ctx.mc_head &&