From 8f3178f2f2709d4b133e900866ae808d8b2cc992 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Tue, 10 Jan 2023 13:20:01 +0700 Subject: [PATCH] Revert "mdbx: proper atomic close (#827)" This reverts commit 493ae8b08363c35bb04baf72a7bd0004047435d5. --- kv/mdbx/kv_mdbx.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kv/mdbx/kv_mdbx.go b/kv/mdbx/kv_mdbx.go index e83680c29..6eb493aa5 100644 --- a/kv/mdbx/kv_mdbx.go +++ b/kv/mdbx/kv_mdbx.go @@ -431,9 +431,10 @@ func (db *MdbxKV) openDBIs(buckets []string) error { // Close closes db // All transactions must be closed before closing the database. func (db *MdbxKV) Close() { - if db.closed.CompareAndSwap(false, true) { + if db.closed.Load() { return } + db.closed.Store(true) db.wg.Wait() db.env.Close() db.env = nil