From 284cc1bc82d69ac2cd90f3e34c35104e07eafb65 Mon Sep 17 00:00:00 2001 From: yihuang Date: Sat, 18 Feb 2023 01:05:40 +0800 Subject: [PATCH] fix: create snapshot dir for rocksdb backend (#15054) (cherry picked from commit 497dc2cb78bb8df597fd63555f97b2f98cc7f2d0) --- server/util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/util.go b/server/util.go index 1834da6c3384..2d9d02eb6834 100644 --- a/server/util.go +++ b/server/util.go @@ -431,6 +431,10 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) { } snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots") + 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)