-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Overview
Make the query stats sampling server parameters overridable per-query via query settings (queryKnobs):
- internalQueryStatsSampleRate - sampling-based rate limiting for reads
- internalQueryStatsWriteCmdSampleRate - sampling-based rate limiting for write commands
Background
SPM-4364 added support for overriding query knobs via (P)QS, and SERVER-123044 allows passing querySettings directly as part of command invocation. Query knob exposure is opt-in, not opt-out: each knob requires a query_knob IDL annotation (pqs_settable: true, FCV-gated) and a QueryKnob cpp instance - roughly 5-10 LoC per knob per the SPM-4364 design.
The two knobs above are defined in src/mongo/db/query/query_integration_knobs.idl but are not yet settable via (P)QS.
Motivation
- Testing: allows $queryStats tests to pass these knobs per-command instead of setting cluster-wide server parameters via setParameter, enabling passthrough suite runs and removing custom ReplSetTest setups (e.g. startSet(getQueryStatsServerParameters())). Test migration is tracked as a follow-up ticket.
- Customers: allows users to ensure specific query shapes are always captured in query stats, regardless of cluster-wide sampling defaults.
Scope
- In scope: the two sampling knobs listed above.
- Out of scope: internalQueryStatsRateLimit - it is a node-global window-based throttle backed by shared state in a single RateLimiter (see src/mongo/db/query/query_stats/rate_limiting.h), so it is not applicable per query shape. Per-query internalQueryStatsSampleRate overrides take precedence over window-based limiting anyway.
- Out of scope: internalQueryStatsCacheSize - it is store-level configuration and not applicable per query shape.
Acceptance Criteria
- internalQueryStatsSampleRate and internalQueryStatsWriteCmdSampleRate can be overridden via querySettings.queryKnobs on command invocation and via PQS.
- Overrides are FCV-gated consistently with the query knob framework.
- Unit tests and/or jstests cover the new overrides.
- blocks
-
SERVER-134548 Move $queryStats tests from noPassthrough to passthrough suites using per-command queryKnobs
-
- Backlog
-
- is related to
-
SERVER-123044 Allow users to specify QuerySettings directly to the command
-
- Closed
-