Introduce additional logging into change-stream FSM testing

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • QE 2026-08-03
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Overview

      Add logging visibility to change-stream FSM sharding tests so failures are diagnosable directly from a default test.log and its on-failure dump, without needing to add temporary debug instrumentation for each new investigation.

      Background

      Two gaps currently make change-stream FSM sharding test failures slow to diagnose:

      • Command execution info is invisible by default: jsTest.log.debug (used by the existing per-command cmd[N] ... line) is silent unless TestData.logLevel is explicitly set to 4, which most suites don't do. Separately, commands whose arguments are resolved at runtime (MovePrimaryCommand, MoveCollectionCommand, MoveChunkCommand – the target shard is chosen inside execute()) can't have those arguments captured by toString(), which only reflects what's known at construction time.
      • On a matcher mismatch, there is no visibility into the cluster's actual placement history or raw oplog contents for the affected namespaces – both are needed to confirm whether an expected notification was actually written anywhere.

      Measured impact of the logging-volume changes against a 73,708-line test.log from a full FSM run: well under 1% of total log volume (the bulk is unrelated server-side LOGV2 output, gated by a separate, server-side verbosity setting). No measurable effect on log size or test runtime is expected.

      Scope of Work

      • jstests/libs/util/change_stream/change_stream_writer.js – promote the per-command cmd[N] ... line from jsTest.log.debug to jsTest.log.info
      • jstests/libs/util/change_stream/change_stream_commands.js – in MoveCommandBase._doExecute(), log the fully-resolved command object (verbatim, as sent to adminCommand()) at info level, right before dispatch
      • jstests/libs/util/change_stream/change_stream_verifier.js – on a matcher mismatch, dump:
        • config.placementHistory entries for the affected namespaces (dumpPlacementHistory)
        • raw local.oplog.rs noop entries for the affected namespaces, queried directly from every shard (dumpRawOplogForNamespaces)

      Note: the placementHistory/oplog dumps are already implemented locally but not yet committed – landing them is exactly what this ticket covers.

      Acceptance Criteria

      • A default (non-debug) run of any change-stream FSM sharding suite shows, for every command, which command ran against which namespace, and for MovePrimaryCommand/MoveCollectionCommand/MoveChunkCommand, the actual shard(s) targeted
      • On a matcher mismatch, the failure output includes placement history and raw oplog contents for the affected namespaces, generically (not specific to any one event type)
      • No log-level or verbosity flags need to be set to see any of the above

      Non-goals

      • No attempt to derive or reconcile expected change-stream events from raw oplog entries – oplog-to-event is a nontrivial, evolving transformation (change_stream_event_transform.cpp), not a 1:1 mapping, and reimplementing any part of it in the test harness would be fragile
      • No event-type-specific detection logic (e.g. checking specifically for a missing reshardCollection entry) – the oplog dump stays generic; interpretation is left to whoever is debugging

            Assignee:
            Denis Grebennicov
            Reporter:
            Denis Grebennicov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: