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

Ensure a POS instance remains in the POS map until the instance's run() is complete

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Service Arch
    • Service Arch 2022-07-11, Service Arch 2022-11-28, Service Arch 2023-01-09, Service Arch 2023-01-23, Service Arch 2023-02-06, Service Arch 2023-02-20, Service Arch 2023-03-06, Service Arch 2023-03-20, Service Arch 2023-04-03, Service Arch 2023-04-17, Service Arch 2023-05-01, Service Arch 2023-05-15, Service Arch 2023-05-29, Service Arch 2023-06-12, Service Arch 2023-06-26

      The original PrimaryOnlyService left it up to individual instances to insert and delete their state documents, but has an op observer for removing an instance from the in-memory map when the state document is deleted. This means an instance can end up in a "detached" state where it can continue executing logic after deleting its state doc, but no longer be in the in-memory map. This, in combination to the way services are interrupted on stepdown and shutdown, has led to oddities like making commands that wait on an instance's completion future call OperationContext::setAlwaysInterruptAtStepDownOrUp. (If they didn't, the state doc could be deleted while the node is primary, then the instance gets removed from the in-memory map, then the node steps down and the instance doesn't get interrupted since it's no longer in the map but its further work does get canceled since the scoped executor gets shut down, so the instance's completion promise is never fulfilled and the command would end up waiting forever.)

      This ticket is to instead remove the instance from the in-memory map only after the instance's run() has complete and remove the calls to OperationContext::setAlwaysInterruptAtStepDownOrUp.

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: