Skip to content

Commit 955aee8

Browse files
committed
More logging in testRerouteOccursOnDiskPassingHighWatermark (#42864)
This test is failing because recoveries of these empty shards are not completing in a reasonable time, but the reason for this is still obscure. This commit adds yet more logging. Relates #40174, #42424
1 parent 00f01aa commit 955aee8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

server/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.elasticsearch.cluster.routing.allocation.decider;
2121

22+
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
2223
import org.elasticsearch.cluster.ClusterInfo;
2324
import org.elasticsearch.cluster.ClusterInfoService;
2425
import org.elasticsearch.cluster.ClusterState;
@@ -30,6 +31,7 @@
3031
import org.elasticsearch.common.unit.TimeValue;
3132
import org.elasticsearch.plugins.Plugin;
3233
import org.elasticsearch.test.ESIntegTestCase;
34+
import org.elasticsearch.test.junit.annotations.TestLogging;
3335

3436
import java.util.ArrayList;
3537
import java.util.Collection;
@@ -51,6 +53,7 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
5153
return Collections.singletonList(MockInternalClusterInfoService.TestPlugin.class);
5254
}
5355

56+
@TestLogging("org.elasticsearch.indices.recovery:TRACE,org.elasticsearch.cluster.service:TRACE")
5457
public void testRerouteOccursOnDiskPassingHighWatermark() throws Exception {
5558
List<String> nodes = internalCluster().startNodes(3);
5659

@@ -98,10 +101,16 @@ public void testRerouteOccursOnDiskPassingHighWatermark() throws Exception {
98101
cis.setN2Usage(realNodeNames.get(1), new DiskUsage(nodes.get(1), "n2", "_na_", 100, 50));
99102
cis.setN3Usage(realNodeNames.get(2), new DiskUsage(nodes.get(2), "n3", "_na_", 100, 0)); // nothing free on node3
100103

104+
logger.info("--> waiting for shards to relocate off node [{}]", realNodeNames.get(2));
105+
101106
assertBusy(() -> {
102107
final ClusterState clusterState = client().admin().cluster().prepareState().get().getState();
103108
logger.info("--> {}", clusterState.routingTable());
104109

110+
final RecoveryResponse recoveryResponse = client().admin().indices()
111+
.prepareRecoveries("test").setActiveOnly(true).setDetailed(true).get();
112+
logger.info("--> recoveries: {}", recoveryResponse);
113+
105114
final Map<String, Integer> nodesToShardCount = new HashMap<>();
106115
for (final RoutingNode node : clusterState.getRoutingNodes()) {
107116
logger.info("--> node {} has {} shards",
@@ -118,6 +127,8 @@ public void testRerouteOccursOnDiskPassingHighWatermark() throws Exception {
118127
cis.setN2Usage(realNodeNames.get(1), new DiskUsage(nodes.get(1), "n2", "_na_", 100, 50));
119128
cis.setN3Usage(realNodeNames.get(2), new DiskUsage(nodes.get(2), "n3", "_na_", 100, 50)); // node3 has free space now
120129

130+
logger.info("--> waiting for shards to rebalance back onto node [{}]", realNodeNames.get(2));
131+
121132
assertBusy(() -> {
122133
final Map<String, Integer> nodesToShardCount = new HashMap<>();
123134
final ClusterState clusterState = client().admin().cluster().prepareState().get().getState();

0 commit comments

Comments
 (0)