Expand unit-test coverage of write-conflict injection using enableWriteConflictForWrites

XMLWordPrintableJSON

    • Type: Engineering Test
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Storage Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      SERVER-126448 introduced storage-engine-agnostic test helpers enableWriteConflictForWrites and
      enableWriteConflictForReads which
      deterministically inject a WriteConflictException into a WiredTiger write (WT_OP_CHECK) orread/seek (WT_READ_CHECK). This ticket tracks extending their use to other subsystems that rely on write-conflict retry/rollback but are pinned today only byslow integration/concurrency jstests.

      Motivation

      • The read/restore path is effectively untested at the unit level for write conflicts
      • Much WCE retry/safety behavior is covered only by jstests (profile_write_conflict.js,
        write_conflict_preserves_plan_stats.js, agg_cursor_invalidations.js,
        partial_unique_indexes.js, apply_ops_insert_write_conflict.js, collMod_writeconflict.js,
        reindex_writeconflict.js). Unit coverage would be faster, deterministic, and pin behavior at the
        source.

      Candidate areas (non-index-build)

      • Core CRUD writescollection_write_path.cpp. collection_write_path_test.cpp already runs
        on real WiredTiger but injects no WCE. Add tests that fire a WCE during
        insertDocuments/updateDocument/deleteDocument/truncate/truncateRange and assertop-observer, pre-image, and index side effects roll back and a retry succeeds. With a secondary index present this also exercises wiredtiger_index.cpp WT_OP_CHECK.
      • Read / cursor restore – extend enableWriteConflictForReads coverage to RecordStore andSortedDataInterface cursor restore() across capped, oplog, clustered, and index cursors (only one standard record-store cursor case exists today).
      • Fast-count / SizeStorer – WCE during wiredtiger_size_storer.cpp flush keeps record
      • Timeseries write path – WCE during timeseries_write_ops_internal.cpp reverts bucket-catalog
        state.

      Cleanup

      • Migrate collection_cache_recoverer_test.cpp (test CacheRecovererBubblesUpCachePressureErrors)
        from the hardcoded FailPointEnableBlock{"WTWriteConflictExceptionForReads"} to
        enableWriteConflictForReads for engine-agnostic consistency. This is the only remaining hardcoded WT write-conflict fail-point name in unit tests; the TODO SERVER-126415 markers from the original change have already been resolved.

      Caveats

      • The fail point is process-global, so tests must arm it narrowly around the operation under test (see container_based_spiller_test.cpp for the pattern).
      • Some query-execution stages run on mock storage and cannot use these helpers; those remain integration tests.

            Assignee:
            Unassigned
            Reporter:
            Stephanie Eristoff
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: