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

POS interface should expose its shutdown state

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0, 7.0.3, 6.0.12, 5.0.23
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Service Arch
    • Fully Compatible
    • v7.0, v6.0, v5.0
    • Service Arch 2023-07-10

      The Primary Only Service currently lacks a static method that allows derived classes to determine whether the service has been shut down. The existing lookupInstance() method does not distinguish between an instance not being present in the registry and the internal state being State::kShutdown.

      The need for this functionality arose from issue BF-29013. To generalize the requirement, if a command is interrupted due to a shutdown, a retry may end up on the same node if the primary is unable to step down quickly due to reasons like lagging secondary nodes. Since the shutdown operation is not atomic and external observers may see different system states, the command needs visibility of POS state to perform the right action which can be to retry the command due to POS Shutdown until a new primary assumes its role to communicate the same to the sender of the command. The state if exposed by throwing a Shutdown error would be nice in a lookup() method, otherwise a function to check if service is shutdown will suffice albeit at the cost of some boiler plate code at callers.

            wenbin.zhu@mongodb.com Wenbin Zhu
            abdul.qadeer@mongodb.com Abdul Qadeer
            0 Vote for this issue
            6 Start watching this issue