ExportXMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • DB Integration & Observability
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Overview

      Expose internalQueryStatsWriteCmdSampleRate as a settable query knob (query_sets. the samplings), following the read-side work in SERVER-134528. That ticket intentionally deferred the write-side override because write commands are not yet query-settings-eligible.

      Background

      registerRequest (reads) now honors a per-query queryStatsSampleRate override via querySettings.queryKnobs (SERVER-134528). The write-command sampling rate (internalQueryStatsWriteCmdSampleRate) is a twin knob, but write command dispatch is not query-settings-eligible today:* QuerySettingsCommandHooks::onBeforeRun only sets the operation's query-settings state to Pending when the command's supportsQuerySettings() returns true, which currently holds only for aggregate, distinct, and find (see query_settings_command_hooks.cpp and the supportsQuerySettings() overrides in those command classes).

      • For insert/update/delete/findAndModify the state stays NotStarted, so tryOverrideQueryKnobValues never installs overrides.

      As a result, registering internalQueryStatsWriteCmdSampleRate as a PQS-settable knob today would validate and persist at the setQuerySettings level but have no runtime effect — a silent no-op footgun. Hence the write knob is intentionally not registered in the integration query-knob group until this lands.

      Scope

      • Make write commands (insert, update, delete, findAndModify) query-settings-eligible: set Pending in the command hooks (the unwrapping logic already reaches inner invocations), and invoke QuerySettingsService::initializeSettingsForQuery for write-command execution so the state resolves to QuerySettings/Empty.
      • Surface querySettingsFromOriginalCommand (SERVER-123044) on the write paths that consume it.
      • Add the internalQueryStatsWriteCmdSampleRate row to MONGO_EXPAND_QUERY_KNOBS_INTEGRATION in query_knob_descriptors_integration.h and add its query_knob IDL annotation (wire_name: queryStatsWriteCmdSampleRate, pqs_settable: true).
      • Thread the override into query_stats::registerWriteRequest mirroring the read-side getQueryStatsSamplingOverride logic.

      Acceptance Criteria

      • internalQueryStatsWriteCmdSampleRate can be overridden per-query via querySettings.queryKnobs both on command invocation and via PQS, with the override taking precedence over the cluster-wide write-command rate limiter.
      • Unit tests and a jstest cover the write-command override (mirroring query_stats_sampling_rate_query_knob.js).

      Related

      • Parent: SERVER-134528
      • Related: SPM-4364 (query knobs), SERVER-123044 (querySettings on command), SERVER-134548 (test migration off noPassthrough)

            Assignee:
            Unassigned
            Reporter:
            Finley Lau
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: