|
@@ -77,7 +77,7 @@ import org.junit.Before;
|
|
|
import org.junit.BeforeClass;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
-import java.util.Arrays;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Locale;
|
|
@@ -227,7 +227,7 @@ public class TransportReplicationActionTests extends ESTestCase {
|
|
|
randomBoolean() ? ShardRoutingState.INITIALIZING : ShardRoutingState.UNASSIGNED));
|
|
|
ReplicationTask task = maybeTask();
|
|
|
|
|
|
- logger.debug("--> using initial state:\n{}", clusterService.state().prettyPrint());
|
|
|
+ logger.debug("--> using initial state:\n{}", clusterService.state());
|
|
|
|
|
|
Request request = new Request(shardId).timeout("1ms");
|
|
|
PlainActionFuture<Response> listener = new PlainActionFuture<>();
|
|
@@ -246,7 +246,7 @@ public class TransportReplicationActionTests extends ESTestCase {
|
|
|
assertTrue(request.isRetrySet.get());
|
|
|
|
|
|
setState(clusterService, state(index, true, ShardRoutingState.STARTED));
|
|
|
- logger.debug("--> primary assigned state:\n{}", clusterService.state().prettyPrint());
|
|
|
+ logger.debug("--> primary assigned state:\n{}", clusterService.state());
|
|
|
|
|
|
final IndexShardRoutingTable shardRoutingTable = clusterService.state().routingTable().index(index).shard(shardId.id());
|
|
|
final String primaryNodeId = shardRoutingTable.primaryShard().currentNodeId();
|
|
@@ -275,7 +275,7 @@ public class TransportReplicationActionTests extends ESTestCase {
|
|
|
String relocationTargetNode = state.getRoutingTable().shardRoutingTable(shardId).primaryShard().relocatingNodeId();
|
|
|
state = ClusterState.builder(state).nodes(DiscoveryNodes.builder(state.nodes()).localNodeId(relocationTargetNode)).build();
|
|
|
setState(clusterService, state);
|
|
|
- logger.debug("--> relocation ongoing state:\n{}", clusterService.state().prettyPrint());
|
|
|
+ logger.debug("--> relocation ongoing state:\n{}", clusterService.state());
|
|
|
|
|
|
Request request = new Request(shardId).timeout("1ms").routedBasedOnClusterVersion(clusterService.state().version() + 1);
|
|
|
PlainActionFuture<Response> listener = new PlainActionFuture<>();
|
|
@@ -295,10 +295,10 @@ public class TransportReplicationActionTests extends ESTestCase {
|
|
|
ShardRouting relocationTarget = clusterService.state().getRoutingTable().shardRoutingTable(shardId)
|
|
|
.shardsWithState(ShardRoutingState.INITIALIZING).get(0);
|
|
|
AllocationService allocationService = ESAllocationTestCase.createAllocationService();
|
|
|
- ClusterState updatedState = allocationService.applyStartedShards(state, Arrays.asList(relocationTarget));
|
|
|
+ ClusterState updatedState = allocationService.applyStartedShards(state, Collections.singletonList(relocationTarget));
|
|
|
|
|
|
setState(clusterService, updatedState);
|
|
|
- logger.debug("--> relocation complete state:\n{}", clusterService.state().prettyPrint());
|
|
|
+ logger.debug("--> relocation complete state:\n{}", clusterService.state());
|
|
|
|
|
|
IndexShardRoutingTable shardRoutingTable = clusterService.state().routingTable().index(index).shard(shardId.id());
|
|
|
final String primaryNodeId = shardRoutingTable.primaryShard().currentNodeId();
|
|
@@ -315,7 +315,7 @@ public class TransportReplicationActionTests extends ESTestCase {
|
|
|
// no replicas in oder to skip the replication part
|
|
|
setState(clusterService, state(index, true,
|
|
|
randomBoolean() ? ShardRoutingState.INITIALIZING : ShardRoutingState.UNASSIGNED));
|
|
|
- logger.debug("--> using initial state:\n{}", clusterService.state().prettyPrint());
|
|
|
+ logger.debug("--> using initial state:\n{}", clusterService.state());
|
|
|
Request request = new Request(new ShardId("unknown_index", "_na_", 0)).timeout("1ms");
|
|
|
PlainActionFuture<Response> listener = new PlainActionFuture<>();
|
|
|
ReplicationTask task = maybeTask();
|
|
@@ -339,7 +339,7 @@ public class TransportReplicationActionTests extends ESTestCase {
|
|
|
final ShardId shardId = new ShardId(index, "_na_", 0);
|
|
|
// no replicas in order to skip the replication part
|
|
|
setState(clusterService, stateWithActivePrimary(index, true, randomInt(3)));
|
|
|
- logger.debug("--> using initial state:\n{}", clusterService.state().prettyPrint());
|
|
|
+ logger.debug("--> using initial state:\n{}", clusterService.state());
|
|
|
Request request = new Request(shardId);
|
|
|
boolean timeout = randomBoolean();
|
|
|
if (timeout) {
|
|
@@ -396,7 +396,7 @@ public class TransportReplicationActionTests extends ESTestCase {
|
|
|
ReplicationTask task = maybeTask();
|
|
|
|
|
|
setState(clusterService, stateWithActivePrimary(index, randomBoolean(), 3));
|
|
|
- logger.debug("using state: \n{}", clusterService.state().prettyPrint());
|
|
|
+ logger.debug("using state: \n{}", clusterService.state());
|
|
|
|
|
|
final IndexShardRoutingTable shardRoutingTable = clusterService.state().routingTable().index(index).shard(shardId.id());
|
|
|
final String primaryNodeId = shardRoutingTable.primaryShard().currentNodeId();
|
|
@@ -545,7 +545,7 @@ public class TransportReplicationActionTests extends ESTestCase {
|
|
|
final String index = "test";
|
|
|
final ShardId shardId = new ShardId(index, "_na_", 0);
|
|
|
ClusterState state = stateWithActivePrimary(index, true, 1 + randomInt(3), randomInt(2));
|
|
|
- logger.info("using state: {}", state.prettyPrint());
|
|
|
+ logger.info("using state: {}", state);
|
|
|
setState(clusterService, state);
|
|
|
|
|
|
// check that at unknown node fails
|
|
@@ -651,7 +651,7 @@ public class TransportReplicationActionTests extends ESTestCase {
|
|
|
// no replica, we only want to test on primary
|
|
|
final ClusterState state = state(index, true, ShardRoutingState.STARTED);
|
|
|
setState(clusterService, state);
|
|
|
- logger.debug("--> using initial state:\n{}", clusterService.state().prettyPrint());
|
|
|
+ logger.debug("--> using initial state:\n{}", clusterService.state());
|
|
|
final ShardRouting primaryShard = state.routingTable().shardRoutingTable(shardId).primaryShard();
|
|
|
Request request = new Request(shardId);
|
|
|
PlainActionFuture<Response> listener = new PlainActionFuture<>();
|