mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
delete old entry only after successful insert
This commit is contained in:
parent
eb2acd11c2
commit
db0c25b3d8
|
@ -104,14 +104,14 @@ func (f *Filer) CreateEntry(entry *Entry) error {
|
|||
}
|
||||
*/
|
||||
|
||||
if oldEntry, err := f.FindEntry(entry.FullPath); err == nil {
|
||||
f.deleteChunks(oldEntry)
|
||||
}
|
||||
oldEntry, _ := f.FindEntry(entry.FullPath)
|
||||
|
||||
if err := f.store.InsertEntry(entry); err != nil {
|
||||
return fmt.Errorf("insert entry %s: %v", entry.FullPath, err)
|
||||
}
|
||||
|
||||
f.deleteChunks(oldEntry)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue