Skip to content

Commit

Permalink
Don't use duplog() for the split handler logs
Browse files Browse the repository at this point in the history
duplog() hides important logs in the split => unsplit => resplit scenario.
Because the log id doesn't change and the duplog map is not cleaned up on
unsplit.

Use a regular log instead, and trust to callers to not call the split handlers
many times.
  • Loading branch information
cvaroqui committed Oct 11, 2021
1 parent 393a7da commit d55ce63
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions opensvc/daemon/shared.py
Expand Up @@ -981,24 +981,20 @@ def arbitrators_config_count():

def split_handler(self):
if not self.quorum:
self.duplog("info",
"cluster is split, ignore as cluster.quorum is "
"false", msgid="quorum disabled")
self.log.info("cluster is split, ignore as cluster.quorum is false")
return
if self.freezer.node_frozen():
self.duplog("info",
"cluster is split, ignore as the node is frozen",
msgid="quorum disabled")
self.log.info("cluster is split, ignore as the node is frozen")
return
total = len(self.cluster_nodes) + self.arbitrators_config_count()
live = self.live_nodes_count()
extra_votes = self.arbitrators_votes()
n_extra_votes = len(extra_votes)
if live + n_extra_votes > total / 2:
self.duplog("info", "cluster is split, we have quorum: "
"%(live)d+%(avote)d out of %(total)d votes (%(a)s)",
live=live, avote=n_extra_votes, total=total,
a=",".join(extra_votes))
self.log.info("cluster is split, we have quorum: "
"%(live)d+%(avote)d out of %(total)d votes (%(a)s)",
live=live, avote=n_extra_votes, total=total,
a=",".join(extra_votes))
return
self.event(self.split_action, {
"reason": "split",
Expand Down

0 comments on commit d55ce63

Please sign in to comment.