Skip to content

Store-gateway: Handle index read error properly #2959

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions pkg/storegateway/bucket_index_metadata_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ func (f *BucketIndexMetadataFetcher) Fetch(ctx context.Context) (metas map[ulid.

return f.fallbackFetch(ctx)
}
if err != nil {
f.metrics.Synced.WithLabelValues(block.FailedMeta).Set(1)
f.metrics.Submit()

return nil, nil, errors.Wrapf(err, "read bucket index")
}

// check if index is older than 1 hour, fallback to metafetcher
if time.Unix(idx.UpdatedAt, 0).Before(start.Add(-1 * time.Hour)) {
Expand All @@ -123,13 +129,6 @@ func (f *BucketIndexMetadataFetcher) Fetch(ctx context.Context) (metas map[ulid.
}()
f.metrics.Syncs.Inc()

if err != nil {
f.metrics.Synced.WithLabelValues(block.FailedMeta).Set(1)
f.metrics.Submit()

return nil, nil, errors.Wrapf(err, "read bucket index")
}

// Build block metas out of the index.
metas = make(map[ulid.ULID]*block.Meta, len(idx.Blocks))
for _, b := range idx.Blocks {
Expand Down