mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
propogate updates to node details (not just additions and deletions)
to all nodes in cluster, not just coordinator
This commit is contained in:
parent
dfb748ec5b
commit
ef6db5cc1a
2 changed files with 17 additions and 1 deletions
|
|
@ -70,7 +70,7 @@ type Node struct {
|
|||
}
|
||||
|
||||
func (n Node) String() string {
|
||||
return fmt.Sprintf("Node:%s:%s:%s", n.URI, n.State, n.ID[:6])
|
||||
return fmt.Sprintf("Node:%s:%s:%s", n.URI, n.State, n.ID)
|
||||
}
|
||||
|
||||
// Nodes represents a list of nodes.
|
||||
|
|
@ -364,6 +364,7 @@ func (c *cluster) addNode(node *Node) error {
|
|||
if !c.Topology.addID(node.ID) {
|
||||
return nil
|
||||
}
|
||||
c.Topology.nodeStates[node.ID] = node.State
|
||||
|
||||
// save topology
|
||||
return c.saveTopology()
|
||||
|
|
@ -588,6 +589,12 @@ func (c *cluster) nodePositionByID(nodeID string) int {
|
|||
func (c *cluster) addNodeBasicSorted(node *Node) bool {
|
||||
n := c.unprotectedNodeByID(node.ID)
|
||||
if n != nil {
|
||||
if n.State != node.State || n.IsCoordinator != node.IsCoordinator || n.URI != node.URI {
|
||||
n.State = node.State
|
||||
n.IsCoordinator = node.IsCoordinator
|
||||
n.URI = node.URI
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -678,6 +678,15 @@ func TestClusterQueriesAfterRestart(t *testing.T) {
|
|||
defer cluster.Close()
|
||||
cmd1 := cluster[1]
|
||||
|
||||
for _, com := range cluster {
|
||||
nodes := com.API.Hosts(context.Background())
|
||||
for _, n := range nodes {
|
||||
if n.State != "READY" {
|
||||
t.Fatalf("unexpected node state after upping cluster: %v", nodes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmd1.MustCreateIndex(t, "testidx", pilosa.IndexOptions{})
|
||||
cmd1.MustCreateField(t, "testidx", "testfield", pilosa.OptFieldTypeSet(pilosa.CacheTypeRanked, 10))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue