Take into account current role when deciding on removal of member ZNode (#2884)

Patroni doesn't watch on all changes of member keys in order to not create too much load on ZooKeeper, but only subscribes to changes (ZNodes added or deleted) in the `/member` directory. Therefore when some important fields in the value are updated we remove and recreate ZNode in order to notify the leader or other members.

The leader should remove the member key only when the `checkpoint_after_promote` value is changed and replicas when the `state` is changed to/from `running`.

We don't care about the `version` field, because Patroni version can't be changed without restart, what will case ZooKeeper `session_id` to change it anyway.

This fix hopefully will reduce failures of behave tests on GH Actions.
This commit is contained in:
Alexander Kukushkin
2023-09-26 09:12:31 +02:00
committed by GitHub
parent 2bd821a768
commit 48514db84b
3 changed files with 25 additions and 16 deletions
+1
View File
@@ -276,6 +276,7 @@ class TestZooKeeper(unittest.TestCase):
self.assertTrue(self.zk.delete_cluster())
def test_watch(self):
self.zk.event.wait = Mock()
self.zk.watch(None, 0)
self.zk.event.is_set = Mock(return_value=True)
self.zk._fetch_status = False