mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
wal : wal.Verify defer close the opened WAL files
wal.Verify() : The opened WAL files are not closed in error cases. Fixed by adding a defer.
This commit is contained in:
parent
fb41ebea52
commit
adbae79565
@ -554,6 +554,11 @@ func Verify(lg *zap.Logger, walDir string, snap walpb.Snapshot) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if closer != nil {
|
||||||
|
closer()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
// create a new decoder from the readers on the WAL files
|
// create a new decoder from the readers on the WAL files
|
||||||
decoder := newDecoder(rs...)
|
decoder := newDecoder(rs...)
|
||||||
@ -591,10 +596,6 @@ func Verify(lg *zap.Logger, walDir string, snap walpb.Snapshot) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if closer != nil {
|
|
||||||
closer()
|
|
||||||
}
|
|
||||||
|
|
||||||
// We do not have to read out all the WAL entries
|
// We do not have to read out all the WAL entries
|
||||||
// as the decoder is opened in read mode.
|
// as the decoder is opened in read mode.
|
||||||
if err != io.EOF && err != io.ErrUnexpectedEOF {
|
if err != io.EOF && err != io.ErrUnexpectedEOF {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user