Skip to content

Commit

Permalink
fix: Handle EOF when reading from some obj stores (#13868)
Browse files Browse the repository at this point in the history
  • Loading branch information
benclive authored Aug 14, 2024
1 parent fdea7a1 commit 98a15e2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/querier-rf1/wal/chunks.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package wal

import (
"context"
"errors"
"fmt"
"io"
"sort"

"github.com/prometheus/prometheus/model/labels"
Expand Down Expand Up @@ -309,14 +311,14 @@ func readChunkData(ctx context.Context, storage BlockStorage, chunk ChunkData) (
// together.
reader, err := storage.GetObjectRange(ctx, wal.Dir+chunk.id, int64(offset), int64(size))
if err != nil {
return nil, err
return nil, fmt.Errorf("could not get range reader for %s: %w", chunk.id, err)
}
defer reader.Close()

data := make([]byte, size)
_, err = reader.Read(data)
if err != nil {
return nil, err
if err != nil && !errors.Is(err, io.EOF) {
return nil, fmt.Errorf("could not read socket for %s: %w", chunk.id, err)
}

return data, nil
Expand Down

0 comments on commit 98a15e2

Please sign in to comment.