Skip to content

Commit 40a1874

Browse files
committed
asim: add comment for BasicCluster.info
This commit adds a comment to BasicCluster.info to highlight the inefficiency of constructing the region node ratio when nodes_per_region is used with gen_cluster just to reuse ClusterInfoWithDistribution. Epic: none Release note: none
1 parent 7839924 commit 40a1874

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/kv/kvserver/asim/gen/generator.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ func (bc BasicCluster) info() state.ClusterInfo {
232232
return state.ClusterInfoWithStoreCount(bc.Nodes, bc.StoresPerNode)
233233
}
234234

235+
// TODO(wenyihu6): we have the number of nodes and their localities already.
236+
// We could construct ClusterInfo without a ratio calculation. We are doing
237+
// this for now just to reuse ClusterInfoWithDistribution. But there may be
238+
// rounding errors.
235239
regionNodeWeights := make([]float64, len(bc.NodesPerRegion))
236240
totalNodes := 0
237241
for i, nodes := range bc.NodesPerRegion {

0 commit comments

Comments
 (0)