Skip to content

add parquet labels cache #6835

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 2 commits into from
Jun 30, 2025
Merged

Conversation

yeya24
Copy link
Contributor

@yeya24 yeya24 commented Jun 23, 2025

What this PR does:

Add Parquet Labels file cache using the caching bucket. This allows caching Parquet Labels File GetRange requests to reduce API calls to the object storage.

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]

@yeya24
Copy link
Contributor Author

yeya24 commented Jun 23, 2025

--- FAIL: TestBlocksCleaner_ShouldRemoveBlocksOutsideRetentionPeriod (0.16s)
    blocks_cleaner_test.go:700: 
        	Error Trace:	/__w/cortex/cortex/pkg/compactor/blocks_cleaner_test.go:700
        	            				/__w/cortex/cortex/pkg/compactor/blocks_cleaner_test.go:825
        	Error:      	Not equal: 
        	            	expected: false
        	            	actual  : true
        	Test:       	TestBlocksCleaner_ShouldRemoveBlocksOutsideRetentionPeriod
    blocks_cleaner_test.go:830: 
        	Error Trace:	/__w/cortex/cortex/pkg/compactor/blocks_cleaner_test.go:830
        	Error:      	Received unexpected error:
        	            	 # HELP cortex_bucket_blocks_count Total number of blocks in the bucket. Includes blocks marked for deletion, but not partial blocks.
        	            	 # TYPE cortex_bucket_blocks_count gauge
        	            	-cortex_bucket_blocks_count{user="user-1"} 2
        	            	+cortex_bucket_blocks_count{user="user-1"} 1
        	            	 cortex_bucket_blocks_count{user="user-2"} 2
        	            	 # HELP cortex_bucket_blocks_marked_for_deletion_count Total number of blocks marked for deletion in the bucket.
        	            	 # TYPE cortex_bucket_blocks_marked_for_deletion_count gauge
        	            	 cortex_bucket_blocks_marked_for_deletion_count{user="user-1"} 0
        	            	 cortex_bucket_blocks_marked_for_deletion_count{user="user-2"} 0
        	            	 # HELP cortex_compactor_blocks_marked_for_deletion_total Total number of blocks marked for deletion in compactor.
        	            	 # TYPE cortex_compactor_blocks_marked_for_deletion_total counter
        	            	 cortex_compactor_blocks_marked_for_deletion_total{reason="retention",user="user-1"} 1
        	            	 cortex_compactor_blocks_marked_for_deletion_total{reason="retention",user="user-2"} 0
        	            	 
        	Test:       	TestBlocksCleaner_ShouldRemoveBlocksOutsideRetentionPeriod
    blocks_cleaner_test.go:700: 
        	Error Trace:	/__w/cortex/cortex/pkg/compactor/blocks_cleaner_test.go:700
        	            				/__w/cortex/cortex/pkg/compactor/blocks_cleaner_test.go:862
        	Error:      	Not equal: 
        	            	expected: false
        	            	actual  : true
        	Test:       	TestBlocksCleaner_ShouldRemoveBlocksOutsideRetentionPeriod
    blocks_cleaner_test.go:867: 
        	Error Trace:	/__w/cortex/cortex/pkg/compactor/blocks_cleaner_test.go:867
        	Error:      	Received unexpected error:
        	            	 # HELP cortex_bucket_blocks_count Total number of blocks in the bucket. Includes blocks marked for deletion, but not partial blocks.
        	            	 # TYPE cortex_bucket_blocks_count gauge
        	            	-cortex_bucket_blocks_count{user="user-1"} 2
        	            	+cortex_bucket_blocks_count{user="user-1"} 1
        	            	 cortex_bucket_blocks_count{user="user-2"} 0
        	            	 # HELP cortex_bucket_blocks_marked_for_deletion_count Total number of blocks marked for deletion in the bucket.
        	            	 # TYPE cortex_bucket_blocks_marked_for_deletion_count gauge
        	            	 cortex_bucket_blocks_marked_for_deletion_count{user="user-1"} 0
        	            	 cortex_bucket_blocks_marked_for_deletion_count{user="user-2"} 0
        	            	 # HELP cortex_compactor_blocks_marked_for_deletion_total Total number of blocks marked for deletion in compactor.
        	            	 # TYPE cortex_compactor_blocks_marked_for_deletion_total counter
        	            	 cortex_compactor_blocks_marked_for_deletion_total{reason="retention",user="user-1"} 1
        	            	 cortex_compactor_blocks_marked_for_deletion_total{reason="retention",user="user-2"} 2
        	            	 
        	Test:       	TestBlocksCleaner_ShouldRemoveBlocksOutsideRetentionPeriod
FAIL
FAIL	github.com/cortexproject/cortex/pkg/compactor	78.746s

Flaky test worth taking a closer look

if parquetLabelsCache != nil {
cachingConfigured = true
parquetLabelsCache = cache.NewTracingCache(parquetLabelsCache)
cfg.CacheGetRange("parquet-labels", parquetLabelsCache, matchers.GetParquetLabelsMatcher(), parquetLabelsConfig.SubrangeSize, parquetLabelsConfig.AttributesTTL, parquetLabelsConfig.SubrangeTTL, parquetLabelsConfig.MaxGetRangeRequests)
Copy link
Member

Choose a reason for hiding this comment

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

For both, this and the chunks cache, should we cache also the attributes?

Copy link
Contributor Author

@yeya24 yeya24 Jun 29, 2025

Choose a reason for hiding this comment

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

You can see that AttributesTTL already a config. It is part of the GetRange cache.

Copy link
Member

Choose a reason for hiding this comment

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

Oh nice! missed that! thanks

yeya24 added 2 commits June 30, 2025 09:45
Signed-off-by: yeya24 <[email protected]>
@yeya24 yeya24 force-pushed the parquet-labels-cache branch from 4365ff8 to 870ed1e Compare June 30, 2025 16:45
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 30, 2025
@yeya24 yeya24 merged commit 7435394 into cortexproject:master Jun 30, 2025
31 of 32 checks passed
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.

2 participants