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.
- is depended on by
-
SERVER-78009 shardSvrCommitReshardCollection command should fail recoverably if the node is shutting down
- Closed
- related to
-
SERVER-78839 Investigate changes needed in sharding POS services to use the new return value for instance lookup
- Backlog
-
SERVER-78840 Investigate changes needed in serverless POS services to use the new return value for instance lookup
- Backlog