Retry write conflicts when dropping unfinished indexes during startup recovery

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • 9.1.0-rc0
    • Affects Version/s: None
    • Component/s: Build
    • None
    • Query Optimization
    • v9.0
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The primary-driven index build suites added by SERVER-126326 start every mongod with the `WTWriteConflictException` failpoint (`activationProbability: 0.001`), which makes WiredTiger record store writes randomly throw `WriteConflictException`. When a node restarts with unfinished single-phase index entries in the catalog, for example after being killed during initial-sync bulk index builds, `catalog_repair::reconcileCatalogAndIdents` drops those entries and rewrites the collection metadata in a `WriteUnitOfWork` with no write conflict handling. An injected conflict on that `_mdb_catalog` update escapes `initAndListen` and the node exits with code 100. This is how `initial_sync_crash_while_bulk_building_indexes.js` fails in `noPassthrough_primary_driven_index_builds` (BF-44709).

      This change wraps the metadata replacement in a `writeConflictRetry`, following the same pattern as `repair.cpp`. The metadata `shared_ptr` is now passed by copy instead of `std::move` so a retried attempt does not observe a moved-from value.

      `StorageEngineTest.ReconcileUnfinishedIndexRetriesWriteConflicts` reproduces the failure deterministically: it arms `WTWriteConflictException` with `nTimes: 2` and verifies that reconciliation retries the catalog write through consecutive conflicts, drops the index ident, and persists the metadata without the dropped index. Without the fix the test fails with the same escaped `WriteConflict` error seen in the build failures.

            Assignee:
            Henri Nikku
            Reporter:
            Henri Nikku
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: