multi: add leader check to the healthcheck monitor

This commit extends our healtcheck with an optional leader check. This
is to ensure that given network partition or other cluster wide failure
we act as soon as possible to avoid a split-brain situation where a new
leader is elected but we still hold onto our etcd client.
This commit is contained in:
Andras Banki-Horvath committed 2024-08-01 19:04:10 +02:00
1 parent 7784d6abf6
commit 8e0534f756
8 files changed
+121 -12

No files matched your search

+17
View File
@@ -169,6 +169,17 @@ const (
defaultRSBackoff = time.Second * 30
defaultRSAttempts = 1
// Set defaults for a health check which ensures that the leader
// election is functioning correctly. Although this check is off by
// default (as etcd leader election is only used in a clustered setup),
// we still set the default values so that the health check can be
// easily enabled with sane defaults. Note that by default we only run
// this check once, as it is critical for the node's operation.
defaultLeaderCheckInterval = time.Minute
defaultLeaderCheckTimeout = time.Second * 5
defaultLeaderCheckBackoff = time.Second * 5
defaultLeaderCheckAttempts = 1
// defaultRemoteMaxHtlcs specifies the default limit for maximum
// concurrent HTLCs the remote party may add to commitment transactions.
// This value can be overridden with --default-remote-max-htlcs.
@@ -672,6 +683,12 @@ func DefaultConfig() Config {
Attempts: defaultRSAttempts,
Backoff: defaultRSBackoff,
},
LeaderCheck: &lncfg.CheckConfig{
Interval: defaultLeaderCheckInterval,
Timeout: defaultLeaderCheckTimeout,
Attempts: defaultLeaderCheckAttempts,
Backoff: defaultLeaderCheckBackoff,
},
},
Gossip: &lncfg.Gossip{
MaxChannelUpdateBurst: discovery.DefaultMaxChannelUpdateBurst,