Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-94787

Avoid abandoning the snapshot explicitly in CollectionScan

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution

      As part of SERVER-90992 we want to avoid abandoning a snapshot while holding a CollectionPtr using establishConsistentCollection from the catalog.

      In the CollectionScan stage we explicitly abandon the snapshot if we're accessing the oplog and we must wait for earlier oplog writes to be available. This could cause the oplog's collectionPtr to become invalidated if a concurrent DDL operation would occur on it and we were forced to open a collection instance tied to the lifetime of the WT snapshot. As a result, we would be interacting with an invalid pointer to freed memory.

      Note that we also explicitly abandon the snapshot again when calling waitForAllEarlierOplogWritesToBeVisible and explicitly invariant the server if a snapshot is open at the time of calling.

      Ideally we should avoid doing this and instead rely on the internal yield mechanism that already exists for query plans to abandon the snapshot and continue the execution.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jordi.olivares-provencio@mongodb.com Jordi Olivares Provencio
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: