mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
wal: remove redundant war tmp dirs if create wal failed (#12388)
If we create 000000000-0000000.war failed in war tmp dir(XXX.tmp) and we should remove the tmp dirs. If create war successfully in tmp dir and it will be renamed to common dir and remove tmp dir(XXX.tmp) will also be ok. Co-authored-by: yangweiwei <yangweiwei@cmss.chinamobile.com>
This commit is contained in:
parent
0b95e8cef1
commit
667ed96957
@ -114,6 +114,8 @@ func Create(lg *zap.Logger, dirpath string, metadata []byte) (*WAL, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
defer os.RemoveAll(tmpdirpath)
|
||||
|
||||
if err := fileutil.CreateDirAll(tmpdirpath); err != nil {
|
||||
lg.Warn(
|
||||
"failed to create a temporary WAL directory",
|
||||
|
Loading…
x
Reference in New Issue
Block a user