Skip to content

Commit

Permalink
rename the status path after the loading is successful
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijian-pro committed Sep 18, 2024
1 parent 84c3e43 commit 366c508
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/vfs/vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1224,10 +1224,15 @@ func NewVFS(conf *Config, m meta.Meta, store chunk.ChunkStore, registerer promet
if statePath == "" {
statePath = fmt.Sprintf("/tmp/state%d.json", os.Getppid())
}

if err := v.loadAllHandles(statePath); err != nil && !os.IsNotExist(err) {
var err error
if err = v.loadAllHandles(statePath); err != nil && !os.IsNotExist(err) {
logger.Errorf("load state from %s: %s", statePath, err)
}
if err == nil {
if err := os.Rename(statePath, statePath+".done"); err != nil {
logger.Errorf("rename state file %s: %s", statePath, err)
}
}

go v.cleanupModified()
initVFSMetrics(v, writer, reader, registerer)
Expand Down

0 comments on commit 366c508

Please sign in to comment.