ctdb-recoverd: Add and use function this_node_can_be_leader()
authorMartin Schwenke <martin@meltin.net>
Mon, 13 Dec 2021 23:57:03 +0000 (10:57 +1100)
committerMartin Schwenke <martins@samba.org>
Mon, 17 Jan 2022 10:21:32 +0000 (10:21 +0000)
commit7baadfe27eda40560753fb4a61e053ea357fd2d2
tree940f0106ed2d51e2c8e460302244779b4cf8d43e
parent94b546c268ee5fb4505c6febe4bce05f1d75e7cd
ctdb-recoverd: Add and use function this_node_can_be_leader()

This makes the code self-documenting.

In ctdb_election_data() there is a slight behaviour change.  An
inactive node will now try to lose an election.  This case should not happen
because:

* An inactive node can't win an election round and then send a reply.

* Any inactive node should never start an election.  There are
  currently places where this happens and they will be fixed later.

There is an instance where this could be used in
validate_recovery_master() but this involves a more serious logic
change.  Overhaul this function later.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_recoverd.c