Merge pull request #16201 from Tachone/release-3.5

[Backport 3.5] etcdutl: fix db double closed
This commit is contained in:
Benjamin Wang 2023-07-10 11:15:05 +01:00 committed by GitHub
commit d4f779a643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -415,13 +415,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
}
@ -458,7 +453,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
}