From b2f88f10a29452f4a847ebaa83e45281af0430ea Mon Sep 17 00:00:00 2001 From: hc-github-team-nomad-core <82989552+hc-github-team-nomad-core@users.noreply.github.com> Date: Thu, 14 Sep 2023 08:01:31 -0500 Subject: [PATCH] backport of commit bd519dcbf429164c8a81b84247ffe1c776bb4f8d (#18499) Co-authored-by: stswidwinski --- .changelog/18494.txt | 3 +++ command/agent/config.go | 12 ++++++++++++ command/agent/config_test.go | 6 ++++++ 3 files changed, 21 insertions(+) create mode 100644 .changelog/18494.txt diff --git a/.changelog/18494.txt b/.changelog/18494.txt new file mode 100644 index 000000000..ac27da4a1 --- /dev/null +++ b/.changelog/18494.txt @@ -0,0 +1,3 @@ +```release-note:bug +server: Fixed a bug where Raft server configuration parameters were not correctly merged +``` diff --git a/command/agent/config.go b/command/agent/config.go index 26bc43e50..8772d952e 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -2038,6 +2038,18 @@ func (s *ServerConfig) Merge(b *ServerConfig) *ServerConfig { } } + if b.RaftSnapshotThreshold != nil { + result.RaftSnapshotThreshold = pointer.Of(*b.RaftSnapshotThreshold) + } + + if b.RaftSnapshotInterval != nil { + result.RaftSnapshotInterval = pointer.Of(*b.RaftSnapshotInterval) + } + + if b.RaftTrailingLogs != nil { + result.RaftTrailingLogs = pointer.Of(*b.RaftTrailingLogs) + } + if b.JobTrackedVersions != nil { result.JobTrackedVersions = b.JobTrackedVersions } diff --git a/command/agent/config_test.go b/command/agent/config_test.go index a78b3fd23..b998b347f 100644 --- a/command/agent/config_test.go +++ b/command/agent/config_test.go @@ -141,6 +141,9 @@ func TestConfig_Merge(t *testing.T) { ProtocolVersion: 1, RaftProtocol: 1, RaftMultiplier: pointer.Of(5), + RaftSnapshotThreshold: pointer.Of(100), + RaftSnapshotInterval: pointer.Of("30m"), + RaftTrailingLogs: pointer.Of(200), NumSchedulers: pointer.Of(1), NodeGCThreshold: "1h", BatchEvalGCThreshold: "4h", @@ -341,6 +344,9 @@ func TestConfig_Merge(t *testing.T) { ProtocolVersion: 2, RaftProtocol: 2, RaftMultiplier: pointer.Of(6), + RaftSnapshotThreshold: pointer.Of(100), + RaftSnapshotInterval: pointer.Of("30m"), + RaftTrailingLogs: pointer.Of(200), NumSchedulers: pointer.Of(2), EnabledSchedulers: []string{structs.JobTypeBatch}, NodeGCThreshold: "12h",