Use consistent catalog on IndexBuildsCoordinator collection scan

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • Storage Execution 2025-10-27
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      IndexBuildsCoordinator may read with readSource=majority , where the catalog for the collection may not be the latest one, but also needs to see the latest catalog or at least one that is inclusive of the registration of indexes being built (e.g getEntry needs to see the registered index entry)

      Moreover, `_doCollectionScan` calls `abandonSnapshot` (e.g. onSuppressedError  and dumpInsertsFromBulk), which must not be done when using a consistent catalog acquisition (OperationType::kRead), as abandoning the snapshot causes the collection acquisition to become invalid as the stashed catalog may disappear or go out of sync with the read snapshot.

      To be able to use ShardRole collection acquisitions with a consistent catalog for the scan, we’d need to stop abandoning the snapshot during the scan. One option is to use an alternative recovery unit for the when executing `_insert` and `dumpInsertsFromBulk`. Another option might be to use different client threads for reading and writing (_insert).

      Although this represents no correctness issue currently, as index builds are aborted on significant catalog changes, it would be more idiomatic to perform the scan using a collection acquisition with a consistent catalog (like a normal read).

            Assignee:
            Stephanie Eristoff
            Reporter:
            Jordi Serra Torrens
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: