From e8f34ed7424cf8c7b4c02573c2e57febf99ee922 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Fri, 17 Feb 2023 08:47:06 +0800 Subject: [PATCH 1/2] create snapshot dir for rocksdb backend Closes: #15053 --- server/util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/util.go b/server/util.go index 712eec749276..851c66c9bfdb 100644 --- a/server/util.go +++ b/server/util.go @@ -444,6 +444,10 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) { } snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") + err = os.MkdirAll(snapshotDir, os.ModePerm) + if err != nil { + panic(err) + } snapshotDB, err := dbm.NewDB("metadata", GetAppDBBackend(appOpts), snapshotDir) if err != nil { panic(err) From 96a3b11811377c98d690709d6b8e940fe1552ea1 Mon Sep 17 00:00:00 2001 From: Marko Date: Fri, 17 Feb 2023 07:16:28 -0800 Subject: [PATCH 2/2] Update server/util.go Co-authored-by: Aleksandr Bezobchuk --- server/util.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/util.go b/server/util.go index 851c66c9bfdb..2a70f4b4edec 100644 --- a/server/util.go +++ b/server/util.go @@ -444,10 +444,10 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) { } snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") - err = os.MkdirAll(snapshotDir, os.ModePerm) - if err != nil { - panic(err) + if err = os.MkdirAll(snapshotDir, os.ModePerm); err != nil { + panic(fmt.Errorf("failed to create snapshots directory: %w", err)) } + snapshotDB, err := dbm.NewDB("metadata", GetAppDBBackend(appOpts), snapshotDir) if err != nil { panic(err)