Repository navigation
Query Frontend: apply default_priority to metadata queries - #7942
arpitjain099 wants to merge 1 commit into
Conversation
| * [BUGFIX] Compactor: Delete block deletion markers left in the global `markers/` location of a tenant after the block they refer to was removed. They were skipped at every bucket index update and kept the tenant location in the bucket forever. #7890 | ||
| * [BUGFIX] Ring: Fix an instance becoming permanently unable to acquire tokens. #7901 | ||
| * [BUGFIX] Ingester: Stop `QueryStream` from reading the TSDB index after the request is canceled or times out. The series loop noticed cancellation only when it sent a batch, so a query shard whose series all failed the shard matcher, or the lazy matchers of `-ingester.enable-matcher-optimization`, kept decoding every series in its postings after the querier had given up. The loop now checks the request context every 128 series and returns the context error. #7931 | ||
| * [BUGFIX] Query Frontend: Apply the tenant's `default_priority` to metadata queries. `/api/v1/labels`, `/api/v1/series` and `/api/v1/label/<name>/values` were left with no priority assigned when none of the configured query attributes matched, so the frontend and the scheduler both queued them at a hardcoded 0 instead of the configured default, the `priority` label of `cortex_query_scheduler_queue_length` reported 0 for them, and the query log omitted the field. A metadata query that does match an attribute now takes the first matching priority rather than the last. #7942 |
There was a problem hiding this comment.
The enqueue message doesn't carry priority, so the scheduler still sees 0. Can we pass it through or narrow this entry to the frontend?
There was a problem hiding this comment.
Good catch, @sandy2008. You're right that the enqueue message carries no priority, so the scheduler still sees 0. I've narrowed the changelog entry to the query-frontend's own queue, which is where the fix actually applies, and rebased onto master to clear the conflict. If it helps, could I please open a separate issue to track the scheduler side?
There was a problem hiding this comment.
If it helps, could I please open a separate issue to track the scheduler side?
@arpitjain099 No need, #7949 already tracks it.
74086e6 to
f079375
Compare
f079375 to
6472811
Compare
sandy2008
left a comment
There was a problem hiding this comment.
The narrowed CHANGELOG entry matches the code now. LGTM once the CHANGELOG conflict with master is resolved.
The metadata branch of rejectQueryOrSetPriority never fell back to the tenant's default priority, so /api/v1/labels, /series and /label/*/values were enqueued at a hardcoded 0. Its break also left only the inner loop, so the last matching priority won where the expression branch takes the first. Co-Authored-By: Claude <[email protected]> Signed-off-by: Arpit Jain <[email protected]>
6472811 to
739cc54
Compare
|
@sandy2008 Thanks for the #7949 pointer. The CHANGELOG conflict is resolved and pushed, the entry moved to the end of the BUGFIX list under master / unreleased, and both code files are unchanged from what you approved. Could you please take another look? |
What this PR does:
rejectQueryOrSetPrioritysplits on operation. The expression branch takes the first matching priority and then falls back toqueryPriority.DefaultPriority. The metadata branch does neither: there is no fallback after the loop, and itsbreakleaves only the inner loop, so a later matching priority overwrites an earlier one.SetPriorityis what flipsPriorityAssigned, and bothschedulerRequest.Priority()andrequest.Priority()return a hardcoded 0 whenLoadPriorityreports false. So/api/v1/labels,/api/v1/seriesand/api/v1/label/<name>/valuesare enqueued at 0 rather than at the tenant'sdefault_priority. Withdefault_priority: -1and apriority: 0class holdingreserved_queriers, they land in the reserved class. Theprioritylabel ofcortex_query_scheduler_queue_lengthreports 0 for them as well, and the query log drops the field.#7128 extended query priority to operations beyond
queryandquery_range, and the default fallback did not come across with it. This mirrors the expression branch:return nilon a match,SetPriority(DefaultPriority)after the loop. The branch also covers/api/v1/metadataand any other non-query path, so those pick up the default too.Testing:
Test_rejectQueryOrSetPriorityShouldSetDefaultPriorityWhenNoAttributeMatchesconfigures a singlequery_rangepriority that none of its four probes match, and asserts each one receivesdefault_priority: 5. The three metadata cases fail on master withactual: 0. The instant-query case passes either way and is there as a control. The package goes from 166 passing with 4 failures to 170 passing, andtripperware,schedulerandfrontendare green with the change, built withnetgo slicelabels.Which issue(s) this PR fixes:
N/A
Checklist
CHANGELOG.mdupdateddocs/configuration/v1-guarantees.mdupdated if this PR introduces experimental flags (no new flags)Prepared with the assistance of generative AI, reviewed and tested by me.