15
15
import org .elasticsearch .action .admin .indices .stats .IndicesStatsAction ;
16
16
import org .elasticsearch .action .admin .indices .stats .ShardStats ;
17
17
import org .elasticsearch .action .admin .indices .stats .TransportIndicesStatsAction ;
18
- import org .elasticsearch .cluster .ClusterInfoService ;
19
- import org .elasticsearch .cluster .ClusterInfoServiceUtils ;
20
- import org .elasticsearch .cluster .InternalClusterInfoService ;
21
18
import org .elasticsearch .cluster .NodeUsageStatsForThreadPools ;
22
19
import org .elasticsearch .cluster .metadata .IndexMetadata ;
23
20
import org .elasticsearch .cluster .node .DiscoveryNode ;
@@ -241,7 +238,7 @@ public void testHighNodeWriteLoadPreventsNewShardAllocation() {
241
238
*/
242
239
243
240
logger .info ("---> Refreshing the cluster info to pull in the dummy thread pool stats with a hot-spotting node" );
244
- refreshClusterInfo (masterName );
241
+ refreshClusterInfo ();
245
242
246
243
logger .info (
247
244
"---> Update the filter to exclude " + firstDataNodeName + " so that shards will be reassigned away to the other nodes"
@@ -271,12 +268,10 @@ public void testMaxQueueLatencyMetricIsPublished() {
271
268
WriteLoadConstraintSettings .WriteLoadDeciderStatus .ENABLED
272
269
)
273
270
.build ();
274
- final String masterName = internalCluster ().startMasterOnlyNode (settings );
275
- final var dataNodes = internalCluster ().startDataOnlyNodes (2 , settings );
276
- ensureStableCluster (3 );
271
+ final var dataNodes = internalCluster ().startNodes (3 , settings );
277
272
278
273
// Refresh cluster info (should trigger polling)
279
- refreshClusterInfo (masterName );
274
+ refreshClusterInfo ();
280
275
281
276
Map <String , Long > mostRecentQueueLatencyMetrics = getMostRecentQueueLatencyMetrics (dataNodes );
282
277
assertThat (mostRecentQueueLatencyMetrics .keySet (), hasSize (dataNodes .size ()));
@@ -295,20 +290,12 @@ public void testMaxQueueLatencyMetricIsPublished() {
295
290
// Unblock the pool
296
291
latch .countDown ();
297
292
298
- refreshClusterInfo (masterName );
293
+ refreshClusterInfo ();
299
294
mostRecentQueueLatencyMetrics = getMostRecentQueueLatencyMetrics (dataNodes );
300
295
assertThat (mostRecentQueueLatencyMetrics .keySet (), hasSize (dataNodes .size ()));
301
296
assertThat (mostRecentQueueLatencyMetrics .get (dataNodeToDelay ), greaterThanOrEqualTo (delayMillis ));
302
297
}
303
298
304
- private static void refreshClusterInfo (String masterName ) {
305
- final InternalClusterInfoService clusterInfoService = asInstanceOf (
306
- InternalClusterInfoService .class ,
307
- internalCluster ().getInstance (ClusterInfoService .class , masterName )
308
- );
309
- ClusterInfoServiceUtils .refresh (clusterInfoService );
310
- }
311
-
312
299
private static Map <String , Long > getMostRecentQueueLatencyMetrics (List <String > dataNodes ) {
313
300
final Map <String , Long > measurements = new HashMap <>();
314
301
for (String nodeName : dataNodes ) {
0 commit comments