Search in sources :

Example 1 with SETTING_NUMBER_OF_SHARDS

use of org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS in project OpenSearch by opensearch-project.

the class MetadataCreateIndexServiceTests method testTemplateOrder.

public void testTemplateOrder() throws Exception {
    List<IndexTemplateMetadata> templates = new ArrayList<>(3);
    templates.add(addMatchingTemplate(builder -> builder.order(3).settings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 12)).putAlias(AliasMetadata.builder("alias1").writeIndex(true).searchRouting("3").build())));
    templates.add(addMatchingTemplate(builder -> builder.order(2).settings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 11)).putAlias(AliasMetadata.builder("alias1").searchRouting("2").build())));
    templates.add(addMatchingTemplate(builder -> builder.order(1).settings(Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 10)).putAlias(AliasMetadata.builder("alias1").searchRouting("1").build())));
    Settings aggregatedIndexSettings = aggregateIndexSettings(ClusterState.EMPTY_STATE, request, MetadataIndexTemplateService.resolveSettings(templates), null, Settings.EMPTY, IndexScopedSettings.DEFAULT_SCOPED_SETTINGS, randomShardLimitService(), Collections.emptySet());
    List<AliasMetadata> resolvedAliases = resolveAndValidateAliases(request.index(), request.aliases(), MetadataIndexTemplateService.resolveAliases(templates), Metadata.builder().build(), aliasValidator, xContentRegistry(), queryShardContext);
    assertThat(aggregatedIndexSettings.get(SETTING_NUMBER_OF_SHARDS), equalTo("12"));
    AliasMetadata alias = resolvedAliases.get(0);
    assertThat(alias.getSearchRouting(), equalTo("3"));
    assertThat(alias.writeIndex(), is(true));
}
Also used : ImmutableOpenMap(org.opensearch.common.collect.ImmutableOpenMap) Arrays(java.util.Arrays) MetadataCreateIndexService.resolveAndValidateAliases(org.opensearch.cluster.metadata.MetadataCreateIndexService.resolveAndValidateAliases) IndexScopedSettings(org.opensearch.common.settings.IndexScopedSettings) AllocationService(org.opensearch.cluster.routing.allocation.AllocationService) TestThreadPool(org.opensearch.threadpool.TestThreadPool) INDEX_NUMBER_OF_SHARDS_SETTING(org.opensearch.cluster.metadata.IndexMetadata.INDEX_NUMBER_OF_SHARDS_SETTING) Version(org.opensearch.Version) MetadataCreateIndexService.getIndexNumberOfRoutingShards(org.opensearch.cluster.metadata.MetadataCreateIndexService.getIndexNumberOfRoutingShards) Matchers.hasValue(org.hamcrest.Matchers.hasValue) INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING(org.opensearch.cluster.metadata.IndexMetadata.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING) Strings(org.opensearch.common.Strings) Collections.singletonList(java.util.Collections.singletonList) INDEX_SOFT_DELETES_SETTING(org.opensearch.index.IndexSettings.INDEX_SOFT_DELETES_SETTING) Alias(org.opensearch.action.admin.indices.alias.Alias) OpenSearchAllocationTestCase(org.opensearch.cluster.OpenSearchAllocationTestCase) Map(java.util.Map) Matchers.nullValue(org.hamcrest.Matchers.nullValue) IndexModule(org.opensearch.index.IndexModule) AllocationDeciders(org.opensearch.cluster.routing.allocation.decider.AllocationDeciders) TimeValue(org.opensearch.common.unit.TimeValue) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) Index(org.opensearch.index.Index) MetadataCreateIndexService.parseV1Mappings(org.opensearch.cluster.metadata.MetadataCreateIndexService.parseV1Mappings) ExceptionsHelper(org.opensearch.ExceptionsHelper) Set(java.util.Set) Settings(org.opensearch.common.settings.Settings) DiscoveryNodeRole(org.opensearch.cluster.node.DiscoveryNodeRole) Matchers.startsWith(org.hamcrest.Matchers.startsWith) Stream(java.util.stream.Stream) SystemIndexDescriptor(org.opensearch.indices.SystemIndexDescriptor) Matchers.is(org.hamcrest.Matchers.is) Matchers.endsWith(org.hamcrest.Matchers.endsWith) MetadataCreateIndexService.aggregateIndexSettings(org.opensearch.cluster.metadata.MetadataCreateIndexService.aggregateIndexSettings) ThreadPool(org.opensearch.threadpool.ThreadPool) ArrayList(java.util.ArrayList) ClusterState(org.opensearch.cluster.ClusterState) LegacyESVersion(org.opensearch.LegacyESVersion) VersionUtils(org.opensearch.test.VersionUtils) INDEX_READ_ONLY_BLOCK(org.opensearch.cluster.metadata.IndexMetadata.INDEX_READ_ONLY_BLOCK) BiConsumer(java.util.function.BiConsumer) ClusterBlocks(org.opensearch.cluster.block.ClusterBlocks) TestGatewayAllocator(org.opensearch.test.gateway.TestGatewayAllocator) Before(org.junit.Before) Environment(org.opensearch.env.Environment) IOException(java.io.IOException) SystemIndices(org.opensearch.indices.SystemIndices) NamedXContentRegistry(org.opensearch.common.xcontent.NamedXContentRegistry) ClusterService(org.opensearch.cluster.service.ClusterService) RoutingTable(org.opensearch.cluster.routing.RoutingTable) SETTING_NUMBER_OF_SHARDS(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS) CreateIndexClusterStateUpdateRequest(org.opensearch.action.admin.indices.create.CreateIndexClusterStateUpdateRequest) InvalidAliasNameException(org.opensearch.indices.InvalidAliasNameException) SETTING_VERSION_CREATED(org.opensearch.cluster.metadata.IndexMetadata.SETTING_VERSION_CREATED) BiFunction(java.util.function.BiFunction) Matchers.hasKey(org.hamcrest.Matchers.hasKey) ObjectObjectCursor(com.carrotsearch.hppc.cursors.ObjectObjectCursor) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) MapperService(org.opensearch.index.mapper.MapperService) Collections.singleton(java.util.Collections.singleton) XContentFactory(org.opensearch.common.xcontent.XContentFactory) BalancedShardsAllocator(org.opensearch.cluster.routing.allocation.allocator.BalancedShardsAllocator) SETTING_NUMBER_OF_REPLICAS(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS) Collections.emptyList(java.util.Collections.emptyList) OpenSearchTestCase(org.opensearch.test.OpenSearchTestCase) Collection(java.util.Collection) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) MetadataCreateIndexService.clusterStateCreateIndex(org.opensearch.cluster.metadata.MetadataCreateIndexService.clusterStateCreateIndex) SETTING_READ_ONLY(org.opensearch.cluster.metadata.IndexMetadata.SETTING_READ_ONLY) InvalidIndexNameException(org.opensearch.indices.InvalidIndexNameException) List(java.util.List) ShardLimitValidatorTests.createTestShardLimitService(org.opensearch.indices.ShardLimitValidatorTests.createTestShardLimitService) Matchers.equalTo(org.hamcrest.Matchers.equalTo) EmptyClusterInfoService(org.opensearch.cluster.EmptyClusterInfoService) IndexSettings(org.opensearch.index.IndexSettings) QueryShardContext(org.opensearch.index.query.QueryShardContext) ResourceAlreadyExistsException(org.opensearch.ResourceAlreadyExistsException) BigArrays(org.opensearch.common.util.BigArrays) ClusterServiceUtils(org.opensearch.test.ClusterServiceUtils) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) CompressedXContent(org.opensearch.common.compress.CompressedXContent) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) HashSet(java.util.HashSet) Collections.singletonMap(java.util.Collections.singletonMap) Collections.emptyMap(java.util.Collections.emptyMap) ResizeType(org.opensearch.action.admin.indices.shrink.ResizeType) Setting(org.opensearch.common.settings.Setting) ShardLimitValidator(org.opensearch.indices.ShardLimitValidator) MaxRetryAllocationDecider(org.opensearch.cluster.routing.allocation.decider.MaxRetryAllocationDecider) IndexNotFoundException(org.opensearch.index.IndexNotFoundException) Matchers(org.hamcrest.Matchers) Consumer(java.util.function.Consumer) EmptySnapshotsInfoService(org.opensearch.snapshots.EmptySnapshotsInfoService) ClusterName(org.opensearch.cluster.ClusterName) Comparator(java.util.Comparator) Collections(java.util.Collections) MetadataCreateIndexService.buildIndexMetadata(org.opensearch.cluster.metadata.MetadataCreateIndexService.buildIndexMetadata) ArrayList(java.util.ArrayList) IndexScopedSettings(org.opensearch.common.settings.IndexScopedSettings) Settings(org.opensearch.common.settings.Settings) MetadataCreateIndexService.aggregateIndexSettings(org.opensearch.cluster.metadata.MetadataCreateIndexService.aggregateIndexSettings) IndexSettings(org.opensearch.index.IndexSettings)

Example 2 with SETTING_NUMBER_OF_SHARDS

use of org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS in project OpenSearch by opensearch-project.

the class AutoExpandReplicasTests method testAutoExpandWhenNodeLeavesAndPossiblyRejoins.

/**
 * Checks that when nodes leave the cluster that the auto-expand-replica functionality only triggers after failing the shards on
 * the removed nodes. This ensures that active shards on other live nodes are not failed if the primary resided on a now dead node.
 * Instead, one of the replicas on the live nodes first gets promoted to primary, and the auto-expansion (removing replicas) only
 * triggers in a follow-up step.
 */
public void testAutoExpandWhenNodeLeavesAndPossiblyRejoins() throws InterruptedException {
    final ThreadPool threadPool = new TestThreadPool(getClass().getName());
    final ClusterStateChanges cluster = new ClusterStateChanges(xContentRegistry(), threadPool);
    try {
        List<DiscoveryNode> allNodes = new ArrayList<>();
        // local node is the master
        DiscoveryNode localNode = createNode(DiscoveryNodeRole.MASTER_ROLE);
        allNodes.add(localNode);
        int numDataNodes = randomIntBetween(3, 5);
        List<DiscoveryNode> dataNodes = new ArrayList<>(numDataNodes);
        for (int i = 0; i < numDataNodes; i++) {
            dataNodes.add(createNode(DiscoveryNodeRole.DATA_ROLE));
        }
        allNodes.addAll(dataNodes);
        ClusterState state = ClusterStateCreationUtils.state(localNode, localNode, allNodes.toArray(new DiscoveryNode[0]));
        CreateIndexRequest request = new CreateIndexRequest("index", Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_AUTO_EXPAND_REPLICAS, "0-all").build()).waitForActiveShards(ActiveShardCount.NONE);
        state = cluster.createIndex(state, request);
        assertTrue(state.metadata().hasIndex("index"));
        while (state.routingTable().index("index").shard(0).allShardsStarted() == false) {
            logger.info(state);
            state = cluster.applyStartedShards(state, state.routingTable().index("index").shard(0).shardsWithState(ShardRoutingState.INITIALIZING));
            state = cluster.reroute(state, new ClusterRerouteRequest());
        }
        IndexShardRoutingTable preTable = state.routingTable().index("index").shard(0);
        final Set<String> unchangedNodeIds;
        final IndexShardRoutingTable postTable;
        if (randomBoolean()) {
            // simulate node removal
            List<DiscoveryNode> nodesToRemove = randomSubsetOf(2, dataNodes);
            unchangedNodeIds = dataNodes.stream().filter(n -> nodesToRemove.contains(n) == false).map(DiscoveryNode::getId).collect(Collectors.toSet());
            state = cluster.removeNodes(state, nodesToRemove);
            postTable = state.routingTable().index("index").shard(0);
            assertTrue("not all shards started in " + state.toString(), postTable.allShardsStarted());
            assertThat(postTable.toString(), postTable.getAllAllocationIds(), everyItem(is(in(preTable.getAllAllocationIds()))));
        } else {
            // fake an election where conflicting nodes are removed and readded
            state = ClusterState.builder(state).nodes(DiscoveryNodes.builder(state.nodes()).masterNodeId(null).build()).build();
            List<DiscoveryNode> conflictingNodes = randomSubsetOf(2, dataNodes);
            unchangedNodeIds = dataNodes.stream().filter(n -> conflictingNodes.contains(n) == false).map(DiscoveryNode::getId).collect(Collectors.toSet());
            List<DiscoveryNode> nodesToAdd = conflictingNodes.stream().map(n -> new DiscoveryNode(n.getName(), n.getId(), buildNewFakeTransportAddress(), n.getAttributes(), n.getRoles(), n.getVersion())).collect(Collectors.toList());
            if (randomBoolean()) {
                nodesToAdd.add(createNode(DiscoveryNodeRole.DATA_ROLE));
            }
            state = cluster.joinNodesAndBecomeMaster(state, nodesToAdd);
            postTable = state.routingTable().index("index").shard(0);
        }
        Set<String> unchangedAllocationIds = preTable.getShards().stream().filter(shr -> unchangedNodeIds.contains(shr.currentNodeId())).map(shr -> shr.allocationId().getId()).collect(Collectors.toSet());
        assertThat(postTable.toString(), unchangedAllocationIds, everyItem(is(in(postTable.getAllAllocationIds()))));
        postTable.getShards().forEach(shardRouting -> {
            if (shardRouting.assignedToNode() && unchangedAllocationIds.contains(shardRouting.allocationId().getId())) {
                assertTrue("Shard should be active: " + shardRouting, shardRouting.active());
            }
        });
    } finally {
        terminate(threadPool);
    }
}
Also used : DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) UpdateSettingsRequest(org.opensearch.action.admin.indices.settings.put.UpdateSettingsRequest) SETTING_AUTO_EXPAND_REPLICAS(org.opensearch.cluster.metadata.IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS) ThreadPool(org.opensearch.threadpool.ThreadPool) TestThreadPool(org.opensearch.threadpool.TestThreadPool) ClusterStateChanges(org.opensearch.indices.cluster.ClusterStateChanges) Version(org.opensearch.Version) ClusterRerouteRequest(org.opensearch.action.admin.cluster.reroute.ClusterRerouteRequest) ClusterStateCreationUtils(org.opensearch.action.support.replication.ClusterStateCreationUtils) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ClusterState(org.opensearch.cluster.ClusterState) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) LegacyESVersion(org.opensearch.LegacyESVersion) Matchers.everyItem(org.hamcrest.Matchers.everyItem) VersionUtils(org.opensearch.test.VersionUtils) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Locale(java.util.Locale) ShardRoutingState(org.opensearch.cluster.routing.ShardRoutingState) CreateIndexRequest(org.opensearch.action.admin.indices.create.CreateIndexRequest) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) OpenSearchTestCase(org.opensearch.test.OpenSearchTestCase) Set(java.util.Set) Settings(org.opensearch.common.settings.Settings) DiscoveryNodeRole(org.opensearch.cluster.node.DiscoveryNodeRole) Collectors(java.util.stream.Collectors) ActiveShardCount(org.opensearch.action.support.ActiveShardCount) List(java.util.List) Matchers.equalTo(org.hamcrest.Matchers.equalTo) SETTING_NUMBER_OF_SHARDS(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS) Matchers.is(org.hamcrest.Matchers.is) Collections(java.util.Collections) Matchers.in(org.hamcrest.Matchers.in) ClusterState(org.opensearch.cluster.ClusterState) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) ThreadPool(org.opensearch.threadpool.ThreadPool) TestThreadPool(org.opensearch.threadpool.TestThreadPool) ArrayList(java.util.ArrayList) TestThreadPool(org.opensearch.threadpool.TestThreadPool) ClusterStateChanges(org.opensearch.indices.cluster.ClusterStateChanges) ClusterRerouteRequest(org.opensearch.action.admin.cluster.reroute.ClusterRerouteRequest) CreateIndexRequest(org.opensearch.action.admin.indices.create.CreateIndexRequest)

Example 3 with SETTING_NUMBER_OF_SHARDS

use of org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS in project OpenSearch by opensearch-project.

the class TransportReplicationAllPermitsAcquisitionTests method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    globalBlock = randomBoolean();
    RestStatus restStatus = randomFrom(RestStatus.values());
    block = new ClusterBlock(randomIntBetween(1, 10), randomAlphaOfLength(5), false, true, false, restStatus, ClusterBlockLevel.ALL);
    clusterService = createClusterService(threadPool);
    final ClusterState.Builder state = ClusterState.builder(clusterService.state());
    Set<DiscoveryNodeRole> roles = new HashSet<>(DiscoveryNodeRole.BUILT_IN_ROLES);
    DiscoveryNode node1 = new DiscoveryNode("_name1", "_node1", buildNewFakeTransportAddress(), emptyMap(), roles, Version.CURRENT);
    DiscoveryNode node2 = new DiscoveryNode("_name2", "_node2", buildNewFakeTransportAddress(), emptyMap(), roles, Version.CURRENT);
    state.nodes(DiscoveryNodes.builder().add(node1).add(node2).localNodeId(node1.getId()).masterNodeId(node1.getId()));
    shardId = new ShardId("index", UUID.randomUUID().toString(), 0);
    ShardRouting shardRouting = newShardRouting(shardId, node1.getId(), true, ShardRoutingState.INITIALIZING, RecoverySource.EmptyStoreRecoverySource.INSTANCE);
    Settings indexSettings = Settings.builder().put(SETTING_VERSION_CREATED, Version.CURRENT).put(SETTING_INDEX_UUID, shardId.getIndex().getUUID()).put(SETTING_NUMBER_OF_SHARDS, 1).put(SETTING_NUMBER_OF_REPLICAS, 1).put(SETTING_CREATION_DATE, System.currentTimeMillis()).build();
    primary = newStartedShard(p -> newShard(shardRouting, indexSettings, new InternalEngineFactory()), true);
    for (int i = 0; i < 10; i++) {
        final String id = Integer.toString(i);
        indexDoc(primary, "_doc", id, "{\"value\":" + id + "}");
    }
    IndexMetadata indexMetadata = IndexMetadata.builder(shardId.getIndexName()).settings(indexSettings).primaryTerm(shardId.id(), primary.getOperationPrimaryTerm()).putMapping("_doc", "{ \"properties\": { \"value\":  { \"type\": \"short\"}}}").build();
    state.metadata(Metadata.builder().put(indexMetadata, false).generateClusterUuidIfNeeded());
    replica = newShard(primary.shardId(), false, node2.getId(), indexMetadata, null);
    recoverReplica(replica, primary, true);
    IndexRoutingTable.Builder routing = IndexRoutingTable.builder(indexMetadata.getIndex());
    routing.addIndexShard(new IndexShardRoutingTable.Builder(shardId).addShard(primary.routingEntry()).build());
    state.routingTable(RoutingTable.builder().add(routing.build()).build());
    setState(clusterService, state.build());
    final Settings transportSettings = Settings.builder().put("node.name", node1.getId()).build();
    MockTransport transport = new MockTransport() {

        @Override
        protected void onSendRequest(long requestId, String action, TransportRequest request, DiscoveryNode node) {
            assertThat(action, allOf(startsWith("cluster:admin/test/"), endsWith("[r]")));
            assertThat(node, equalTo(node2));
            // node2 doesn't really exist, but we are performing some trickery in mockIndicesService() to pretend that node1 holds both
            // the primary and the replica, so redirect the request back to node1.
            transportService.sendRequest(transportService.getLocalNode(), action, request, new TransportResponseHandler<TransportReplicationAction.ReplicaResponse>() {

                @Override
                public TransportReplicationAction.ReplicaResponse read(StreamInput in) throws IOException {
                    return new TransportReplicationAction.ReplicaResponse(in);
                }

                @SuppressWarnings("unchecked")
                private TransportResponseHandler<TransportReplicationAction.ReplicaResponse> getResponseHandler() {
                    return (TransportResponseHandler<TransportReplicationAction.ReplicaResponse>) getResponseHandlers().onResponseReceived(requestId, TransportMessageListener.NOOP_LISTENER);
                }

                @Override
                public void handleResponse(TransportReplicationAction.ReplicaResponse response) {
                    getResponseHandler().handleResponse(response);
                }

                @Override
                public void handleException(TransportException exp) {
                    getResponseHandler().handleException(exp);
                }

                @Override
                public String executor() {
                    return ThreadPool.Names.SAME;
                }
            });
        }
    };
    transportService = transport.createTransportService(transportSettings, threadPool, TransportService.NOOP_TRANSPORT_INTERCEPTOR, bta -> node1, null, emptySet());
    transportService.start();
    transportService.acceptIncomingRequests();
    shardStateAction = new ShardStateAction(clusterService, transportService, null, null, threadPool);
}
Also used : Metadata(org.opensearch.cluster.metadata.Metadata) SETTING_VERSION_CREATED(org.opensearch.cluster.metadata.IndexMetadata.SETTING_VERSION_CREATED) Version(org.opensearch.Version) ClusterServiceUtils.setState(org.opensearch.test.ClusterServiceUtils.setState) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) IndexShardTestCase(org.opensearch.index.shard.IndexShardTestCase) ClusterBlock(org.opensearch.cluster.block.ClusterBlock) PlainActionFuture(org.opensearch.action.support.PlainActionFuture) After(org.junit.After) Matchers.nullValue(org.hamcrest.Matchers.nullValue) ActionListener(org.opensearch.action.ActionListener) SETTING_NUMBER_OF_REPLICAS(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS) ShardStateAction(org.opensearch.cluster.action.shard.ShardStateAction) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) CyclicBarrier(java.util.concurrent.CyclicBarrier) TimeValue(org.opensearch.common.unit.TimeValue) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) Matchers.allOf(org.hamcrest.Matchers.allOf) IndicesService(org.opensearch.indices.IndicesService) ClusterBlockException(org.opensearch.cluster.block.ClusterBlockException) Set(java.util.Set) Settings(org.opensearch.common.settings.Settings) UUID(java.util.UUID) DiscoveryNodeRole(org.opensearch.cluster.node.DiscoveryNodeRole) RestStatus(org.opensearch.rest.RestStatus) TransportService(org.opensearch.transport.TransportService) Matchers.startsWith(org.hamcrest.Matchers.startsWith) Objects(java.util.Objects) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) ActionFilters(org.opensearch.action.support.ActionFilters) List(java.util.List) Matchers.equalTo(org.hamcrest.Matchers.equalTo) SETTING_CREATION_DATE(org.opensearch.cluster.metadata.IndexMetadata.SETTING_CREATION_DATE) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) Matchers.is(org.hamcrest.Matchers.is) Matchers.endsWith(org.hamcrest.Matchers.endsWith) TransportException(org.opensearch.transport.TransportException) Mockito.mock(org.mockito.Mockito.mock) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) ThreadPool(org.opensearch.threadpool.ThreadPool) TestShardRouting.newShardRouting(org.opensearch.cluster.routing.TestShardRouting.newShardRouting) SETTING_INDEX_UUID(org.opensearch.cluster.metadata.IndexMetadata.SETTING_INDEX_UUID) Releasable(org.opensearch.common.lease.Releasable) ArrayList(java.util.ArrayList) RecoverySource(org.opensearch.cluster.routing.RecoverySource) HashSet(java.util.HashSet) IndexRoutingTable(org.opensearch.cluster.routing.IndexRoutingTable) ClusterState(org.opensearch.cluster.ClusterState) IndexShard(org.opensearch.index.shard.IndexShard) MockTransport(org.opensearch.test.transport.MockTransport) ShardRoutingState(org.opensearch.cluster.routing.ShardRoutingState) ClusterBlocks(org.opensearch.cluster.block.ClusterBlocks) Before(org.junit.Before) StreamInput(org.opensearch.common.io.stream.StreamInput) InternalEngineFactory(org.opensearch.index.engine.InternalEngineFactory) Collections.emptyMap(java.util.Collections.emptyMap) ClusterServiceUtils.createClusterService(org.opensearch.test.ClusterServiceUtils.createClusterService) SetOnce(org.apache.lucene.util.SetOnce) TransportRequest(org.opensearch.transport.TransportRequest) Collections.emptySet(java.util.Collections.emptySet) ClusterBlockLevel(org.opensearch.cluster.block.ClusterBlockLevel) TransportResponseHandler(org.opensearch.transport.TransportResponseHandler) IOException(java.io.IOException) BrokenBarrierException(java.util.concurrent.BrokenBarrierException) Mockito.when(org.mockito.Mockito.when) IndexService(org.opensearch.index.IndexService) TransportMessageListener(org.opensearch.transport.TransportMessageListener) ShardRouting(org.opensearch.cluster.routing.ShardRouting) ShardId(org.opensearch.index.shard.ShardId) ExecutionException(java.util.concurrent.ExecutionException) Matchers.hasItem(org.hamcrest.Matchers.hasItem) ClusterService(org.opensearch.cluster.service.ClusterService) RoutingTable(org.opensearch.cluster.routing.RoutingTable) SETTING_NUMBER_OF_SHARDS(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS) IndexRoutingTable(org.opensearch.cluster.routing.IndexRoutingTable) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) DiscoveryNodeRole(org.opensearch.cluster.node.DiscoveryNodeRole) ShardStateAction(org.opensearch.cluster.action.shard.ShardStateAction) ClusterBlock(org.opensearch.cluster.block.ClusterBlock) ShardId(org.opensearch.index.shard.ShardId) InternalEngineFactory(org.opensearch.index.engine.InternalEngineFactory) MockTransport(org.opensearch.test.transport.MockTransport) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) Settings(org.opensearch.common.settings.Settings) HashSet(java.util.HashSet) ClusterState(org.opensearch.cluster.ClusterState) TransportRequest(org.opensearch.transport.TransportRequest) TransportResponseHandler(org.opensearch.transport.TransportResponseHandler) IOException(java.io.IOException) TransportException(org.opensearch.transport.TransportException) RestStatus(org.opensearch.rest.RestStatus) StreamInput(org.opensearch.common.io.stream.StreamInput) TestShardRouting.newShardRouting(org.opensearch.cluster.routing.TestShardRouting.newShardRouting) ShardRouting(org.opensearch.cluster.routing.ShardRouting) Before(org.junit.Before)

Aggregations

ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Set (java.util.Set)3 Matchers.equalTo (org.hamcrest.Matchers.equalTo)3 Matchers.is (org.hamcrest.Matchers.is)3 Version (org.opensearch.Version)3 ClusterState (org.opensearch.cluster.ClusterState)3 IOException (java.io.IOException)2 Collections (java.util.Collections)2 Collections.emptyMap (java.util.Collections.emptyMap)2 UUID (java.util.UUID)2 Collectors (java.util.stream.Collectors)2 LegacyESVersion (org.opensearch.LegacyESVersion)2 SETTING_NUMBER_OF_SHARDS (org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS)2 DiscoveryNode (org.opensearch.cluster.node.DiscoveryNode)2 DiscoveryNodeRole (org.opensearch.cluster.node.DiscoveryNodeRole)2 DiscoveryNodes (org.opensearch.cluster.node.DiscoveryNodes)2 Settings (org.opensearch.common.settings.Settings)2 OpenSearchTestCase (org.opensearch.test.OpenSearchTestCase)2