Search in sources :

Example 11 with DiscoveryNodes

use of org.opensearch.cluster.node.DiscoveryNodes in project OpenSearch by opensearch-project.

the class ClusterApplierServiceTests method testLocalNodeMasterListenerCallbacks.

public void testLocalNodeMasterListenerCallbacks() {
    TimedClusterApplierService timedClusterApplierService = createTimedClusterService(false);
    AtomicBoolean isMaster = new AtomicBoolean();
    timedClusterApplierService.addLocalNodeMasterListener(new LocalNodeMasterListener() {

        @Override
        public void onMaster() {
            isMaster.set(true);
        }

        @Override
        public void offMaster() {
            isMaster.set(false);
        }
    });
    ClusterState state = timedClusterApplierService.state();
    DiscoveryNodes nodes = state.nodes();
    DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder(nodes).masterNodeId(nodes.getLocalNodeId());
    state = ClusterState.builder(state).blocks(ClusterBlocks.EMPTY_CLUSTER_BLOCK).nodes(nodesBuilder).build();
    setState(timedClusterApplierService, state);
    assertThat(isMaster.get(), is(true));
    nodes = state.nodes();
    nodesBuilder = DiscoveryNodes.builder(nodes).masterNodeId(null);
    state = ClusterState.builder(state).blocks(ClusterBlocks.builder().addGlobalBlock(NoMasterBlockService.NO_MASTER_BLOCK_WRITES)).nodes(nodesBuilder).build();
    setState(timedClusterApplierService, state);
    assertThat(isMaster.get(), is(false));
    nodesBuilder = DiscoveryNodes.builder(nodes).masterNodeId(nodes.getLocalNodeId());
    state = ClusterState.builder(state).blocks(ClusterBlocks.EMPTY_CLUSTER_BLOCK).nodes(nodesBuilder).build();
    setState(timedClusterApplierService, state);
    assertThat(isMaster.get(), is(true));
    timedClusterApplierService.close();
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ClusterState(org.opensearch.cluster.ClusterState) LocalNodeMasterListener(org.opensearch.cluster.LocalNodeMasterListener) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes)

Example 12 with DiscoveryNodes

use of org.opensearch.cluster.node.DiscoveryNodes in project OpenSearch by opensearch-project.

the class GatewayAllocator method ensureAsyncFetchStorePrimaryRecency.

/**
 * Clear the fetched data for the primary to ensure we do not cancel recoveries based on excessively stale data.
 */
private void ensureAsyncFetchStorePrimaryRecency(RoutingAllocation allocation) {
    DiscoveryNodes nodes = allocation.nodes();
    if (hasNewNodes(nodes)) {
        final Set<String> newEphemeralIds = StreamSupport.stream(nodes.getDataNodes().spliterator(), false).map(node -> node.value.getEphemeralId()).collect(Collectors.toSet());
        // Invalidate the cache if a data node has been added to the cluster. This ensures that we do not cancel a recovery if a node
        // drops out, we fetch the shard data, then some indexing happens and then the node rejoins the cluster again. There are other
        // ways we could decide to cancel a recovery based on stale data (e.g. changing allocation filters or a primary failure) but
        // making the wrong decision here is not catastrophic so we only need to cover the common case.
        logger.trace(() -> new ParameterizedMessage("new nodes {} found, clearing primary async-fetch-store cache", Sets.difference(newEphemeralIds, lastSeenEphemeralIds)));
        asyncFetchStore.values().forEach(fetch -> clearCacheForPrimary(fetch, allocation));
        // recalc to also (lazily) clear out old nodes.
        this.lastSeenEphemeralIds = newEphemeralIds;
    }
}
Also used : DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) RoutingAllocation(org.opensearch.cluster.routing.allocation.RoutingAllocation) Priority(org.opensearch.common.Priority) ParameterizedMessage(org.apache.logging.log4j.message.ParameterizedMessage) Releasables(org.opensearch.common.lease.Releasables) ConcurrentMap(java.util.concurrent.ConcurrentMap) ConcurrentCollections(org.opensearch.common.util.concurrent.ConcurrentCollections) ObjectObjectCursor(com.carrotsearch.hppc.cursors.ObjectObjectCursor) BaseNodeResponse(org.opensearch.action.support.nodes.BaseNodeResponse) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) RerouteService(org.opensearch.cluster.routing.RerouteService) Inject(org.opensearch.common.inject.Inject) StreamSupport(java.util.stream.StreamSupport) ActionListener(org.opensearch.action.ActionListener) BaseNodesResponse(org.opensearch.action.support.nodes.BaseNodesResponse) Set(java.util.Set) Collectors(java.util.stream.Collectors) ShardRouting(org.opensearch.cluster.routing.ShardRouting) ShardId(org.opensearch.index.shard.ShardId) TransportNodesListShardStoreMetadata(org.opensearch.indices.store.TransportNodesListShardStoreMetadata) Sets(org.opensearch.common.util.set.Sets) List(java.util.List) Logger(org.apache.logging.log4j.Logger) FailedShard(org.opensearch.cluster.routing.allocation.FailedShard) ExistingShardsAllocator(org.opensearch.cluster.routing.allocation.ExistingShardsAllocator) AllocateUnassignedDecision(org.opensearch.cluster.routing.allocation.AllocateUnassignedDecision) LogManager(org.apache.logging.log4j.LogManager) Collections(java.util.Collections) ParameterizedMessage(org.apache.logging.log4j.message.ParameterizedMessage) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes)

Example 13 with DiscoveryNodes

use of org.opensearch.cluster.node.DiscoveryNodes in project OpenSearch by opensearch-project.

the class IndicesClusterStateService method createOrUpdateShards.

private void createOrUpdateShards(final ClusterState state) {
    RoutingNode localRoutingNode = state.getRoutingNodes().node(state.nodes().getLocalNodeId());
    if (localRoutingNode == null) {
        return;
    }
    DiscoveryNodes nodes = state.nodes();
    RoutingTable routingTable = state.routingTable();
    for (final ShardRouting shardRouting : localRoutingNode) {
        ShardId shardId = shardRouting.shardId();
        if (failedShardsCache.containsKey(shardId) == false) {
            AllocatedIndex<? extends Shard> indexService = indicesService.indexService(shardId.getIndex());
            assert indexService != null : "index " + shardId.getIndex() + " should have been created by createIndices";
            Shard shard = indexService.getShardOrNull(shardId.id());
            if (shard == null) {
                assert shardRouting.initializing() : shardRouting + " should have been removed by failMissingShards";
                createShard(nodes, routingTable, shardRouting, state);
            } else {
                updateShard(nodes, shardRouting, shard, routingTable, state);
            }
        }
    }
}
Also used : ShardId(org.opensearch.index.shard.ShardId) RoutingNode(org.opensearch.cluster.routing.RoutingNode) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) RoutingTable(org.opensearch.cluster.routing.RoutingTable) ShardRouting(org.opensearch.cluster.routing.ShardRouting) IndexShard(org.opensearch.index.shard.IndexShard) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes)

Example 14 with DiscoveryNodes

use of org.opensearch.cluster.node.DiscoveryNodes in project OpenSearch by opensearch-project.

the class ClusterRerouteResponseTests method testToXContent.

public void testToXContent() throws IOException {
    DiscoveryNode node0 = new DiscoveryNode("node0", new TransportAddress(TransportAddress.META_ADDRESS, 9000), Version.CURRENT);
    DiscoveryNodes nodes = new DiscoveryNodes.Builder().add(node0).masterNodeId(node0.getId()).build();
    IndexMetadata indexMetadata = IndexMetadata.builder("index").settings(Settings.builder().put(IndexSettings.INDEX_CHECK_ON_STARTUP.getKey(), true).put(IndexSettings.MAX_SCRIPT_FIELDS_SETTING.getKey(), 10).put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT).build()).build();
    ImmutableOpenMap.Builder<String, IndexMetadata> openMapBuilder = ImmutableOpenMap.builder();
    openMapBuilder.put("index", indexMetadata);
    Metadata metadata = Metadata.builder().indices(openMapBuilder.build()).build();
    ClusterState clusterState = ClusterState.builder(new ClusterName("test")).nodes(nodes).metadata(metadata).build();
    RoutingExplanations routingExplanations = new RoutingExplanations();
    routingExplanations.add(new RerouteExplanation(new AllocateReplicaAllocationCommand("index", 0, "node0"), Decision.YES));
    ClusterRerouteResponse clusterRerouteResponse = new ClusterRerouteResponse(true, clusterState, routingExplanations);
    {
        XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint();
        clusterRerouteResponse.toXContent(builder, ToXContent.EMPTY_PARAMS);
        assertEquals("{\n" + "  \"acknowledged\" : true,\n" + "  \"state\" : {\n" + "    \"cluster_uuid\" : \"_na_\",\n" + "    \"version\" : 0,\n" + "    \"state_uuid\" : \"" + clusterState.stateUUID() + "\",\n" + "    \"master_node\" : \"node0\",\n" + "    \"cluster_manager_node\" : \"node0\",\n" + "    \"blocks\" : { },\n" + "    \"nodes\" : {\n" + "      \"node0\" : {\n" + "        \"name\" : \"\",\n" + "        \"ephemeral_id\" : \"" + node0.getEphemeralId() + "\",\n" + "        \"transport_address\" : \"0.0.0.0:9000\",\n" + "        \"attributes\" : { }\n" + "      }\n" + "    },\n" + "    \"metadata\" : {\n" + "      \"cluster_uuid\" : \"_na_\",\n" + "      \"cluster_uuid_committed\" : false,\n" + "      \"cluster_coordination\" : {\n" + "        \"term\" : 0,\n" + "        \"last_committed_config\" : [ ],\n" + "        \"last_accepted_config\" : [ ],\n" + "        \"voting_config_exclusions\" : [ ]\n" + "      },\n" + "      \"templates\" : { },\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" + "              \"shard\" : {\n" + "                \"check_on_startup\" : \"true\"\n" + "              },\n" + "              \"number_of_shards\" : \"1\",\n" + "              \"number_of_replicas\" : \"0\",\n" + "              \"version\" : {\n" + "                \"created\" : \"" + Version.CURRENT.id + "\"\n" + "              },\n" + "              \"max_script_fields\" : \"10\"\n" + "            }\n" + "          },\n" + "          \"mappings\" : { },\n" + "          \"aliases\" : [ ],\n" + "          \"primary_terms\" : {\n" + "            \"0\" : 0\n" + "          },\n" + "          \"in_sync_allocations\" : {\n" + "            \"0\" : [ ]\n" + "          },\n" + "          \"rollover_info\" : { },\n" + "          \"system\" : false\n" + "        }\n" + "      },\n" + "      \"index-graveyard\" : {\n" + "        \"tombstones\" : [ ]\n" + "      }\n" + "    },\n" + "    \"routing_table\" : {\n" + "      \"indices\" : { }\n" + "    },\n" + "    \"routing_nodes\" : {\n" + "      \"unassigned\" : [ ],\n" + "      \"nodes\" : {\n" + "        \"node0\" : [ ]\n" + "      }\n" + "    }\n" + "  }\n" + "}", Strings.toString(builder));
    }
    {
        XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint();
        Map<String, String> params = new HashMap<>();
        params.put("explain", "true");
        params.put("metric", "version,cluster_manager_node");
        clusterRerouteResponse.toXContent(builder, new ToXContent.MapParams(params));
        assertEquals("{\n" + "  \"acknowledged\" : true,\n" + "  \"state\" : {\n" + "    \"cluster_uuid\" : \"_na_\",\n" + "    \"version\" : 0,\n" + "    \"state_uuid\" : \"" + clusterState.stateUUID() + "\",\n" + "    \"cluster_manager_node\" : \"node0\"\n" + "  },\n" + "  \"explanations\" : [\n" + "    {\n" + "      \"command\" : \"allocate_replica\",\n" + "      \"parameters\" : {\n" + "        \"index\" : \"index\",\n" + "        \"shard\" : 0,\n" + "        \"node\" : \"node0\"\n" + "      },\n" + "      \"decisions\" : [\n" + "        {\n" + "          \"decider\" : null,\n" + "          \"decision\" : \"YES\",\n" + "          \"explanation\" : \"none\"\n" + "        }\n" + "      ]\n" + "    }\n" + "  ]\n" + "}", Strings.toString(builder));
    }
    {
        XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint();
        Map<String, String> params = new HashMap<>();
        params.put("metric", "metadata");
        params.put("settings_filter", "index.number*,index.version.created");
        clusterRerouteResponse.toXContent(builder, new ToXContent.MapParams(params));
        assertEquals("{\n" + "  \"acknowledged\" : true,\n" + "  \"state\" : {\n" + "    \"cluster_uuid\" : \"_na_\",\n" + "    \"metadata\" : {\n" + "      \"cluster_uuid\" : \"_na_\",\n" + "      \"cluster_uuid_committed\" : false,\n" + "      \"cluster_coordination\" : {\n" + "        \"term\" : 0,\n" + "        \"last_committed_config\" : [ ],\n" + "        \"last_accepted_config\" : [ ],\n" + "        \"voting_config_exclusions\" : [ ]\n" + "      },\n" + "      \"templates\" : { },\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" + "              \"max_script_fields\" : \"10\",\n" + "              \"shard\" : {\n" + "                \"check_on_startup\" : \"true\"\n" + "              }\n" + "            }\n" + "          },\n" + "          \"mappings\" : { },\n" + "          \"aliases\" : [ ],\n" + "          \"primary_terms\" : {\n" + "            \"0\" : 0\n" + "          },\n" + "          \"in_sync_allocations\" : {\n" + "            \"0\" : [ ]\n" + "          },\n" + "          \"rollover_info\" : { },\n" + "          \"system\" : false\n" + "        }\n" + "      },\n" + "      \"index-graveyard\" : {\n" + "        \"tombstones\" : [ ]\n" + "      }\n" + "    }\n" + "  }\n" + "}", Strings.toString(builder));
    }
}
Also used : ClusterState(org.opensearch.cluster.ClusterState) RoutingExplanations(org.opensearch.cluster.routing.allocation.RoutingExplanations) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) TransportAddress(org.opensearch.common.transport.TransportAddress) Metadata(org.opensearch.cluster.metadata.Metadata) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) AllocateReplicaAllocationCommand(org.opensearch.cluster.routing.allocation.command.AllocateReplicaAllocationCommand) RerouteExplanation(org.opensearch.cluster.routing.allocation.RerouteExplanation) ImmutableOpenMap(org.opensearch.common.collect.ImmutableOpenMap) ClusterName(org.opensearch.cluster.ClusterName) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) ImmutableOpenMap(org.opensearch.common.collect.ImmutableOpenMap) HashMap(java.util.HashMap) Map(java.util.Map) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) XContentBuilder(org.opensearch.common.xcontent.XContentBuilder)

Example 15 with DiscoveryNodes

use of org.opensearch.cluster.node.DiscoveryNodes in project OpenSearch by opensearch-project.

the class IndexRecoveryIT method testUsesFileBasedRecoveryIfRetentionLeaseAheadOfGlobalCheckpoint.

public void testUsesFileBasedRecoveryIfRetentionLeaseAheadOfGlobalCheckpoint() throws Exception {
    internalCluster().ensureAtLeastNumDataNodes(2);
    String indexName = "test-index";
    createIndex(indexName, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true).put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "12h").build());
    indexRandom(randomBoolean(), randomBoolean(), randomBoolean(), IntStream.range(0, between(0, 100)).mapToObj(n -> client().prepareIndex(indexName).setSource("num", n)).collect(toList()));
    ensureGreen(indexName);
    final ShardId shardId = new ShardId(resolveIndex(indexName), 0);
    final DiscoveryNodes discoveryNodes = clusterService().state().nodes();
    final IndexShardRoutingTable indexShardRoutingTable = clusterService().state().routingTable().shardRoutingTable(shardId);
    final IndexShard primary = internalCluster().getInstance(IndicesService.class, discoveryNodes.get(indexShardRoutingTable.primaryShard().currentNodeId()).getName()).getShardOrNull(shardId);
    final ShardRouting replicaShardRouting = indexShardRoutingTable.replicaShards().get(0);
    internalCluster().restartNode(discoveryNodes.get(replicaShardRouting.currentNodeId()).getName(), new InternalTestCluster.RestartCallback() {

        @Override
        public Settings onNodeStopped(String nodeName) throws Exception {
            assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes(Integer.toString(discoveryNodes.getSize() - 1)).setWaitForEvents(Priority.LANGUID).get().isTimedOut());
            indexRandom(randomBoolean(), randomBoolean(), randomBoolean(), IntStream.range(0, between(1, 100)).mapToObj(n -> client().prepareIndex(indexName).setSource("num", n)).collect(toList()));
            // We do not guarantee that the replica can recover locally all the way to its own global checkpoint before starting
            // to recover from the primary, so we must be careful not to perform an operations-based recovery if this would require
            // some operations that are not being retained. Emulate this by advancing the lease ahead of the replica's GCP:
            primary.renewRetentionLease(ReplicationTracker.getPeerRecoveryRetentionLeaseId(replicaShardRouting), primary.seqNoStats().getMaxSeqNo() + 1, ReplicationTracker.PEER_RECOVERY_RETENTION_LEASE_SOURCE);
            return super.onNodeStopped(nodeName);
        }
    });
    ensureGreen(indexName);
    // noinspection OptionalGetWithoutIsPresent because it fails the test if absent
    final RecoveryState recoveryState = client().admin().indices().prepareRecoveries(indexName).get().shardRecoveryStates().get(indexName).stream().filter(rs -> rs.getPrimary() == false).findFirst().get();
    assertThat(recoveryState.getIndex().totalFileCount(), greaterThan(0));
}
Also used : OpenSearchRejectedExecutionException(org.opensearch.common.util.concurrent.OpenSearchRejectedExecutionException) SequenceNumbers(org.opensearch.index.seqno.SequenceNumbers) Arrays(java.util.Arrays) IndexResponse(org.opensearch.action.index.IndexResponse) ClusterStateResponse(org.opensearch.action.admin.cluster.state.ClusterStateResponse) SnapshotRecoverySource(org.opensearch.cluster.routing.RecoverySource.SnapshotRecoverySource) Matchers.not(org.hamcrest.Matchers.not) SnapshotState(org.opensearch.snapshots.SnapshotState) ClusterScope(org.opensearch.test.OpenSearchIntegTestCase.ClusterScope) Version(org.opensearch.Version) Strings(org.opensearch.common.Strings) Transport(org.opensearch.transport.Transport) PlainActionFuture(org.opensearch.action.support.PlainActionFuture) Map(java.util.Map) ShardStateAction(org.opensearch.cluster.action.shard.ShardStateAction) Repository(org.opensearch.repositories.Repository) TimeValue(org.opensearch.common.unit.TimeValue) Index(org.opensearch.index.Index) AbstractTokenFilterFactory(org.opensearch.index.analysis.AbstractTokenFilterFactory) TransportRequestOptions(org.opensearch.transport.TransportRequestOptions) Settings(org.opensearch.common.settings.Settings) ReplicationTracker(org.opensearch.index.seqno.ReplicationTracker) Scope(org.opensearch.test.OpenSearchIntegTestCase.Scope) TransportService(org.opensearch.transport.TransportService) CountDownLatch(java.util.concurrent.CountDownLatch) UPDATED(org.opensearch.action.DocWriteResponse.Result.UPDATED) NodeStats(org.opensearch.action.admin.cluster.node.stats.NodeStats) IndicesStatsResponse(org.opensearch.action.admin.indices.stats.IndicesStatsResponse) XContentType(org.opensearch.common.xcontent.XContentType) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) Matchers.is(org.hamcrest.Matchers.is) IndexCommit(org.apache.lucene.index.IndexCommit) RepositoriesService(org.opensearch.repositories.RepositoriesService) TransportRequestHandler(org.opensearch.transport.TransportRequestHandler) CHUNK_SIZE_SETTING(org.opensearch.node.RecoverySettingsChunkSizePlugin.CHUNK_SIZE_SETTING) MapperParsingException(org.opensearch.index.mapper.MapperParsingException) Priority(org.opensearch.common.Priority) MockTransportService(org.opensearch.test.transport.MockTransportService) ArrayList(java.util.ArrayList) RecoverySource(org.opensearch.cluster.routing.RecoverySource) RestoreSnapshotResponse(org.opensearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse) ClusterState(org.opensearch.cluster.ClusterState) ShardRoutingState(org.opensearch.cluster.routing.ShardRoutingState) BiConsumer(java.util.function.BiConsumer) Matchers.hasSize(org.hamcrest.Matchers.hasSize) StreamSupport(java.util.stream.StreamSupport) CircuitBreakingException(org.opensearch.common.breaker.CircuitBreakingException) Matchers.greaterThanOrEqualTo(org.hamcrest.Matchers.greaterThanOrEqualTo) TokenStream(org.apache.lucene.analysis.TokenStream) SetOnce(org.apache.lucene.util.SetOnce) IOException(java.io.IOException) IndexService(org.opensearch.index.IndexService) Plugin(org.opensearch.plugins.Plugin) ExecutionException(java.util.concurrent.ExecutionException) RecoveryResponse(org.opensearch.action.admin.indices.recovery.RecoveryResponse) AnalysisModule(org.opensearch.indices.analysis.AnalysisModule) PluginsService(org.opensearch.plugins.PluginsService) RecoveryStats(org.opensearch.index.recovery.RecoveryStats) RetentionLeases(org.opensearch.index.seqno.RetentionLeases) ClusterService(org.opensearch.cluster.service.ClusterService) ShardStats(org.opensearch.action.admin.indices.stats.ShardStats) IndexRequestBuilder(org.opensearch.action.index.IndexRequestBuilder) MockFSIndexStore(org.opensearch.test.store.MockFSIndexStore) StubbableTransport(org.opensearch.test.transport.StubbableTransport) ByteSizeUnit(org.opensearch.common.unit.ByteSizeUnit) OpenSearchException(org.opensearch.OpenSearchException) MoveAllocationCommand(org.opensearch.cluster.routing.allocation.command.MoveAllocationCommand) CircuitBreaker(org.opensearch.common.breaker.CircuitBreaker) CommonStatsFlags(org.opensearch.action.admin.indices.stats.CommonStatsFlags) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) OpenSearchAssertions.assertHitCount(org.opensearch.test.hamcrest.OpenSearchAssertions.assertHitCount) Matchers.everyItem(org.hamcrest.Matchers.everyItem) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NodeClosedException(org.opensearch.node.NodeClosedException) ReplicationLuceneIndex(org.opensearch.indices.replication.common.ReplicationLuceneIndex) RecoveryRequest(org.opensearch.action.admin.indices.recovery.RecoveryRequest) UnassignedInfo(org.opensearch.cluster.routing.UnassignedInfo) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) Matchers.isOneOf(org.hamcrest.Matchers.isOneOf) ReplicaShardAllocatorIT(org.opensearch.gateway.ReplicaShardAllocatorIT) TransportChannel(org.opensearch.transport.TransportChannel) Matchers.lessThanOrEqualTo(org.hamcrest.Matchers.lessThanOrEqualTo) Collection(java.util.Collection) IndicesService(org.opensearch.indices.IndicesService) Task(org.opensearch.tasks.Task) Store(org.opensearch.index.store.Store) NodeIndicesStats(org.opensearch.indices.NodeIndicesStats) Collectors(java.util.stream.Collectors) GatedCloseable(org.opensearch.common.concurrent.GatedCloseable) List(java.util.List) ClusterHealthResponse(org.opensearch.action.admin.cluster.health.ClusterHealthResponse) Matchers.equalTo(org.hamcrest.Matchers.equalTo) CREATED(org.opensearch.action.DocWriteResponse.Result.CREATED) IndexSettings(org.opensearch.index.IndexSettings) ReplicationResponse(org.opensearch.action.support.replication.ReplicationResponse) ConnectTransportException(org.opensearch.transport.ConnectTransportException) OpenSearchIntegTestCase(org.opensearch.test.OpenSearchIntegTestCase) AllocateEmptyPrimaryAllocationCommand(org.opensearch.cluster.routing.allocation.command.AllocateEmptyPrimaryAllocationCommand) RefreshPolicy(org.opensearch.action.support.WriteRequest.RefreshPolicy) IntStream(java.util.stream.IntStream) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) Stage(org.opensearch.indices.recovery.RecoveryState.Stage) TokenFilterFactory(org.opensearch.index.analysis.TokenFilterFactory) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ByteSizeValue(org.opensearch.common.unit.ByteSizeValue) InternalTestCluster(org.opensearch.test.InternalTestCluster) NodeConnectionsService(org.opensearch.cluster.NodeConnectionsService) IndexShard(org.opensearch.index.shard.IndexShard) InternalSettingsPlugin(org.opensearch.test.InternalSettingsPlugin) BackgroundIndexer(org.opensearch.test.BackgroundIndexer) Collections.singletonMap(java.util.Collections.singletonMap) SearchResponse(org.opensearch.action.search.SearchResponse) StoreStats(org.opensearch.index.store.StoreStats) OpenSearchAssertions.assertAcked(org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked) RepositoryData(org.opensearch.repositories.RepositoryData) CreateSnapshotResponse(org.opensearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse) PeerRecoverySource(org.opensearch.cluster.routing.RecoverySource.PeerRecoverySource) Matchers.empty(org.hamcrest.Matchers.empty) MockEngineFactoryPlugin(org.opensearch.index.MockEngineFactoryPlugin) TransportRequest(org.opensearch.transport.TransportRequest) Semaphore(java.util.concurrent.Semaphore) MockEngineSupport(org.opensearch.test.engine.MockEngineSupport) ActiveShardCount(org.opensearch.action.support.ActiveShardCount) ShardRouting(org.opensearch.cluster.routing.ShardRouting) ShardId(org.opensearch.index.shard.ShardId) Consumer(java.util.function.Consumer) AnalysisPlugin(org.opensearch.plugins.AnalysisPlugin) Collectors.toList(java.util.stream.Collectors.toList) Snapshot(org.opensearch.snapshots.Snapshot) NodesStatsResponse(org.opensearch.action.admin.cluster.node.stats.NodesStatsResponse) RecoverySettingsChunkSizePlugin(org.opensearch.node.RecoverySettingsChunkSizePlugin) Collections(java.util.Collections) IndexShardRoutingTable(org.opensearch.cluster.routing.IndexShardRoutingTable) IndexShard(org.opensearch.index.shard.IndexShard) IndicesService(org.opensearch.indices.IndicesService) InternalTestCluster(org.opensearch.test.InternalTestCluster) OpenSearchRejectedExecutionException(org.opensearch.common.util.concurrent.OpenSearchRejectedExecutionException) MapperParsingException(org.opensearch.index.mapper.MapperParsingException) CircuitBreakingException(org.opensearch.common.breaker.CircuitBreakingException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) OpenSearchException(org.opensearch.OpenSearchException) NodeClosedException(org.opensearch.node.NodeClosedException) ConnectTransportException(org.opensearch.transport.ConnectTransportException) ShardId(org.opensearch.index.shard.ShardId) ShardRouting(org.opensearch.cluster.routing.ShardRouting) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) Settings(org.opensearch.common.settings.Settings) IndexSettings(org.opensearch.index.IndexSettings)

Aggregations

DiscoveryNodes (org.opensearch.cluster.node.DiscoveryNodes)128 DiscoveryNode (org.opensearch.cluster.node.DiscoveryNode)82 ClusterState (org.opensearch.cluster.ClusterState)49 Settings (org.opensearch.common.settings.Settings)32 IndexMetadata (org.opensearch.cluster.metadata.IndexMetadata)27 HashSet (java.util.HashSet)22 ArrayList (java.util.ArrayList)21 ClusterName (org.opensearch.cluster.ClusterName)21 Metadata (org.opensearch.cluster.metadata.Metadata)21 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)19 TransportService (org.opensearch.transport.TransportService)19 Collections (java.util.Collections)18 List (java.util.List)18 IOException (java.io.IOException)17 Map (java.util.Map)17 CountDownLatch (java.util.concurrent.CountDownLatch)17 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)17 ShardRouting (org.opensearch.cluster.routing.ShardRouting)17 ShardId (org.opensearch.index.shard.ShardId)17 Version (org.opensearch.Version)16