Skip to content

Commit

Permalink
Allow WAL to have invalid row (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne authored Nov 1, 2021
1 parent 9dadfcd commit f3d4970
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion disk_wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,13 @@ func (f *diskWALReader) readAll() error {
if err := segment.close(); err != nil {
return err
}
if segment.error() != nil {

err = segment.error()
if errors.Is(err, io.ErrUnexpectedEOF) {
// It is not unusual for a line to be invalid, as it may well terminate in the middle of writing to the WAL.
return nil
}
if err != nil {
return fmt.Errorf("encounter an error while reading WAL segment file %q: %w", file.Name(), segment.error())
}
}
Expand Down

0 comments on commit f3d4970

Please sign in to comment.