Skip to content

Commit

Permalink
Sync from server repo (0783a5e9882)
Browse files Browse the repository at this point in the history
  • Loading branch information
releng committed Nov 20, 2024
1 parent cf50448 commit d9f6a0d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion vclusterops/coordinator_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,16 @@ func (vdb *VCoordinationDatabase) addNode(vnode *VCoordinationNode) error {
// in all clusters (main and sandboxes)
func (vdb *VCoordinationDatabase) addHosts(hosts []string, scName string,
existingHostNodeMap vHostNodeMap) error {
totalHostCount := len(hosts) + len(existingHostNodeMap)
totalHostCount := len(hosts) + len(existingHostNodeMap) + len(vdb.UnboundNodes)
nodeNameToHost := genNodeNameToHostMap(existingHostNodeMap)
// The GenVNodeName(...) function below will generate node names based on nodeNameToHost and totalHostCount.
// If a name already exists, it won't be re-generated.
// In this case, we need to add unbound node names into this map too.
// Otherwise, the new nodes will reuse the existing unbound node names, then make a clash later on.
for _, vnode := range vdb.UnboundNodes {
nodeNameToHost[vnode.Name] = vnode.Address
}

for _, host := range hosts {
vNode := makeVCoordinationNode()
name, ok := util.GenVNodeName(nodeNameToHost, vdb.Name, totalHostCount)
Expand Down

0 comments on commit d9f6a0d

Please sign in to comment.