Clean resharding recipient state document orphaned when state machine construction is interrupted after insert

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Cluster Scalability
    • Fully Compatible
    • ClusterScalability 6Jul-20Jul
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      createReshardingStateMachine() performs two non-atomic steps for a resharding participant: 1) ensureStateDocumentInserted() which persists the state document and 2) StateMachine::getOrCreate() — constructs/registers the in-memory PrimaryOnlyService instance that actually drives the operation and is responsible for eventually deleting its own document on completion or abort.

      If step 1 succeeds but step 2 then throws (e.g. the operation is interrupted — observed in practice as _shardsvrReshardRecipientInitialize returning Interrupted immediately after the insert), the result is a persisted state document with no in-memory machine ever attached to it.

      This is permanent within the current primary's term: recovery of persisted documents only happens on stepUp, and _shardsvrAbortReshardCollection's cleanup only calls abort() on an instance it can find via tryGetReshardingStateMachine — if none exists, it does nothing. The result is a permanently orphaned document, and the coordinator can never observe the participant as cleaned up after aborting.

            Assignee:
            Kruti Shah
            Reporter:
            Anna Maria Nestorov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: