Temporary workaround for msgp skipping (#10960)

Due to https://github.com/philhofer/fwd/issues/20 when skipping a metadata entry that is >2048 bytes and the buffer is full (2048 bytes) the skip will fail with `io.ErrNoProgress`.

Enlarge the buffer so we temporarily make this much more unlikely.

If it still happens we will have to rewrite the skips to reads.

Fixes #10959
master
Klaus Post 4 years ago committed by GitHub
parent 6990de9c94
commit a58b7874ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      cmd/metacache-stream.go

@ -247,7 +247,9 @@ type metacacheReader struct {
func newMetacacheReader(r io.Reader) (*metacacheReader, error) {
dec := s2DecPool.Get().(*s2.Reader)
dec.Reset(r)
mr := msgp.NewReader(dec)
// TODO: Go back to default size when this fix is available:
// https://github.com/philhofer/fwd/issues/20
mr := msgp.NewReaderSize(dec, 64<<10)
m := metacacheReader{
mr: mr,
closer: func() {
@ -429,8 +431,8 @@ func (r *metacacheReader) forwardTo(s string) error {
}
if string(tmp) >= s {
r.current.name = string(tmp)
r.current.metadata, err = r.mr.ReadBytes(nil)
return err
r.current.metadata, r.err = r.mr.ReadBytes(nil)
return r.err
}
// Skip metadata
err = r.mr.Skip()

Loading…
Cancel
Save