decoder.go (etcd-3.5.6) | : | decoder.go (etcd-3.5.7) | ||
---|---|---|---|---|
skipping to change at line 87 | skipping to change at line 87 | |||
return d.decodeRecord(rec) | return d.decodeRecord(rec) | |||
} | } | |||
if err != nil { | if err != nil { | |||
return err | return err | |||
} | } | |||
recBytes, padBytes := decodeFrameSize(l) | recBytes, padBytes := decodeFrameSize(l) | |||
// The length of current WAL entry must be less than the remaining file s ize. | // The length of current WAL entry must be less than the remaining file s ize. | |||
maxEntryLimit := fileBufReader.FileInfo().Size() - d.lastValidOff - padBy tes | maxEntryLimit := fileBufReader.FileInfo().Size() - d.lastValidOff - padBy tes | |||
if recBytes > maxEntryLimit { | if recBytes > maxEntryLimit { | |||
return fmt.Errorf("wal: max entry size limit exceeded, recBytes: | return fmt.Errorf("%w: [wal] max entry size limit exceeded when d | |||
%d, fileSize(%d) - offset(%d) - padBytes(%d) = entryLimit(%d)", | ecoding %q, recBytes: %d, fileSize(%d) - offset(%d) - padBytes(%d) = entryLimit( | |||
recBytes, fileBufReader.FileInfo().Size(), d.lastValidOff | %d)", | |||
, padBytes, maxEntryLimit) | io.ErrUnexpectedEOF, fileBufReader.FileInfo().Name(), rec | |||
Bytes, fileBufReader.FileInfo().Size(), d.lastValidOff, padBytes, maxEntryLimit) | ||||
} | } | |||
data := make([]byte, recBytes+padBytes) | data := make([]byte, recBytes+padBytes) | |||
if _, err = io.ReadFull(fileBufReader, data); err != nil { | if _, err = io.ReadFull(fileBufReader, data); err != nil { | |||
// ReadFull returns io.EOF only if no bytes were read | // ReadFull returns io.EOF only if no bytes were read | |||
// the decoder should treat this as an ErrUnexpectedEOF instead. | // the decoder should treat this as an ErrUnexpectedEOF instead. | |||
if err == io.EOF { | if err == io.EOF { | |||
err = io.ErrUnexpectedEOF | err = io.ErrUnexpectedEOF | |||
} | } | |||
return err | return err | |||
End of changes. 1 change blocks. | ||||
4 lines changed or deleted | 5 lines changed or added |