@@ -38,11 +38,10 @@ func TestRunAllocatorSimulator(t *testing.T) {
3838 rwg := make ([]workload.Generator , 1 )
3939 rwg [0 ] = testCreateWorkloadGenerator (start , 1 , 10 )
4040 m := asim .NewMetricsTracker (os .Stdout )
41- exchange := state .NewFixedDelayExhange (start , settings .StateExchangeInterval , settings .StateExchangeDelay )
4241 changer := state .NewReplicaChanger ()
4342 s := state .LoadConfig (state .ComplexConfig )
4443
45- sim := asim .NewSimulator (start , end , interval , interval , rwg , s , exchange , changer , settings , m )
44+ sim := asim .NewSimulator (start , end , interval , interval , rwg , s , changer , settings , m )
4645 sim .RunSim (ctx )
4746}
4847
@@ -67,16 +66,6 @@ func testCreateWorkloadGenerator(start time.Time, stores int, keySpan int64) wor
6766 )
6867}
6968
70- // testPreGossipStores populates the state exchange with the existing state.
71- // This is done at the time given, which should be before the test start time
72- // minus the gossip delay and interval. This alleviates a cold start, where the
73- // allocator for each store does not have information to make a decision for
74- // the ranges it holds leases for.
75- func testPreGossipStores (s state.State , exchange state.Exchange , at time.Time ) {
76- storeDescriptors := s .StoreDescriptors ()
77- exchange .Put (at , storeDescriptors ... )
78- }
79-
8069// TestAllocatorSimulatorSpeed tests that the simulation runs at a rate of at
8170// least 1.67 simulated minutes per wall clock second (1:100) for a 32 node
8271// cluster, with 32000 replicas. The workload is generating 16000 keys per
@@ -96,7 +85,6 @@ func TestAllocatorSimulatorSpeed(t *testing.T) {
9685 end := start .Add (5 * time .Minute )
9786 bgInterval := 10 * time .Second
9887 interval := 2 * time .Second
99- preGossipStart := start .Add (- settings .StateExchangeInterval - settings .StateExchangeDelay )
10088
10189 stores := 32
10290 replsPerRange := 3
@@ -112,7 +100,6 @@ func TestAllocatorSimulatorSpeed(t *testing.T) {
112100 sample := func () int64 {
113101 rwg := make ([]workload.Generator , 1 )
114102 rwg [0 ] = testCreateWorkloadGenerator (start , stores , int64 (keyspace ))
115- exchange := state .NewFixedDelayExhange (preGossipStart , settings .StateExchangeInterval , settings .StateExchangeDelay )
116103 changer := state .NewReplicaChanger ()
117104 m := asim .NewMetricsTracker () // no output
118105 replicaDistribution := make ([]float64 , stores )
@@ -129,8 +116,7 @@ func TestAllocatorSimulatorSpeed(t *testing.T) {
129116 }
130117
131118 s := state .NewTestStateReplDistribution (replicaDistribution , ranges , replsPerRange , keyspace )
132- testPreGossipStores (s , exchange , preGossipStart )
133- sim := asim .NewSimulator (start , end , interval , bgInterval , rwg , s , exchange , changer , settings , m )
119+ sim := asim .NewSimulator (start , end , interval , bgInterval , rwg , s , changer , settings , m )
134120
135121 startTime := timeutil .Now ()
136122 sim .RunSim (ctx )
@@ -169,7 +155,6 @@ func TestAllocatorSimulatorDeterministic(t *testing.T) {
169155 end := start .Add (15 * time .Minute )
170156 bgInterval := 10 * time .Second
171157 interval := 2 * time .Second
172- preGossipStart := start .Add (- settings .StateExchangeInterval - settings .StateExchangeDelay )
173158
174159 stores := 7
175160 replsPerRange := 3
@@ -187,7 +172,6 @@ func TestAllocatorSimulatorDeterministic(t *testing.T) {
187172 for run := 0 ; run < runs ; run ++ {
188173 rwg := make ([]workload.Generator , 1 )
189174 rwg [0 ] = testCreateWorkloadGenerator (start , stores , int64 (keyspace ))
190- exchange := state .NewFixedDelayExhange (preGossipStart , settings .StateExchangeInterval , settings .StateExchangeDelay )
191175 changer := state .NewReplicaChanger ()
192176 m := asim .NewMetricsTracker () // no output
193177 replicaDistribution := make ([]float64 , stores )
@@ -204,12 +188,17 @@ func TestAllocatorSimulatorDeterministic(t *testing.T) {
204188 }
205189
206190 s := state .NewTestStateReplDistribution (replicaDistribution , ranges , replsPerRange , keyspace )
207- testPreGossipStores (s , exchange , preGossipStart )
208- sim := asim .NewSimulator (start , end , interval , bgInterval , rwg , s , exchange , changer , settings , m )
191+ sim := asim .NewSimulator (start , end , interval , bgInterval , rwg , s , changer , settings , m )
209192
210193 ctx := context .Background ()
211194 sim .RunSim (ctx )
212- descs := s .StoreDescriptors ()
195+
196+ storeRefs := s .Stores ()
197+ storeIDs := make ([]state.StoreID , len (storeRefs ))
198+ for i , store := range storeRefs {
199+ storeIDs [i ] = store .StoreID ()
200+ }
201+ descs := s .StoreDescriptors (false /* cached */ , storeIDs ... )
213202
214203 if run == 0 {
215204 refRun = descs
0 commit comments