Search in sources :

Example 16 with IndexRoutingTable

use of org.opensearch.cluster.routing.IndexRoutingTable in project OpenSearch by opensearch-project.

the class ClusterStateTests method testToXContent.

public void testToXContent() throws IOException {
    final ClusterState clusterState = buildClusterState();
    IndexRoutingTable index = clusterState.getRoutingTable().getIndicesRouting().get("index");
    String ephemeralId = clusterState.getNodes().get("nodeId1").getEphemeralId();
    String allocationId = index.getShards().get(1).getAllAllocationIds().iterator().next();
    XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint();
    builder.startObject();
    clusterState.toXContent(builder, new ToXContent.MapParams(singletonMap(Metadata.CONTEXT_MODE_PARAM, Metadata.CONTEXT_MODE_API)));
    builder.endObject();
    assertEquals("{\n" + "  \"cluster_uuid\" : \"clusterUUID\",\n" + "  \"version\" : 0,\n" + "  \"state_uuid\" : \"stateUUID\",\n" + "  \"master_node\" : \"masterNodeId\",\n" + "  \"blocks\" : {\n" + "    \"global\" : {\n" + "      \"1\" : {\n" + "        \"description\" : \"description\",\n" + "        \"retryable\" : true,\n" + "        \"disable_state_persistence\" : true,\n" + "        \"levels\" : [\n" + "          \"read\",\n" + "          \"write\",\n" + "          \"metadata_read\",\n" + "          \"metadata_write\"\n" + "        ]\n" + "      }\n" + "    },\n" + "    \"indices\" : {\n" + "      \"index\" : {\n" + "        \"2\" : {\n" + "          \"description\" : \"description2\",\n" + "          \"retryable\" : false,\n" + "          \"levels\" : [\n" + "            \"read\",\n" + "            \"write\",\n" + "            \"metadata_read\",\n" + "            \"metadata_write\"\n" + "          ]\n" + "        }\n" + "      }\n" + "    }\n" + "  },\n" + "  \"nodes\" : {\n" + "    \"nodeId1\" : {\n" + "      \"name\" : \"\",\n" + "      \"ephemeral_id\" : \"" + ephemeralId + "\",\n" + "      \"transport_address\" : \"127.0.0.1:111\",\n" + "      \"attributes\" : { }\n" + "    }\n" + "  },\n" + "  \"metadata\" : {\n" + "    \"cluster_uuid\" : \"clusterUUID\",\n" + "    \"cluster_uuid_committed\" : false,\n" + "    \"cluster_coordination\" : {\n" + "      \"term\" : 1,\n" + "      \"last_committed_config\" : [\n" + "        \"commitedConfigurationNodeId\"\n" + "      ],\n" + "      \"last_accepted_config\" : [\n" + "        \"acceptedConfigurationNodeId\"\n" + "      ],\n" + "      \"voting_config_exclusions\" : [\n" + "        {\n" + "          \"node_id\" : \"exlucdedNodeId\",\n" + "          \"node_name\" : \"excludedNodeName\"\n" + "        }\n" + "      ]\n" + "    },\n" + "    \"templates\" : {\n" + "      \"template\" : {\n" + "        \"order\" : 0,\n" + "        \"index_patterns\" : [\n" + "          \"pattern1\",\n" + "          \"pattern2\"\n" + "        ],\n" + "        \"settings\" : {\n" + "          \"index\" : {\n" + "            \"version\" : {\n" + "              \"created\" : \"" + Version.CURRENT.id + "\"\n" + "            }\n" + "          }\n" + "        },\n" + "        \"mappings\" : {\n" + "          \"type\" : {\n" + "            \"key1\" : { }\n" + "          }\n" + "        },\n" + "        \"aliases\" : { }\n" + "      }\n" + "    },\n" + "    \"indices\" : {\n" + "      \"index\" : {\n" + "        \"version\" : 1,\n" + "        \"mapping_version\" : 1,\n" + "        \"settings_version\" : 1,\n" + "        \"aliases_version\" : 1,\n" + "        \"routing_num_shards\" : 1,\n" + "        \"state\" : \"open\",\n" + "        \"settings\" : {\n" + "          \"index\" : {\n" + "            \"number_of_shards\" : \"1\",\n" + "            \"number_of_replicas\" : \"2\",\n" + "            \"version\" : {\n" + "              \"created\" : \"" + Version.CURRENT.id + "\"\n" + "            }\n" + "          }\n" + "        },\n" + "        \"mappings\" : {\n" + "          \"type\" : {\n" + "            \"type1\" : {\n" + "              \"key\" : \"value\"\n" + "            }\n" + "          }\n" + "        },\n" + "        \"aliases\" : [\n" + "          \"alias\"\n" + "        ],\n" + "        \"primary_terms\" : {\n" + "          \"0\" : 1\n" + "        },\n" + "        \"in_sync_allocations\" : {\n" + "          \"0\" : [\n" + "            \"allocationId\"\n" + "          ]\n" + "        },\n" + "        \"rollover_info\" : {\n" + "          \"rolloveAlias\" : {\n" + "            \"met_conditions\" : { },\n" + "            \"time\" : 1\n" + "          }\n" + "        },\n" + "        \"system\" : false\n" + "      }\n" + "    },\n" + "    \"index-graveyard\" : {\n" + "      \"tombstones\" : [ ]\n" + "    }\n" + "  },\n" + "  \"routing_table\" : {\n" + "    \"indices\" : {\n" + "      \"index\" : {\n" + "        \"shards\" : {\n" + "          \"1\" : [\n" + "            {\n" + "              \"state\" : \"STARTED\",\n" + "              \"primary\" : true,\n" + "              \"node\" : \"nodeId2\",\n" + "              \"relocating_node\" : null,\n" + "              \"shard\" : 1,\n" + "              \"index\" : \"index\",\n" + "              \"allocation_id\" : {\n" + "                \"id\" : \"" + allocationId + "\"\n" + "              }\n" + "            }\n" + "          ]\n" + "        }\n" + "      }\n" + "    }\n" + "  },\n" + "  \"routing_nodes\" : {\n" + "    \"unassigned\" : [ ],\n" + "    \"nodes\" : {\n" + "      \"nodeId2\" : [\n" + "        {\n" + "          \"state\" : \"STARTED\",\n" + "          \"primary\" : true,\n" + "          \"node\" : \"nodeId2\",\n" + "          \"relocating_node\" : null,\n" + "          \"shard\" : 1,\n" + "          \"index\" : \"index\",\n" + "          \"allocation_id\" : {\n" + "            \"id\" : \"" + allocationId + "\"\n" + "          }\n" + "        }\n" + "      ],\n" + "      \"nodeId1\" : [ ]\n" + "    }\n" + "  }\n" + "}", Strings.toString(builder));
}
Also used : ToXContent(org.opensearch.common.xcontent.ToXContent) IndexRoutingTable(org.opensearch.cluster.routing.IndexRoutingTable) Matchers.containsString(org.hamcrest.Matchers.containsString) XContentBuilder(org.opensearch.common.xcontent.XContentBuilder)

Example 17 with IndexRoutingTable

use of org.opensearch.cluster.routing.IndexRoutingTable in project OpenSearch by opensearch-project.

the class ClusterStateTests method testToXContent_FlatSettingTrue_ReduceMappingFalse.

public void testToXContent_FlatSettingTrue_ReduceMappingFalse() throws IOException {
    Map<String, String> mapParams = new HashMap<String, String>() {

        {
            put("flat_settings", "true");
            put("reduce_mappings", "false");
            put(Metadata.CONTEXT_MODE_PARAM, Metadata.CONTEXT_MODE_API);
        }
    };
    final ClusterState clusterState = buildClusterState();
    IndexRoutingTable index = clusterState.getRoutingTable().getIndicesRouting().get("index");
    String ephemeralId = clusterState.getNodes().get("nodeId1").getEphemeralId();
    String allocationId = index.getShards().get(1).getAllAllocationIds().iterator().next();
    XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint();
    builder.startObject();
    clusterState.toXContent(builder, new ToXContent.MapParams(mapParams));
    builder.endObject();
    assertEquals("{\n" + "  \"cluster_uuid\" : \"clusterUUID\",\n" + "  \"version\" : 0,\n" + "  \"state_uuid\" : \"stateUUID\",\n" + "  \"master_node\" : \"masterNodeId\",\n" + "  \"blocks\" : {\n" + "    \"global\" : {\n" + "      \"1\" : {\n" + "        \"description\" : \"description\",\n" + "        \"retryable\" : true,\n" + "        \"disable_state_persistence\" : true,\n" + "        \"levels\" : [\n" + "          \"read\",\n" + "          \"write\",\n" + "          \"metadata_read\",\n" + "          \"metadata_write\"\n" + "        ]\n" + "      }\n" + "    },\n" + "    \"indices\" : {\n" + "      \"index\" : {\n" + "        \"2\" : {\n" + "          \"description\" : \"description2\",\n" + "          \"retryable\" : false,\n" + "          \"levels\" : [\n" + "            \"read\",\n" + "            \"write\",\n" + "            \"metadata_read\",\n" + "            \"metadata_write\"\n" + "          ]\n" + "        }\n" + "      }\n" + "    }\n" + "  },\n" + "  \"nodes\" : {\n" + "    \"nodeId1\" : {\n" + "      \"name\" : \"\",\n" + "      \"ephemeral_id\" : \"" + ephemeralId + "\",\n" + "      \"transport_address\" : \"127.0.0.1:111\",\n" + "      \"attributes\" : { }\n" + "    }\n" + "  },\n" + "  \"metadata\" : {\n" + "    \"cluster_uuid\" : \"clusterUUID\",\n" + "    \"cluster_uuid_committed\" : false,\n" + "    \"cluster_coordination\" : {\n" + "      \"term\" : 1,\n" + "      \"last_committed_config\" : [\n" + "        \"commitedConfigurationNodeId\"\n" + "      ],\n" + "      \"last_accepted_config\" : [\n" + "        \"acceptedConfigurationNodeId\"\n" + "      ],\n" + "      \"voting_config_exclusions\" : [\n" + "        {\n" + "          \"node_id\" : \"exlucdedNodeId\",\n" + "          \"node_name\" : \"excludedNodeName\"\n" + "        }\n" + "      ]\n" + "    },\n" + "    \"templates\" : {\n" + "      \"template\" : {\n" + "        \"order\" : 0,\n" + "        \"index_patterns\" : [\n" + "          \"pattern1\",\n" + "          \"pattern2\"\n" + "        ],\n" + "        \"settings\" : {\n" + "          \"index.version.created\" : \"" + Version.CURRENT.id + "\"\n" + "        },\n" + "        \"mappings\" : {\n" + "          \"type\" : {\n" + "            \"key1\" : { }\n" + "          }\n" + "        },\n" + "        \"aliases\" : { }\n" + "      }\n" + "    },\n" + "    \"indices\" : {\n" + "      \"index\" : {\n" + "        \"version\" : 1,\n" + "        \"mapping_version\" : 1,\n" + "        \"settings_version\" : 1,\n" + "        \"aliases_version\" : 1,\n" + "        \"routing_num_shards\" : 1,\n" + "        \"state\" : \"open\",\n" + "        \"settings\" : {\n" + "          \"index.number_of_replicas\" : \"2\",\n" + "          \"index.number_of_shards\" : \"1\",\n" + "          \"index.version.created\" : \"" + Version.CURRENT.id + "\"\n" + "        },\n" + "        \"mappings\" : {\n" + "          \"type\" : {\n" + "            \"type1\" : {\n" + "              \"key\" : \"value\"\n" + "            }\n" + "          }\n" + "        },\n" + "        \"aliases\" : [\n" + "          \"alias\"\n" + "        ],\n" + "        \"primary_terms\" : {\n" + "          \"0\" : 1\n" + "        },\n" + "        \"in_sync_allocations\" : {\n" + "          \"0\" : [\n" + "            \"allocationId\"\n" + "          ]\n" + "        },\n" + "        \"rollover_info\" : {\n" + "          \"rolloveAlias\" : {\n" + "            \"met_conditions\" : { },\n" + "            \"time\" : 1\n" + "          }\n" + "        },\n" + "        \"system\" : false\n" + "      }\n" + "    },\n" + "    \"index-graveyard\" : {\n" + "      \"tombstones\" : [ ]\n" + "    }\n" + "  },\n" + "  \"routing_table\" : {\n" + "    \"indices\" : {\n" + "      \"index\" : {\n" + "        \"shards\" : {\n" + "          \"1\" : [\n" + "            {\n" + "              \"state\" : \"STARTED\",\n" + "              \"primary\" : true,\n" + "              \"node\" : \"nodeId2\",\n" + "              \"relocating_node\" : null,\n" + "              \"shard\" : 1,\n" + "              \"index\" : \"index\",\n" + "              \"allocation_id\" : {\n" + "                \"id\" : \"" + allocationId + "\"\n" + "              }\n" + "            }\n" + "          ]\n" + "        }\n" + "      }\n" + "    }\n" + "  },\n" + "  \"routing_nodes\" : {\n" + "    \"unassigned\" : [ ],\n" + "    \"nodes\" : {\n" + "      \"nodeId2\" : [\n" + "        {\n" + "          \"state\" : \"STARTED\",\n" + "          \"primary\" : true,\n" + "          \"node\" : \"nodeId2\",\n" + "          \"relocating_node\" : null,\n" + "          \"shard\" : 1,\n" + "          \"index\" : \"index\",\n" + "          \"allocation_id\" : {\n" + "            \"id\" : \"" + allocationId + "\"\n" + "          }\n" + "        }\n" + "      ],\n" + "      \"nodeId1\" : [ ]\n" + "    }\n" + "  }\n" + "}", Strings.toString(builder));
}
Also used : ToXContent(org.opensearch.common.xcontent.ToXContent) IndexRoutingTable(org.opensearch.cluster.routing.IndexRoutingTable) HashMap(java.util.HashMap) Matchers.containsString(org.hamcrest.Matchers.containsString) XContentBuilder(org.opensearch.common.xcontent.XContentBuilder)

Example 18 with IndexRoutingTable

use of org.opensearch.cluster.routing.IndexRoutingTable in project OpenSearch by opensearch-project.

the class ActiveShardCountTests method startLessThanWaitOnShards.

private ClusterState startLessThanWaitOnShards(final ClusterState clusterState, final String indexName, final int numShardsToStart) {
    RoutingTable routingTable = clusterState.routingTable();
    IndexRoutingTable indexRoutingTable = routingTable.index(indexName);
    IndexRoutingTable.Builder newIndexRoutingTable = IndexRoutingTable.builder(indexRoutingTable.getIndex());
    for (final ObjectCursor<IndexShardRoutingTable> shardEntry : indexRoutingTable.getShards().values()) {
        final IndexShardRoutingTable shardRoutingTable = shardEntry.value;
        assert shardRoutingTable.getSize() > 2;
        int numToStart = numShardsToStart;
        // want less than half, and primary is already started
        for (ShardRouting shardRouting : shardRoutingTable.getShards()) {
            if (shardRouting.primary()) {
                assertTrue(shardRouting.active());
            } else {
                if (numToStart > 0) {
                    shardRouting = shardRouting.initialize(randomAlphaOfLength(8), null, shardRouting.getExpectedShardSize()).moveToStarted();
                    numToStart--;
                }
            }
            newIndexRoutingTable.addShard(shardRouting);
        }
    }
    routingTable = RoutingTable.builder(routingTable).add(newIndexRoutingTable).build();
    return ClusterState.builder(clusterState).routingTable(routingTable).build();
}
Also used : IndexRoutingTable(org.opensearch.cluster.routing.IndexRoutingTable) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) IndexRoutingTable(org.opensearch.cluster.routing.IndexRoutingTable) RoutingTable(org.opensearch.cluster.routing.RoutingTable) ShardRouting(org.opensearch.cluster.routing.ShardRouting)

Example 19 with IndexRoutingTable

use of org.opensearch.cluster.routing.IndexRoutingTable in project OpenSearch by opensearch-project.

the class ActiveShardCountTests method startAllShards.

private ClusterState startAllShards(final ClusterState clusterState, final String indexName) {
    RoutingTable routingTable = clusterState.routingTable();
    IndexRoutingTable indexRoutingTable = routingTable.index(indexName);
    IndexRoutingTable.Builder newIndexRoutingTable = IndexRoutingTable.builder(indexRoutingTable.getIndex());
    for (final ObjectCursor<IndexShardRoutingTable> shardEntry : indexRoutingTable.getShards().values()) {
        final IndexShardRoutingTable shardRoutingTable = shardEntry.value;
        for (ShardRouting shardRouting : shardRoutingTable.getShards()) {
            if (shardRouting.primary()) {
                assertTrue(shardRouting.active());
            } else {
                if (shardRouting.active() == false) {
                    shardRouting = shardRouting.initialize(randomAlphaOfLength(8), null, shardRouting.getExpectedShardSize()).moveToStarted();
                }
            }
            newIndexRoutingTable.addShard(shardRouting);
        }
    }
    routingTable = RoutingTable.builder(routingTable).add(newIndexRoutingTable).build();
    return ClusterState.builder(clusterState).routingTable(routingTable).build();
}
Also used : IndexRoutingTable(org.opensearch.cluster.routing.IndexRoutingTable) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) IndexRoutingTable(org.opensearch.cluster.routing.IndexRoutingTable) RoutingTable(org.opensearch.cluster.routing.RoutingTable) ShardRouting(org.opensearch.cluster.routing.ShardRouting)

Example 20 with IndexRoutingTable

use of org.opensearch.cluster.routing.IndexRoutingTable in project OpenSearch by opensearch-project.

the class MetadataIndexStateServiceTests method assertIsClosed.

private static void assertIsClosed(final String indexName, final ClusterState clusterState) {
    final IndexMetadata indexMetadata = clusterState.metadata().indices().get(indexName);
    assertThat(indexMetadata.getState(), is(IndexMetadata.State.CLOSE));
    final Settings indexSettings = indexMetadata.getSettings();
    assertThat(indexSettings.hasValue(MetadataIndexStateService.VERIFIED_BEFORE_CLOSE_SETTING.getKey()), is(true));
    assertThat(indexSettings.getAsBoolean(MetadataIndexStateService.VERIFIED_BEFORE_CLOSE_SETTING.getKey(), false), is(true));
    assertThat(clusterState.blocks().hasIndexBlock(indexName, MetadataIndexStateService.INDEX_CLOSED_BLOCK), is(true));
    assertThat("Index " + indexName + " must have only 1 block with [id=" + MetadataIndexStateService.INDEX_CLOSED_BLOCK_ID + "]", clusterState.blocks().indices().getOrDefault(indexName, emptySet()).stream().filter(clusterBlock -> clusterBlock.id() == MetadataIndexStateService.INDEX_CLOSED_BLOCK_ID).count(), equalTo(1L));
    final IndexRoutingTable indexRoutingTable = clusterState.routingTable().index(indexName);
    assertThat(indexRoutingTable, notNullValue());
    for (IndexShardRoutingTable shardRoutingTable : indexRoutingTable) {
        assertThat(shardRoutingTable.shards().stream().allMatch(ShardRouting::unassigned), is(true));
        assertThat(shardRoutingTable.shards().stream().map(ShardRouting::unassignedInfo).map(UnassignedInfo::getReason).allMatch(info -> info == UnassignedInfo.Reason.INDEX_CLOSED), is(true));
    }
}
Also used : CoreMatchers(org.hamcrest.CoreMatchers) ImmutableOpenMap(org.opensearch.common.collect.ImmutableOpenMap) INDEX_CLOSED_BLOCK_ID(org.opensearch.cluster.metadata.MetadataIndexStateService.INDEX_CLOSED_BLOCK_ID) INDEX_CLOSED_BLOCK(org.opensearch.cluster.metadata.MetadataIndexStateService.INDEX_CLOSED_BLOCK) SETTING_VERSION_CREATED(org.opensearch.cluster.metadata.IndexMetadata.SETTING_VERSION_CREATED) Version(org.opensearch.Version) Strings(org.opensearch.common.Strings) CloseIndexResponse(org.opensearch.action.admin.indices.close.CloseIndexResponse) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) IndexId(org.opensearch.repositories.IndexId) ClusterBlock(org.opensearch.cluster.block.ClusterBlock) Locale(java.util.Locale) Map(java.util.Map) Matchers.nullValue(org.hamcrest.Matchers.nullValue) SnapshotInfoTests(org.opensearch.snapshots.SnapshotInfoTests) UnassignedInfo(org.opensearch.cluster.routing.UnassignedInfo) SETTING_NUMBER_OF_REPLICAS(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) Index(org.opensearch.index.Index) SnapshotId(org.opensearch.snapshots.SnapshotId) OpenSearchTestCase(org.opensearch.test.OpenSearchTestCase) Collection(java.util.Collection) SnapshotInProgressException(org.opensearch.snapshots.SnapshotInProgressException) Set(java.util.Set) Settings(org.opensearch.common.settings.Settings) DiscoveryNodeRole(org.opensearch.cluster.node.DiscoveryNodeRole) Collectors(java.util.stream.Collectors) Nullable(org.opensearch.common.Nullable) Tuple(org.opensearch.common.collect.Tuple) List(java.util.List) IndexResult(org.opensearch.action.admin.indices.close.CloseIndexResponse.IndexResult) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Matchers.is(org.hamcrest.Matchers.is) Matchers.containsString(org.hamcrest.Matchers.containsString) Mockito.mock(org.mockito.Mockito.mock) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) TestShardRouting.newShardRouting(org.opensearch.cluster.routing.TestShardRouting.newShardRouting) SnapshotsInProgress(org.opensearch.cluster.SnapshotsInProgress) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) IndexRoutingTable(org.opensearch.cluster.routing.IndexRoutingTable) CloseIndexClusterStateUpdateRequest(org.opensearch.action.admin.indices.close.CloseIndexClusterStateUpdateRequest) ClusterState(org.opensearch.cluster.ClusterState) LegacyESVersion(org.opensearch.LegacyESVersion) VersionUtils(org.opensearch.test.VersionUtils) ShardRoutingState(org.opensearch.cluster.routing.ShardRoutingState) Matchers.hasSize(org.hamcrest.Matchers.hasSize) Collections.singletonMap(java.util.Collections.singletonMap) ClusterBlocks(org.opensearch.cluster.block.ClusterBlocks) Collections.emptyMap(java.util.Collections.emptyMap) DeleteDataStreamRequestTests(org.opensearch.action.admin.indices.datastream.DeleteDataStreamRequestTests) Collections.emptySet(java.util.Collections.emptySet) IndexNotFoundException(org.opensearch.index.IndexNotFoundException) Mockito.when(org.mockito.Mockito.when) ShardRouting(org.opensearch.cluster.routing.ShardRouting) ShardId(org.opensearch.index.shard.ShardId) Snapshot(org.opensearch.snapshots.Snapshot) ClusterService(org.opensearch.cluster.service.ClusterService) ClusterName(org.opensearch.cluster.ClusterName) RestoreInProgress(org.opensearch.cluster.RestoreInProgress) RoutingTable(org.opensearch.cluster.routing.RoutingTable) Collections.unmodifiableMap(java.util.Collections.unmodifiableMap) SETTING_NUMBER_OF_SHARDS(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS) Collections(java.util.Collections) IndexRoutingTable(org.opensearch.cluster.routing.IndexRoutingTable) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) UnassignedInfo(org.opensearch.cluster.routing.UnassignedInfo) Settings(org.opensearch.common.settings.Settings)

Aggregations

IndexRoutingTable (org.opensearch.cluster.routing.IndexRoutingTable)46 IndexShardRoutingTable (org.opensearch.cluster.routing.IndexShardRoutingTable)34 ClusterState (org.opensearch.cluster.ClusterState)27 ShardRouting (org.opensearch.cluster.routing.ShardRouting)27 RoutingTable (org.opensearch.cluster.routing.RoutingTable)18 IndexMetadata (org.opensearch.cluster.metadata.IndexMetadata)15 ShardId (org.opensearch.index.shard.ShardId)13 Settings (org.opensearch.common.settings.Settings)12 HashSet (java.util.HashSet)10 DiscoveryNode (org.opensearch.cluster.node.DiscoveryNode)9 HashMap (java.util.HashMap)8 DiscoveryNodes (org.opensearch.cluster.node.DiscoveryNodes)8 List (java.util.List)7 Matchers.containsString (org.hamcrest.Matchers.containsString)7 Metadata (org.opensearch.cluster.metadata.Metadata)7 Index (org.opensearch.index.Index)7 ArrayList (java.util.ArrayList)6 Map (java.util.Map)6 Set (java.util.Set)6 Collectors (java.util.stream.Collectors)6