diff --git a/pkg/storage/tsdb/bucketindex/loader.go b/pkg/storage/tsdb/bucketindex/loader.go index 89564fd32f..ba17d34f3e 100644 --- a/pkg/storage/tsdb/bucketindex/loader.go +++ b/pkg/storage/tsdb/bucketindex/loader.go @@ -15,6 +15,7 @@ import ( "github.com/cortexproject/cortex/pkg/storage/bucket" "github.com/cortexproject/cortex/pkg/util" + util_log "github.com/cortexproject/cortex/pkg/util/log" "github.com/cortexproject/cortex/pkg/util/services" ) @@ -92,6 +93,11 @@ func NewLoader(cfg LoaderConfig, bucketClient objstore.Bucket, cfgProvider bucke // GetIndex returns the bucket index for the given user. It returns the in-memory cached // index if available, or load it from the bucket otherwise. func (l *Loader) GetIndex(ctx context.Context, userID string) (*Index, Status, error) { + if ctx.Err() != nil { + level.Warn(util_log.WithContext(ctx, l.logger)).Log("msg", "received context error when attempting to load bucket index", "err", ctx.Err()) + return nil, UnknownStatus, ctx.Err() + } + l.indexesMx.RLock() if entry := l.indexes[userID]; entry != nil { idx := entry.index