-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Handle EOF when reading from some obj stores #13868
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkg/errors
is no longer recommended since errors
was added to stdlib. Otherwise LGTM! 👍
pkg/querier-rf1/wal/chunks.go
Outdated
"sort" | ||
|
||
"github.com/pkg/errors" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"github.com/pkg/errors" | |
"errors" |
pkg/querier-rf1/wal/chunks.go
Outdated
@@ -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, errors.Wrap(err, "could not get range reader for "+chunk.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, errors.Wrap(err, "could not get range reader for "+chunk.id) | |
return nil, fmt.Errorf("could not get range reader for %s: %w", chunk.id, err) |
pkg/querier-rf1/wal/chunks.go
Outdated
} | ||
defer reader.Close() | ||
|
||
data := make([]byte, size) | ||
_, err = reader.Read(data) | ||
if err != nil { | ||
return nil, err | ||
if err != nil && err != io.EOF { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if err != nil && err != io.EOF { | |
if err != nil && !errors.Is(err, io.EOF) { |
pkg/querier-rf1/wal/chunks.go
Outdated
if err != nil { | ||
return nil, err | ||
if err != nil && err != io.EOF { | ||
return nil, errors.Wrap(err, "could not read socket for "+chunk.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, errors.Wrap(err, "could not read socket for "+chunk.id) | |
return nil, fmt.Errorf("could not read socket for %s: %w", chunk.id, err) |
What this PR does / why we need it: