[lxc-devel] [lxd/master] Consider all nodes when looking for the leader, not only voters

freeekanayaka on Github lxc-bot at linuxcontainers.org
Mon May 4 10:58:27 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 461 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200504/5ec3be7c/attachment-0001.bin>
-------------- next part --------------
From f143304116fa7a07968650255b77cb43ffbd6586 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Mon, 4 May 2020 11:56:11 +0100
Subject: [PATCH] Consider all nodes when looking for the leader, not only
 voters

This is now safe since dqlite itself will return empty responses
when probing non-voting nodes.

Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
 lxd/cluster/gateway.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lxd/cluster/gateway.go b/lxd/cluster/gateway.go
index 656f1e5061..cfbb63580e 100644
--- a/lxd/cluster/gateway.go
+++ b/lxd/cluster/gateway.go
@@ -684,8 +684,7 @@ func (g *Gateway) init() error {
 
 	g.lock.Lock()
 	g.store.onDisk = client.NewNodeStore(
-		g.db.DB(), "main", "raft_nodes", "address",
-		client.WithNodeStoreWhereClause(fmt.Sprintf("role=%d", db.RaftVoter)))
+		g.db.DB(), "main", "raft_nodes", "address")
 	g.lock.Unlock()
 
 	return nil


More information about the lxc-devel mailing list