Use postgresql advisory locks to prevent concurrent dispatcher / keep-balance processes
Updated by Peter Amstutz 19 days ago
This should be the kind of lock that allows the new process can elbow out the old process -- I'm thinking of the situation where we start a new "something" and want it to replace the old "something".
So we want to communicate:
- To the new process that it is now allowed to take over
- To the old process it should release the lock and shut down
Updated by Peter Amstutz 18 days ago
On second thought, that might be a bad idea, because it could lead to two processes fighting over the lock instead of one getting it and the other failing.
The one that fails to get the lock, perhaps it could stay up health check reports it in a "failed to get lock" state? Also, can the lock record some information about the node that does have the lock.