From 58e6a5ef7b18b63b45808ad16ecec264e6d29fa1 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 12 Jul 2023 09:42:32 +0800 Subject: [PATCH] log remove err --- memiavl/db.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/memiavl/db.go b/memiavl/db.go index b788d783d3..e0302c8484 100644 --- a/memiavl/db.go +++ b/memiavl/db.go @@ -206,7 +206,9 @@ func Load(dir string, opts Options) (*DB, error) { snapshotDir := snapshotName(db.lastCommitInfo.Version) tmpDir := snapshotDir + "-tmp" path = filepath.Join(db.dir, tmpDir) - os.Remove(path) + if err := os.Remove(path); err != nil { + db.logger.Error("failed to remove tmp directories", "err", err) + } return db, nil } @@ -469,7 +471,9 @@ func (db *DB) RewriteSnapshot() error { return err } if err := db.MultiTree.WriteSnapshot(path); err != nil { - os.Remove(path) + if err := os.Remove(path); err != nil { + db.logger.Error("failed to remove tmp directories", "err", err) + } return err } if err := os.Rename(path, filepath.Join(db.dir, snapshotDir)); err != nil {