From 81fda2aa26ef4a82da354608a6de014d340dde88 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Sun, 31 Dec 2023 15:14:34 -0500 Subject: [PATCH 1/5] Don't hardcode suffrage when joining --- cluster/bootstrap.go | 2 +- cmd/rqlited/main.go | 4 ++-- system_test/e2e/auto_clustering.py | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cluster/bootstrap.go b/cluster/bootstrap.go index 70ee3276..f3500211 100644 --- a/cluster/bootstrap.go +++ b/cluster/bootstrap.go @@ -180,7 +180,7 @@ func (b *Bootstrapper) Boot(id, raftAddr string, suf Suffrage, done func() bool, // Try an explicit join first. Joining an existing cluster is always given priority // over trying to form a new cluster. if j, err := joiner.Do(targets, id, raftAddr, suf); err == nil { - b.logger.Printf("succeeded directly joining cluster via node at %s", j) + b.logger.Printf("succeeded directly joining cluster via node at %s as %s", j, suf) b.setBootStatus(BootJoin) return nil } diff --git a/cmd/rqlited/main.go b/cmd/rqlited/main.go index 1077dc7e..36ca8aed 100644 --- a/cmd/rqlited/main.go +++ b/cmd/rqlited/main.go @@ -459,7 +459,7 @@ func createCluster(cfg *Config, hasPeers bool, client *cluster.Client, str *stor // Bootstrap with explicit join addresses requests. bs := cluster.NewBootstrapper(cluster.NewAddressProviderString(joins), client) bs.SetCredentials(cluster.CredentialsFor(credStr, cfg.JoinAs)) - return bs.Boot(str.ID(), cfg.RaftAdv, cluster.Voter, isClustered, cfg.BootstrapExpectTimeout) + return bs.Boot(str.ID(), cfg.RaftAdv, cluster.VoterSuffrage(!cfg.RaftNonVoter), isClustered, cfg.BootstrapExpectTimeout) } if cfg.DiscoMode == "" { @@ -503,7 +503,7 @@ func createCluster(cfg *Config, hasPeers bool, client *cluster.Client, str *stor bs := cluster.NewBootstrapper(provider, client) bs.SetCredentials(cluster.CredentialsFor(credStr, cfg.JoinAs)) httpServ.RegisterStatus("disco", provider) - return bs.Boot(str.ID(), cfg.RaftAdv, cluster.Voter, isClustered, cfg.BootstrapExpectTimeout) + return bs.Boot(str.ID(), cfg.RaftAdv, cluster.VoterSuffrage(!cfg.RaftNonVoter), isClustered, cfg.BootstrapExpectTimeout) case DiscoModeEtcdKV, DiscoModeConsulKV: discoService, err := createDiscoService(cfg, str) diff --git a/system_test/e2e/auto_clustering.py b/system_test/e2e/auto_clustering.py index 086e8e03..41757095 100644 --- a/system_test/e2e/auto_clustering.py +++ b/system_test/e2e/auto_clustering.py @@ -175,6 +175,11 @@ class TestAutoClusteringDNS(unittest.TestCase): self.nodes.append(n3) self.assertEqual(n0.wait_for_leader(), n3.wait_for_leader()) + self.assertTrue(n0.is_voter()) + self.assertTrue(n1.is_voter()) + self.assertTrue(n2.is_voter()) + self.assertFalse(n3.is_voter()) + def tearDown(self): del os.environ['RQLITE_DISCO_DNS_HOSTS'] for n in self.nodes: From 7f0705eb440b7eba702bfe19e36bf76381ec1a63 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Sun, 31 Dec 2023 15:15:58 -0500 Subject: [PATCH 2/5] CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8b6743c..d2a45170 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ This release adds new control over Raft snapshotting, a key part of the Raft consensus protocol. When the WAL file reaches a certain size (4MB by default, which equals the SQLite default), rqlite will trigger a Raft snapshot. In its default setting this change may reduce disk usage, but may also result in more frequent Raft snapshotting. Most users can ignore this change and carry on as before after upgrading to this release. ### New features - [PR #1530](https://github.com/rqlite/rqlite/pull/1530), [PR #1533](https://github.com/rqlite/rqlite/pull/1533): Support automatically snapshotting when WAL reaches the SQLite default of 4MB. -- [PR #1541](https://github.com/rqlite/rqlite/pull/1541), [PR #1542](https://github.com/rqlite/rqlite/pull/1542): DNS-based autoclustering supports read-only (non-voting) nodes. Fixes issue [#1521](https://github.com/rqlite/rqlite/issues/1521) +- [PR #1541](https://github.com/rqlite/rqlite/pull/1541), [PR #1542](https://github.com/rqlite/rqlite/pull/1542), [PR #1546](https://github.com/rqlite/rqlite/pull/1546): DNS-based autoclustering supports read-only (non-voting) nodes. Fixes issue [#1521](https://github.com/rqlite/rqlite/issues/1521) and [#1525](https://github.com/rqlite/rqlite/issues/1525) - [PR #1544](https://github.com/rqlite/rqlite/pull/1544): Support autoclustering of read-only nodes with Consul and etcd. ### Implementation changes and bug fixes From aaab0a8ca4d914bbcd785d1fb7adc28c44dee46a Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Sun, 31 Dec 2023 15:18:55 -0500 Subject: [PATCH 3/5] Fix up CHANGELOG --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2a45170..e9f1a8f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ +## 8.14.1 (December 26th 2023) +### Implementation changes and bug fixes +- PR [#1546](https://github.com/rqlite/rqlite/pull/1546): Don't hardcode suffrage when joining. Fixes issue [#1525](https://github.com/rqlite/rqlite/issues/1525) + ## 8.14.0 (December 31st 2023) This release adds new control over Raft snapshotting, a key part of the Raft consensus protocol. When the WAL file reaches a certain size (4MB by default, which equals the SQLite default), rqlite will trigger a Raft snapshot. In its default setting this change may reduce disk usage, but may also result in more frequent Raft snapshotting. Most users can ignore this change and carry on as before after upgrading to this release. ### New features - [PR #1530](https://github.com/rqlite/rqlite/pull/1530), [PR #1533](https://github.com/rqlite/rqlite/pull/1533): Support automatically snapshotting when WAL reaches the SQLite default of 4MB. -- [PR #1541](https://github.com/rqlite/rqlite/pull/1541), [PR #1542](https://github.com/rqlite/rqlite/pull/1542), [PR #1546](https://github.com/rqlite/rqlite/pull/1546): DNS-based autoclustering supports read-only (non-voting) nodes. Fixes issue [#1521](https://github.com/rqlite/rqlite/issues/1521) and [#1525](https://github.com/rqlite/rqlite/issues/1525) +- [PR #1541](https://github.com/rqlite/rqlite/pull/1541), [PR #1542](https://github.com/rqlite/rqlite/pull/1542): DNS-based autoclustering supports read-only (non-voting) nodes. Fixes issue [#1521](https://github.com/rqlite/rqlite/issues/1521) and [#1525](https://github.com/rqlite/rqlite/issues/1525) - [PR #1544](https://github.com/rqlite/rqlite/pull/1544): Support autoclustering of read-only nodes with Consul and etcd. ### Implementation changes and bug fixes From 7f81af6130464134a304134295a9ac79b8883d10 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Sun, 31 Dec 2023 15:20:09 -0500 Subject: [PATCH 4/5] Credits --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9f1a8f5..da961506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 8.14.1 (December 26th 2023) ### Implementation changes and bug fixes -- PR [#1546](https://github.com/rqlite/rqlite/pull/1546): Don't hardcode suffrage when joining. Fixes issue [#1525](https://github.com/rqlite/rqlite/issues/1525) +- [PR #1546](https://github.com/rqlite/rqlite/pull/1546): Don't hardcode suffrage when joining. Fixes issue [#1525](https://github.com/rqlite/rqlite/issues/1525). Thanks @jtackaberry ## 8.14.0 (December 31st 2023) This release adds new control over Raft snapshotting, a key part of the Raft consensus protocol. When the WAL file reaches a certain size (4MB by default, which equals the SQLite default), rqlite will trigger a Raft snapshot. In its default setting this change may reduce disk usage, but may also result in more frequent Raft snapshotting. Most users can ignore this change and carry on as before after upgrading to this release. From 0ff348649186a748fbce50dae1205b686130d3ac Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Sun, 31 Dec 2023 15:20:48 -0500 Subject: [PATCH 5/5] Correct CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da961506..4110cfdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ This release adds new control over Raft snapshotting, a key part of the Raft consensus protocol. When the WAL file reaches a certain size (4MB by default, which equals the SQLite default), rqlite will trigger a Raft snapshot. In its default setting this change may reduce disk usage, but may also result in more frequent Raft snapshotting. Most users can ignore this change and carry on as before after upgrading to this release. ### New features - [PR #1530](https://github.com/rqlite/rqlite/pull/1530), [PR #1533](https://github.com/rqlite/rqlite/pull/1533): Support automatically snapshotting when WAL reaches the SQLite default of 4MB. -- [PR #1541](https://github.com/rqlite/rqlite/pull/1541), [PR #1542](https://github.com/rqlite/rqlite/pull/1542): DNS-based autoclustering supports read-only (non-voting) nodes. Fixes issue [#1521](https://github.com/rqlite/rqlite/issues/1521) and [#1525](https://github.com/rqlite/rqlite/issues/1525) +- [PR #1541](https://github.com/rqlite/rqlite/pull/1541), [PR #1542](https://github.com/rqlite/rqlite/pull/1542): DNS-based autoclustering supports read-only (non-voting) nodes. Fixes issue [#1521](https://github.com/rqlite/rqlite/issues/1521) - [PR #1544](https://github.com/rqlite/rqlite/pull/1544): Support autoclustering of read-only nodes with Consul and etcd. ### Implementation changes and bug fixes