From 787948080b772c431dac2ac77bc11269e9880474 Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Tue, 9 Jul 2024 14:44:34 +0200 Subject: [PATCH] Fix name and use of CORE_CLUSTER_RECOVER_TIMEOUT_SEC --- cluster/cluster.go | 1 + cluster/follower.go | 4 +++- config/config.go | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cluster/cluster.go b/cluster/cluster.go index f70f037f..bc367ccc 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -55,6 +55,7 @@ type Cluster interface { Leave(origin, id string) error // gracefully remove a node from the cluster TransferLeadership(origin, id string) error // transfer leadership to another node Snapshot(origin string) (io.ReadCloser, error) + IsRaftLeader() bool HasRaftLeader() bool ProcessAdd(origin string, config *app.Config) error diff --git a/cluster/follower.go b/cluster/follower.go index 86fda4f0..2698b746 100644 --- a/cluster/follower.go +++ b/cluster/follower.go @@ -33,7 +33,9 @@ func (c *cluster) establishFollowership(ctx context.Context) { ctx, cancel := context.WithCancel(ctx) c.cancelFollowerShip = cancel - go c.recoverCluster(ctx, c.syncInterval) + if c.recoverTimeout > 0 { + go c.recoverCluster(ctx, c.syncInterval) + } } func (c *cluster) revokeFollowership() { diff --git a/config/config.go b/config/config.go index 281e31ef..40968369 100644 --- a/config/config.go +++ b/config/config.go @@ -299,7 +299,7 @@ func (d *Config) init() { d.vars.Register(value.NewInt64(&d.Cluster.SyncInterval, 5), "cluster.sync_interval_sec", "CORE_CLUSTER_SYNC_INTERVAL_SEC", nil, "Interval between aligning the process in the cluster DB with the processes on the nodes", true, false) d.vars.Register(value.NewInt64(&d.Cluster.NodeRecoverTimeout, 120), "cluster.node_recover_timeout_sec", "CORE_CLUSTER_NODE_RECOVER_TIMEOUT_SEC", nil, "Timeout for a node to recover before rebalancing the processes", true, false) d.vars.Register(value.NewInt64(&d.Cluster.EmergencyLeaderTimeout, 10), "cluster.emergency_leader_timeout_sec", "CORE_CLUSTER_EMERGENCY_LEADER_TIMEOUT_SEC", nil, "Timeout for establishing the emergency leadership after lost contact to raft leader", true, false) - d.vars.Register(value.NewInt64(&d.Cluster.RecoverTimeout, 0), "cluster.recover_timeout_sec", "CORE_CLUSTER_NODE_RECOVER_TIMEOUT_SECONDS", nil, "Timeout for recovering the cluster if no leader can be voted", false, false) + d.vars.Register(value.NewInt64(&d.Cluster.RecoverTimeout, 0), "cluster.recover_timeout_sec", "CORE_CLUSTER_RECOVER_TIMEOUT_SEC", nil, "Timeout for recovering the cluster if no raft leader can be elected", false, false) d.vars.Register(value.NewBool(&d.Cluster.Debug.DisableFFmpegCheck, false), "cluster.debug.disable_ffmpeg_check", "CORE_CLUSTER_DEBUG_DISABLE_FFMPEG_CHECK", nil, "Disable checking for identical FFmpeg versions on all nodes", false, false) }