mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #16120 from Tachone/shitao.lst/fix_db_close
etcdutl: fix db double closed
This commit is contained in:
commit
4364e7581b
@ -422,13 +422,8 @@ func (s *v3Manager) copyAndVerifyDB() error {
|
||||
if dberr != nil {
|
||||
return dberr
|
||||
}
|
||||
dbClosed := false
|
||||
defer func() {
|
||||
if !dbClosed {
|
||||
db.Close()
|
||||
dbClosed = true
|
||||
}
|
||||
}()
|
||||
defer db.Close()
|
||||
|
||||
if _, err := io.Copy(db, srcf); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -465,7 +460,7 @@ func (s *v3Manager) copyAndVerifyDB() error {
|
||||
}
|
||||
|
||||
// db hash is OK, can now modify DB so it can be part of a new cluster
|
||||
db.Close()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user