Skip to content

Commit

Permalink
Merge #4185
Browse files Browse the repository at this point in the history
4185: Update cluster config constraints r=jordanschalm a=jordanschalm

- log a more useful error message if `n_clusters > n_collectors`
- remove unnecessary constraint that clusters must have at least 3 members

Co-authored-by: Jordan Schalm <[email protected]>
  • Loading branch information
bors[bot] and jordanschalm authored Apr 27, 2023
2 parents 2a88409 + c095197 commit 5ef7a60
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
9 changes: 8 additions & 1 deletion cmd/bootstrap/cmd/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@ func constructClusterAssignment(partnerNodes, internalNodes []model.NodeInfo, se

partners := model.ToIdentityList(partnerNodes).Filter(filter.HasRole(flow.RoleCollection))
internals := model.ToIdentityList(internalNodes).Filter(filter.HasRole(flow.RoleCollection))
nClusters := flagCollectionClusters
nCollectors := len(partners) + len(internals)

// ensure we have at least as many collection nodes as clusters
if nCollectors < int(flagCollectionClusters) {
log.Fatal().Msgf("network bootstrap is configured with %d collection nodes, but %d clusters - must have at least one collection node per cluster",
nCollectors, flagCollectionClusters)
}

// deterministically shuffle both collector lists based on the input seed
// by using a different seed each spork, we will have different clusters
// even with the same collectors
partners = partners.DeterministicShuffle(seed)
internals = internals.DeterministicShuffle(seed)

nClusters := flagCollectionClusters
identifierLists := make([]flow.IdentifierList, nClusters)

// first, round-robin internal nodes into each cluster
Expand Down
5 changes: 0 additions & 5 deletions cmd/bootstrap/cmd/constants.go

This file was deleted.

9 changes: 0 additions & 9 deletions cmd/bootstrap/cmd/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,4 @@ func checkConstraints(partnerNodes, internalNodes []model.NodeInfo) {
partnerCOLCount += clusterPartnerCount
internalCOLCount += clusterInternalCount
}

// ensure we have enough total collectors
totalCollectors := partnerCOLCount + internalCOLCount
if totalCollectors < flagCollectionClusters*minNodesPerCluster {
log.Fatal().Msgf(
"will not bootstrap configuration with insufficient # of collectors for cluster count: "+
"(total_collectors=%d, clusters=%d, min_total_collectors=%d)",
totalCollectors, flagCollectionClusters, flagCollectionClusters*minNodesPerCluster)
}
}

0 comments on commit 5ef7a60

Please sign in to comment.