Skip to content

Commit

Permalink
HA State: ensure not this and another instance can be responsible
Browse files Browse the repository at this point in the history
In theory, this should not happen. This assumption is based on the trust
in the database transaction performing the HA realization logic.
However, one debugged log let one assume that this happened anyway.

This change mostly signals an error while also explicitly giving up the
HA state. Doing so should at least alarm a person reading the logs.
  • Loading branch information
oxzi committed Oct 11, 2024
1 parent df079b1 commit 90c366b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/icingadb/ha.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ func (h *HA) realize(

h.signalTakeover(takeover)
} else if otherResponsible {
if state, _ := h.state.Load(); state.responsible {
h.logger.Error("Other instance is responsible while this node itself is responsible, dropping responsibility")
h.signalHandover("other instance is responsible as well")
// h.signalHandover will update h.state
}
if state, _ := h.state.Load(); !state.otherResponsible {
state.otherResponsible = true
h.state.Store(state)
Expand Down

0 comments on commit 90c366b

Please sign in to comment.