From 99af6c45924f1fb2749b861ddfe5439da5b0c5db Mon Sep 17 00:00:00 2001 From: Alex Sharov <AskAlexSharov@gmail.com> Date: Fri, 30 Oct 2020 19:25:30 +0700 Subject: [PATCH] mdbx_exclusive_open_for_migrations (#1326) --- node/node.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/node/node.go b/node/node.go index 73c41e19bc..956af6b5ec 100644 --- a/node/node.go +++ b/node/node.go @@ -565,9 +565,18 @@ func (n *Node) ApplyMigrations(name string, tmpdir string) error { if err != nil { return err } - kv, err := ethdb.NewLMDB().Path(dbPath).MapSize(n.config.LMDBMapSize).MaxFreelistReuse(n.config.LMDBMaxFreelistReuse).Exclusive().Open() - if err != nil { - return fmt.Errorf("failed to open kv inside stack.ApplyMigrations: %w", err) + var kv ethdb.KV + + if n.config.MDBX { + kv, err = ethdb.NewMDBX().Path(dbPath).Exclusive().Open() + if err != nil { + return fmt.Errorf("failed to open kv inside stack.ApplyMigrations: %w", err) + } + } else { + kv, err = ethdb.NewLMDB().Path(dbPath).MapSize(n.config.LMDBMapSize).MaxFreelistReuse(n.config.LMDBMaxFreelistReuse).Exclusive().Open() + if err != nil { + return fmt.Errorf("failed to open kv inside stack.ApplyMigrations: %w", err) + } } defer kv.Close() -- GitLab