Skip to content

Commit

Permalink
log remove err
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Jul 12, 2023
1 parent db6a863 commit 58e6a5e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions memiavl/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 58e6a5e

Please sign in to comment.