Fix type-unsafe cluster parameter manipulation in write_op_analyzer_test

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • ALL
    • CAR Team 2026-05-25, CAR Team 2026-06-08, CAR Team 2026-06-22
    • 🟥 DDL, 🟦 Shard Catalog, 🟩 Routing and Topology
    • None
    • None
    • None
    • None
    • None
    • None

      Problem

      The test fixture in write_op_analyzer_test.cpp (lines 86-100) always constructed an OnlyTargetDataOwningShardsForMultiWritesParam struct to build the BSON payload, regardless of which cluster parameter was actually being set.

      When used to set pauseMigrationsDuringMultiUpdates, it silently passed BSON derived from the wrong type. This only worked by accident because PauseMigrationsDuringMultiUpdatesParam and OnlyTargetDataOwningShardsForMultiWritesParam happen to share the same IDL shape (clusterServerParameter + enabled: bool). If those two structs ever diverge, the tests would silently inject malformed data into the wrong parameter.

      Additionally, the manual set-at-start / reset-at-end pattern was error-prone: PauseMigrationsDuringMultiUpdatesParamEnabledWithMultiUpdate called setClusterParameter again at the end of the test (line 898) instead of resetClusterParameter, leaving the parameter dirty for subsequent tests.

      Fix

      Replace the ad-hoc setClusterParameter and resetClusterParameter helpers with RAIIServerParameterControllerForTest, using the correct IDL struct type per parameter:

      OnlyTargetDataOwningShardsForMultiWritesParam for onlyTargetDataOwningShardsForMultiWrites
      PauseMigrationsDuringMultiUpdatesParam for pauseMigrationsDuringMultiUpdates
      This ensures type safety, guarantees cleanup via RAII (no forgotten or misfired resets), and makes each test's intent explicit

            Assignee:
            Sergi Mateo Bellido
            Reporter:
            Sergi Mateo Bellido
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: