Merge pull request #11117 from vimalk78/wal-fixes

wal : wal.Verify defer close the opened WAL files
release-3.5
Xiang Li 2019-09-04 23:25:29 -07:00 committed by GitHub
commit cbfaecdb85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -554,6 +554,11 @@ func Verify(lg *zap.Logger, walDir string, snap walpb.Snapshot) error {
if err != nil {
return err
}
defer func() {
if closer != nil {
closer()
}
}()
// create a new decoder from the readers on the WAL files
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
// as the decoder is opened in read mode.
if err != io.EOF && err != io.ErrUnexpectedEOF {