ExportXMLWordPrintableJSON

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

      Standalone inserts diverge the rid space, so they must clear the groupId. Decided design: clear at the first standalone insert into an in-scope collection, plus storage-level record store rebuilds. Only new rid assignment can create a wrong rid-to-document mapping: updates are in-place and never change a rid, deletes create missing mappings but never wrong ones. Rolling Index Builds and read-only standalone maintenance (including TTL deletes) preserve membership.

      Details

      • A one-shot guard armed at standalone startup fires in collection_write_path's insert entry points and at the mongod repair layer (repair reassigns rids wholesale without going through the insert paths).
      • Clear-then-write ordering: the drop commits in its own WriteUnitOfWork before the triggering write, so a crash in between is conservative (groupId gone, write lost), never the reverse.
      • Concurrency: the guard is an atomic armed/clearing/cleared state. The first triggering write claims and performs the drop; concurrent triggering writes wait until the clear is durable, and a failed clear fails the write loudly. One-shot with permanent disarm is sound: nothing in a standalone session can recreate the table (mints need an election, adoption needs initial sync, restores are exempt), and the wait happens at most once per process lifetime.
      • Zero overhead outside standalone: the guard is armed only at standalone startup, so on replica-set nodes the hook is a single branch on a process-lifetime constant that is always false. The branch reads an atomic bool, not the groupId table.
      • Log the clear loudly with the triggering namespace.
      • Non-triggers: updates, deletes (including TTL), catalog-only and index-ident writes (Rolling Index Builds never clear), new collection creation, compact (rids are keys, page movement preserves them).
      • Exemptions: startup oplog recovery in all modes (it replays the node's own history honoring rids, see the design's Restore section) and magic restore mode.
      • Dependency note: the delete residual (a rid freed by a standalone delete being reused by the group for a different document) is caught loudly as WT_DUPLICATE_KEY by the allowOverwrite=false backstop, so SERVER-106723 should land first or together.
      • The funnel is verified narrow: the only direct RecordStore insert callers outside collection_write_path are SBE spilling (temp tables) and the oplog (local, exempt). The initial-sync bulk loader is exempt.

      Acceptance criteria

      • Tests per entry point: insert clears; repair clears; update, delete, and TTL delete do not clear; a Rolling Index Build scenario does not clear; read-only standalone does not clear.
      • A unit test with two concurrent first inserts asserting exactly one drop and both inserts ordered after the clear.
      • FCBIS recovery and magic restore modes do not clear.

            Assignee:
            Unassigned
            Reporter:
            Ernesto Rodriguez Reina
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: