Skip to content

Conversation

@yeya24
Copy link
Contributor

@yeya24 yeya24 commented Jun 4, 2025

What this PR does:

This PR allows override block store to query in parquet queryable via HTTP header X-Cortex-BlockStore-Type. It can be set to either tsdb or parquet. If tsdb, it forces to query store gateway (TSDB). If parquet, it forces to query parquet blocks if possible + tsdb blocks if missing.

This can be useful for rollout and it can be enabled per request basis to test parquet storage. Note that this is block store switch is only available for Instant and Range query API as we have our own query handlers there. It is not available for labels API today.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: yeya24 <[email protected]>
Copy link
Contributor

@harry671003 harry671003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the switching logic be for switching between ParquetQueryable or BlockStoreQueryable?

Maybe we need to wrap both queryables into another queryable which will do the switch between both.

func (q *queryable) Select(ctx) {
  blockStoreType := getBlockStoreType(ctx, q.defaultBlockStoreType)
  switch blockStoreType {
    case parquet:
      return q.parquetQueryable.Select(ctx)
    case block:
      return q.blockStoreQueryable.Select(cts)
  }
}

@yeya24
Copy link
Contributor Author

yeya24 commented Jun 5, 2025

Should the switching logic be for switching between ParquetQueryable or BlockStoreQueryable? Maybe we need to wrap both queryables into another queryable which will do the switch between both.

The existing parquet queryable is already a wrapper parquetQueryableWithFallback. It already has this selection logic and it basically wraps BlockStoreQueryable and actual parquet queryable from the upstream package https://github.com/prometheus-community/parquet-common/blob/main/search/parquet_queriable.go#L67.

And we cannot simply just fallback to q.parquetQueryable.Select(ctx) fully as we need to query any missing blocks in the time range from Store Gateway, for the scenario in case blocks are still converting to Parquet.

Copy link
Member

@alanprot alanprot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.. LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 5, 2025
@yeya24 yeya24 merged commit f509f08 into cortexproject:master Jun 6, 2025
16 of 17 checks passed
@yeya24 yeya24 deleted the allow-pick-block-store-queryable branch June 6, 2025 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/querier lgtm This PR has been approved by a maintainer size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants