Search in sources :

Example 16 with ClusterStateResponse

use of org.opensearch.action.admin.cluster.state.ClusterStateResponse in project OpenSearch by opensearch-project.

the class CloseIndexDisableCloseAllIT method assertIndexIsClosed.

private void assertIndexIsClosed(String... indices) {
    ClusterStateResponse clusterStateResponse = client().admin().cluster().prepareState().execute().actionGet();
    for (String index : indices) {
        IndexMetadata indexMetadata = clusterStateResponse.getState().metadata().indices().get(index);
        assertNotNull(indexMetadata);
        assertEquals(IndexMetadata.State.CLOSE, indexMetadata.getState());
    }
}
Also used : ClusterStateResponse(org.opensearch.action.admin.cluster.state.ClusterStateResponse) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata)

Example 17 with ClusterStateResponse

use of org.opensearch.action.admin.cluster.state.ClusterStateResponse in project OpenSearch by opensearch-project.

the class SharedClusterSnapshotRestoreIT method testDataFileFailureDuringRestore.

public void testDataFileFailureDuringRestore() throws Exception {
    disableRepoConsistencyCheck("This test intentionally leaves a broken repository");
    Path repositoryLocation = randomRepoPath();
    Client client = client();
    createRepository("test-repo", "fs", repositoryLocation);
    prepareCreate("test-idx").setSettings(Settings.builder().put("index.allocation.max_retries", Integer.MAX_VALUE)).get();
    ensureGreen();
    final NumShards numShards = getNumShards("test-idx");
    indexRandomDocs("test-idx", 100);
    createSnapshot("test-repo", "test-snap", Collections.singletonList("test-idx"));
    createRepository("test-repo", "mock", Settings.builder().put("location", repositoryLocation).put("random", randomAlphaOfLength(10)).put("random_data_file_io_exception_rate", 0.3));
    // Test restore after index deletion
    logger.info("--> delete index");
    cluster().wipeIndices("test-idx");
    logger.info("--> restore index after deletion");
    final RestoreSnapshotResponse restoreResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).get();
    logger.info("--> total number of simulated failures during restore: [{}]", getFailureCount("test-repo"));
    final RestoreInfo restoreInfo = restoreResponse.getRestoreInfo();
    assertThat(restoreInfo.totalShards(), equalTo(numShards.numPrimaries));
    if (restoreInfo.successfulShards() == restoreInfo.totalShards()) {
        // All shards were restored, we must find the exact number of hits
        assertDocCount("test-idx", 100L);
    } else {
        // One or more shards failed to be restored. This can happen when there is
        // only 1 data node: a shard failed because of the random IO exceptions
        // during restore and then we don't allow the shard to be assigned on the
        // same node again during the same reroute operation. Then another reroute
        // operation is scheduled, but the RestoreInProgressAllocationDecider will
        // block the shard to be assigned again because it failed during restore.
        final ClusterStateResponse clusterStateResponse = client.admin().cluster().prepareState().get();
        assertEquals(1, clusterStateResponse.getState().getNodes().getDataNodes().size());
        assertEquals(restoreInfo.failedShards(), clusterStateResponse.getState().getRoutingTable().shardsWithState(ShardRoutingState.UNASSIGNED).size());
    }
}
Also used : Path(java.nio.file.Path) ClusterStateResponse(org.opensearch.action.admin.cluster.state.ClusterStateResponse) Client(org.opensearch.client.Client) RestoreSnapshotResponse(org.opensearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse)

Example 18 with ClusterStateResponse

use of org.opensearch.action.admin.cluster.state.ClusterStateResponse in project OpenSearch by opensearch-project.

the class RepositoriesIT method testRepositoryCreation.

public void testRepositoryCreation() throws Exception {
    Client client = client();
    Path location = randomRepoPath();
    createRepository("test-repo-1", "fs", location);
    logger.info("--> verify the repository");
    int numberOfFiles = FileSystemUtils.files(location).length;
    VerifyRepositoryResponse verifyRepositoryResponse = client.admin().cluster().prepareVerifyRepository("test-repo-1").get();
    assertThat(verifyRepositoryResponse.getNodes().size(), equalTo(cluster().numDataAndMasterNodes()));
    logger.info("--> verify that we didn't leave any files as a result of verification");
    assertThat(FileSystemUtils.files(location).length, equalTo(numberOfFiles));
    logger.info("--> check that repository is really there");
    ClusterStateResponse clusterStateResponse = client.admin().cluster().prepareState().clear().setMetadata(true).get();
    Metadata metadata = clusterStateResponse.getState().getMetadata();
    RepositoriesMetadata repositoriesMetadata = metadata.custom(RepositoriesMetadata.TYPE);
    assertThat(repositoriesMetadata, notNullValue());
    assertThat(repositoriesMetadata.repository("test-repo-1"), notNullValue());
    assertThat(repositoriesMetadata.repository("test-repo-1").type(), equalTo("fs"));
    logger.info("-->  creating another repository");
    createRepository("test-repo-2", "fs");
    logger.info("--> check that both repositories are in cluster state");
    clusterStateResponse = client.admin().cluster().prepareState().clear().setMetadata(true).get();
    metadata = clusterStateResponse.getState().getMetadata();
    repositoriesMetadata = metadata.custom(RepositoriesMetadata.TYPE);
    assertThat(repositoriesMetadata, notNullValue());
    assertThat(repositoriesMetadata.repositories().size(), equalTo(2));
    assertThat(repositoriesMetadata.repository("test-repo-1"), notNullValue());
    assertThat(repositoriesMetadata.repository("test-repo-1").type(), equalTo("fs"));
    assertThat(repositoriesMetadata.repository("test-repo-2"), notNullValue());
    assertThat(repositoriesMetadata.repository("test-repo-2").type(), equalTo("fs"));
    logger.info("--> check that both repositories can be retrieved by getRepositories query");
    GetRepositoriesResponse repositoriesResponse = client.admin().cluster().prepareGetRepositories(randomFrom("_all", "*", "test-repo-*")).get();
    assertThat(repositoriesResponse.repositories().size(), equalTo(2));
    assertThat(findRepository(repositoriesResponse.repositories(), "test-repo-1"), notNullValue());
    assertThat(findRepository(repositoriesResponse.repositories(), "test-repo-2"), notNullValue());
    logger.info("--> check that trying to create a repository with the same settings repeatedly does not update cluster state");
    String beforeStateUuid = clusterStateResponse.getState().stateUUID();
    assertThat(client.admin().cluster().preparePutRepository("test-repo-1").setType("fs").setSettings(Settings.builder().put("location", location)).get().isAcknowledged(), equalTo(true));
    assertEquals(beforeStateUuid, client.admin().cluster().prepareState().clear().get().getState().stateUUID());
    logger.info("--> delete repository test-repo-1");
    client.admin().cluster().prepareDeleteRepository("test-repo-1").get();
    repositoriesResponse = client.admin().cluster().prepareGetRepositories().get();
    assertThat(repositoriesResponse.repositories().size(), equalTo(1));
    assertThat(findRepository(repositoriesResponse.repositories(), "test-repo-2"), notNullValue());
    logger.info("--> delete repository test-repo-2");
    client.admin().cluster().prepareDeleteRepository("test-repo-2").get();
    repositoriesResponse = client.admin().cluster().prepareGetRepositories().get();
    assertThat(repositoriesResponse.repositories().size(), equalTo(0));
}
Also used : Path(java.nio.file.Path) RepositoriesMetadata(org.opensearch.cluster.metadata.RepositoriesMetadata) ClusterStateResponse(org.opensearch.action.admin.cluster.state.ClusterStateResponse) Metadata(org.opensearch.cluster.metadata.Metadata) RepositoriesMetadata(org.opensearch.cluster.metadata.RepositoriesMetadata) RepositoryMetadata(org.opensearch.cluster.metadata.RepositoryMetadata) VerifyRepositoryResponse(org.opensearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse) Matchers.containsString(org.hamcrest.Matchers.containsString) Client(org.opensearch.client.Client) GetRepositoriesResponse(org.opensearch.action.admin.cluster.repositories.get.GetRepositoriesResponse)

Example 19 with ClusterStateResponse

use of org.opensearch.action.admin.cluster.state.ClusterStateResponse in project OpenSearch by opensearch-project.

the class RestShardsActionTests method testBuildTable.

public void testBuildTable() {
    final int numShards = randomIntBetween(1, 5);
    DiscoveryNode localNode = new DiscoveryNode("local", buildNewFakeTransportAddress(), Version.CURRENT);
    List<ShardRouting> shardRoutings = new ArrayList<>(numShards);
    Map<ShardRouting, ShardStats> shardStatsMap = new HashMap<>();
    String index = "index";
    for (int i = 0; i < numShards; i++) {
        ShardRoutingState shardRoutingState = ShardRoutingState.fromValue((byte) randomIntBetween(2, 3));
        ShardRouting shardRouting = TestShardRouting.newShardRouting(index, i, localNode.getId(), randomBoolean(), shardRoutingState);
        Path path = createTempDir().resolve("indices").resolve(shardRouting.shardId().getIndex().getUUID()).resolve(String.valueOf(shardRouting.shardId().id()));
        ShardStats shardStats = new ShardStats(shardRouting, new ShardPath(false, path, path, shardRouting.shardId()), null, null, null, null);
        shardStatsMap.put(shardRouting, shardStats);
        shardRoutings.add(shardRouting);
    }
    IndexStats indexStats = mock(IndexStats.class);
    when(indexStats.getPrimaries()).thenReturn(new CommonStats());
    when(indexStats.getTotal()).thenReturn(new CommonStats());
    IndicesStatsResponse stats = mock(IndicesStatsResponse.class);
    when(stats.asMap()).thenReturn(shardStatsMap);
    DiscoveryNodes discoveryNodes = mock(DiscoveryNodes.class);
    when(discoveryNodes.get(localNode.getId())).thenReturn(localNode);
    ClusterStateResponse state = mock(ClusterStateResponse.class);
    RoutingTable routingTable = mock(RoutingTable.class);
    when(routingTable.allShards()).thenReturn(shardRoutings);
    ClusterState clusterState = mock(ClusterState.class);
    when(clusterState.routingTable()).thenReturn(routingTable);
    when(clusterState.nodes()).thenReturn(discoveryNodes);
    when(state.getState()).thenReturn(clusterState);
    final RestShardsAction action = new RestShardsAction();
    final Table table = action.buildTable(new FakeRestRequest(), state, stats);
    // now, verify the table is correct
    List<Table.Cell> headers = table.getHeaders();
    assertThat(headers.get(0).value, equalTo("index"));
    assertThat(headers.get(1).value, equalTo("shard"));
    assertThat(headers.get(2).value, equalTo("prirep"));
    assertThat(headers.get(3).value, equalTo("state"));
    assertThat(headers.get(4).value, equalTo("docs"));
    assertThat(headers.get(5).value, equalTo("store"));
    assertThat(headers.get(6).value, equalTo("ip"));
    assertThat(headers.get(7).value, equalTo("id"));
    assertThat(headers.get(8).value, equalTo("node"));
    final List<List<Table.Cell>> rows = table.getRows();
    assertThat(rows.size(), equalTo(numShards));
    Iterator<ShardRouting> shardRoutingsIt = shardRoutings.iterator();
    for (final List<Table.Cell> row : rows) {
        ShardRouting shardRouting = shardRoutingsIt.next();
        ShardStats shardStats = shardStatsMap.get(shardRouting);
        assertThat(row.get(0).value, equalTo(shardRouting.getIndexName()));
        assertThat(row.get(1).value, equalTo(shardRouting.getId()));
        assertThat(row.get(2).value, equalTo(shardRouting.primary() ? "p" : "r"));
        assertThat(row.get(3).value, equalTo(shardRouting.state()));
        assertThat(row.get(6).value, equalTo(localNode.getHostAddress()));
        assertThat(row.get(7).value, equalTo(localNode.getId()));
        assertThat(row.get(69).value, equalTo(shardStats.getDataPath()));
        assertThat(row.get(70).value, equalTo(shardStats.getStatePath()));
    }
}
Also used : DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) FakeRestRequest(org.opensearch.test.rest.FakeRestRequest) CommonStats(org.opensearch.action.admin.indices.stats.CommonStats) ShardPath(org.opensearch.index.shard.ShardPath) ArrayList(java.util.ArrayList) List(java.util.List) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) ShardStats(org.opensearch.action.admin.indices.stats.ShardStats) ShardPath(org.opensearch.index.shard.ShardPath) Path(java.nio.file.Path) IndicesStatsResponse(org.opensearch.action.admin.indices.stats.IndicesStatsResponse) ClusterState(org.opensearch.cluster.ClusterState) Table(org.opensearch.common.Table) RoutingTable(org.opensearch.cluster.routing.RoutingTable) ClusterStateResponse(org.opensearch.action.admin.cluster.state.ClusterStateResponse) ShardRoutingState(org.opensearch.cluster.routing.ShardRoutingState) RoutingTable(org.opensearch.cluster.routing.RoutingTable) ShardRouting(org.opensearch.cluster.routing.ShardRouting) TestShardRouting(org.opensearch.cluster.routing.TestShardRouting) IndexStats(org.opensearch.action.admin.indices.stats.IndexStats)

Example 20 with ClusterStateResponse

use of org.opensearch.action.admin.cluster.state.ClusterStateResponse in project OpenSearch by opensearch-project.

the class SnapshotResiliencyTests method testSnapshotPrimaryRelocations.

/**
 * Simulates concurrent restarts of data and master nodes as well as relocating a primary shard, while starting and subsequently
 * deleting a snapshot.
 */
public void testSnapshotPrimaryRelocations() {
    final int masterNodeCount = randomFrom(1, 3, 5);
    setupTestCluster(masterNodeCount, randomIntBetween(2, 5));
    String repoName = "repo";
    String snapshotName = "snapshot";
    final String index = "test";
    final int shards = randomIntBetween(1, 5);
    final TestClusterNodes.TestClusterNode masterNode = testClusterNodes.currentMaster(testClusterNodes.nodes.values().iterator().next().clusterService.state());
    final AtomicBoolean createdSnapshot = new AtomicBoolean();
    final AdminClient masterAdminClient = masterNode.client.admin();
    final StepListener<ClusterStateResponse> clusterStateResponseStepListener = new StepListener<>();
    continueOrDie(createRepoAndIndex(repoName, index, shards), createIndexResponse -> client().admin().cluster().state(new ClusterStateRequest(), clusterStateResponseStepListener));
    continueOrDie(clusterStateResponseStepListener, clusterStateResponse -> {
        final ShardRouting shardToRelocate = clusterStateResponse.getState().routingTable().allShards(index).get(0);
        final TestClusterNodes.TestClusterNode currentPrimaryNode = testClusterNodes.nodeById(shardToRelocate.currentNodeId());
        final TestClusterNodes.TestClusterNode otherNode = testClusterNodes.randomDataNodeSafe(currentPrimaryNode.node.getName());
        scheduleNow(() -> testClusterNodes.stopNode(currentPrimaryNode));
        scheduleNow(new Runnable() {

            @Override
            public void run() {
                final StepListener<ClusterStateResponse> updatedClusterStateResponseStepListener = new StepListener<>();
                masterAdminClient.cluster().state(new ClusterStateRequest(), updatedClusterStateResponseStepListener);
                continueOrDie(updatedClusterStateResponseStepListener, updatedClusterState -> {
                    final ShardRouting shardRouting = updatedClusterState.getState().routingTable().shardRoutingTable(shardToRelocate.shardId()).primaryShard();
                    if (shardRouting.unassigned() && shardRouting.unassignedInfo().getReason() == UnassignedInfo.Reason.NODE_LEFT) {
                        if (masterNodeCount > 1) {
                            scheduleNow(() -> testClusterNodes.stopNode(masterNode));
                        }
                        testClusterNodes.randomDataNodeSafe().client.admin().cluster().prepareCreateSnapshot(repoName, snapshotName).execute(ActionListener.wrap(() -> {
                            createdSnapshot.set(true);
                            testClusterNodes.randomDataNodeSafe().client.admin().cluster().deleteSnapshot(new DeleteSnapshotRequest(repoName, snapshotName), noopListener());
                        }));
                        scheduleNow(() -> testClusterNodes.randomMasterNodeSafe().client.admin().cluster().reroute(new ClusterRerouteRequest().add(new AllocateEmptyPrimaryAllocationCommand(index, shardRouting.shardId().id(), otherNode.node.getName(), true)), noopListener()));
                    } else {
                        scheduleSoon(this);
                    }
                });
            }
        });
    });
    runUntil(() -> testClusterNodes.randomMasterNode().map(master -> {
        if (createdSnapshot.get() == false) {
            return false;
        }
        return master.clusterService.state().custom(SnapshotsInProgress.TYPE, SnapshotsInProgress.EMPTY).entries().isEmpty();
    }).orElse(false), TimeUnit.MINUTES.toMillis(1L));
    clearDisruptionsAndAwaitSync();
    assertTrue(createdSnapshot.get());
    assertThat(testClusterNodes.randomDataNodeSafe().clusterService.state().custom(SnapshotsInProgress.TYPE, SnapshotsInProgress.EMPTY).entries(), empty());
    final Repository repository = testClusterNodes.randomMasterNodeSafe().repositoriesService.repository(repoName);
    Collection<SnapshotId> snapshotIds = getRepositoryData(repository).getSnapshotIds();
    assertThat(snapshotIds, either(hasSize(1)).or(hasSize(0)));
}
Also used : PrioritizedOpenSearchThreadPoolExecutor(org.opensearch.common.util.concurrent.PrioritizedOpenSearchThreadPoolExecutor) Version(org.opensearch.Version) TransportPutMappingAction(org.opensearch.action.admin.indices.mapping.put.TransportPutMappingAction) BulkAction(org.opensearch.action.bulk.BulkAction) TransportPutRepositoryAction(org.opensearch.action.admin.cluster.repositories.put.TransportPutRepositoryAction) GroupedActionListener(org.opensearch.action.support.GroupedActionListener) WriteRequest(org.opensearch.action.support.WriteRequest) RestoreSnapshotRequest(org.opensearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest) OpenSearchAllocationTestCase(org.opensearch.cluster.OpenSearchAllocationTestCase) Map(java.util.Map) PutMappingAction(org.opensearch.action.admin.indices.mapping.put.PutMappingAction) Path(java.nio.file.Path) ShardStateAction(org.opensearch.cluster.action.shard.ShardStateAction) NodeEnvironment(org.opensearch.env.NodeEnvironment) NodeClient(org.opensearch.client.node.NodeClient) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) MasterService(org.opensearch.cluster.service.MasterService) IndexingPressureService(org.opensearch.index.IndexingPressureService) TransportResyncReplicationAction(org.opensearch.action.resync.TransportResyncReplicationAction) ExceptionsHelper(org.opensearch.ExceptionsHelper) HEALTHY(org.opensearch.monitor.StatusInfo.Status.HEALTHY) TransportService(org.opensearch.transport.TransportService) TransportClusterRerouteAction(org.opensearch.action.admin.cluster.reroute.TransportClusterRerouteAction) Logger(org.apache.logging.log4j.Logger) Stream(java.util.stream.Stream) ActionTestUtils(org.opensearch.action.support.ActionTestUtils) IndexNameExpressionResolver(org.opensearch.cluster.metadata.IndexNameExpressionResolver) Mockito.mock(org.mockito.Mockito.mock) SearchAction(org.opensearch.action.search.SearchAction) TransportRequestHandler(org.opensearch.transport.TransportRequestHandler) ThreadPool(org.opensearch.threadpool.ThreadPool) Supplier(java.util.function.Supplier) LinkedHashMap(java.util.LinkedHashMap) RestoreSnapshotResponse(org.opensearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse) ResponseCollectorService(org.opensearch.node.ResponseCollectorService) MapperRegistry(org.opensearch.indices.mapper.MapperRegistry) RestoreSnapshotAction(org.opensearch.action.admin.cluster.snapshots.restore.RestoreSnapshotAction) Matchers.hasSize(org.hamcrest.Matchers.hasSize) ElectionStrategy(org.opensearch.cluster.coordination.ElectionStrategy) Before(org.junit.Before) DisruptableMockTransport(org.opensearch.test.disruption.DisruptableMockTransport) IOException(java.io.IOException) AnalysisModule(org.opensearch.indices.analysis.AnalysisModule) RetentionLeaseSyncer(org.opensearch.index.seqno.RetentionLeaseSyncer) PageCacheRecycler(org.opensearch.common.util.PageCacheRecycler) DestructiveOperations(org.opensearch.action.support.DestructiveOperations) AbstractRunnable(org.opensearch.common.util.concurrent.AbstractRunnable) FetchPhase(org.opensearch.search.fetch.FetchPhase) BulkRequest(org.opensearch.action.bulk.BulkRequest) DeleteSnapshotAction(org.opensearch.action.admin.cluster.snapshots.delete.DeleteSnapshotAction) IndicesShardStoresAction(org.opensearch.action.admin.indices.shards.IndicesShardStoresAction) SearchTransportService(org.opensearch.action.search.SearchTransportService) MetadataIndexUpgradeService(org.opensearch.cluster.metadata.MetadataIndexUpgradeService) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Coordinator(org.opensearch.cluster.coordination.Coordinator) UnassignedInfo(org.opensearch.cluster.routing.UnassignedInfo) RecoverySettings(org.opensearch.indices.recovery.RecoverySettings) SearchPhaseController(org.opensearch.action.search.SearchPhaseController) PATH_HOME_SETTING(org.opensearch.env.Environment.PATH_HOME_SETTING) TransportAutoPutMappingAction(org.opensearch.action.admin.indices.mapping.put.TransportAutoPutMappingAction) MockEventuallyConsistentRepository(org.opensearch.snapshots.mockstore.MockEventuallyConsistentRepository) ClusterStateAction(org.opensearch.action.admin.cluster.state.ClusterStateAction) Matchers.lessThanOrEqualTo(org.hamcrest.Matchers.lessThanOrEqualTo) OpenSearchTestCase(org.opensearch.test.OpenSearchTestCase) Collection(java.util.Collection) CreateSnapshotAction(org.opensearch.action.admin.cluster.snapshots.create.CreateSnapshotAction) AutoPutMappingAction(org.opensearch.action.admin.indices.mapping.put.AutoPutMappingAction) Collectors(java.util.stream.Collectors) AliasValidator(org.opensearch.cluster.metadata.AliasValidator) Objects(java.util.Objects) FakeThreadPoolMasterService(org.opensearch.cluster.service.FakeThreadPoolMasterService) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) StatusInfo(org.opensearch.monitor.StatusInfo) BigArrays(org.opensearch.common.util.BigArrays) IntStream(java.util.stream.IntStream) IndexMetadata(org.opensearch.cluster.metadata.IndexMetadata) CheckedConsumer(org.opensearch.common.CheckedConsumer) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DeleteIndexAction(org.opensearch.action.admin.indices.delete.DeleteIndexAction) CoordinatorTests(org.opensearch.cluster.coordination.CoordinatorTests) SnapshotDeletionsInProgress(org.opensearch.cluster.SnapshotDeletionsInProgress) NamedWriteableRegistry(org.opensearch.common.io.stream.NamedWriteableRegistry) MappingUpdatedAction(org.opensearch.cluster.action.index.MappingUpdatedAction) HashSet(java.util.HashSet) TransportShardBulkAction(org.opensearch.action.bulk.TransportShardBulkAction) PeerRecoveryTargetService(org.opensearch.indices.recovery.PeerRecoveryTargetService) TransportCreateIndexAction(org.opensearch.action.admin.indices.create.TransportCreateIndexAction) Matchers.iterableWithSize(org.hamcrest.Matchers.iterableWithSize) SearchResponse(org.opensearch.action.search.SearchResponse) PutRepositoryAction(org.opensearch.action.admin.cluster.repositories.put.PutRepositoryAction) RepositoryData(org.opensearch.repositories.RepositoryData) Collections.emptyMap(java.util.Collections.emptyMap) Matchers.empty(org.hamcrest.Matchers.empty) ShardLimitValidator(org.opensearch.indices.ShardLimitValidator) IngestService(org.opensearch.ingest.IngestService) BlobStoreTestUtil(org.opensearch.repositories.blobstore.BlobStoreTestUtil) TransportRequest(org.opensearch.transport.TransportRequest) ActionTestUtils.assertNoFailureListener(org.opensearch.action.support.ActionTestUtils.assertNoFailureListener) CreateIndexResponse(org.opensearch.action.admin.indices.create.CreateIndexResponse) FsRepository(org.opensearch.repositories.fs.FsRepository) ShardRouting(org.opensearch.cluster.routing.ShardRouting) ClusterStateRequest(org.opensearch.action.admin.cluster.state.ClusterStateRequest) ClusterName(org.opensearch.cluster.ClusterName) Comparator(java.util.Comparator) LogManager(org.apache.logging.log4j.LogManager) IndicesModule(org.opensearch.indices.IndicesModule) Arrays(java.util.Arrays) ClusterBootstrapService(org.opensearch.cluster.coordination.ClusterBootstrapService) IndexScopedSettings(org.opensearch.common.settings.IndexScopedSettings) ClusterStateResponse(org.opensearch.action.admin.cluster.state.ClusterStateResponse) TransportInterceptor(org.opensearch.transport.TransportInterceptor) ClusterRerouteAction(org.opensearch.action.admin.cluster.reroute.ClusterRerouteAction) AllocationService(org.opensearch.cluster.routing.allocation.AllocationService) CleanupRepositoryAction(org.opensearch.action.admin.cluster.repositories.cleanup.CleanupRepositoryAction) RequestValidators(org.opensearch.action.RequestValidators) TransportNodesListGatewayStartedShards(org.opensearch.gateway.TransportNodesListGatewayStartedShards) PlainActionFuture(org.opensearch.action.support.PlainActionFuture) TransportCreateSnapshotAction(org.opensearch.action.admin.cluster.snapshots.create.TransportCreateSnapshotAction) SearchExecutionStatsCollector(org.opensearch.action.search.SearchExecutionStatsCollector) ActionListener(org.opensearch.action.ActionListener) ActionType(org.opensearch.action.ActionType) AbstractCoordinatorTestCase(org.opensearch.cluster.coordination.AbstractCoordinatorTestCase) CreateIndexRequest(org.opensearch.action.admin.indices.create.CreateIndexRequest) Repository(org.opensearch.repositories.Repository) MockSinglePrioritizingExecutor(org.opensearch.cluster.coordination.MockSinglePrioritizingExecutor) ScriptService(org.opensearch.script.ScriptService) Index(org.opensearch.index.Index) Set(java.util.Set) Settings(org.opensearch.common.settings.Settings) DiscoveryNodeRole(org.opensearch.cluster.node.DiscoveryNodeRole) ActionFilters(org.opensearch.action.support.ActionFilters) Matchers.contains(org.hamcrest.Matchers.contains) StepListener(org.opensearch.action.StepListener) Matchers.is(org.hamcrest.Matchers.is) Matchers.endsWith(org.hamcrest.Matchers.endsWith) TransportException(org.opensearch.transport.TransportException) RepositoriesService(org.opensearch.repositories.RepositoriesService) TransportDeleteSnapshotAction(org.opensearch.action.admin.cluster.snapshots.delete.TransportDeleteSnapshotAction) ClusterState(org.opensearch.cluster.ClusterState) TransportClusterStateAction(org.opensearch.action.admin.cluster.state.TransportClusterStateAction) SearchRequest(org.opensearch.action.search.SearchRequest) Environment(org.opensearch.env.Environment) SetOnce(org.apache.lucene.util.SetOnce) TransportIndicesShardStoresAction(org.opensearch.action.admin.indices.shards.TransportIndicesShardStoresAction) UpdateHelper(org.opensearch.action.update.UpdateHelper) VotingConfiguration(org.opensearch.cluster.coordination.CoordinationMetadata.VotingConfiguration) DeleteSnapshotRequest(org.opensearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest) SystemIndices(org.opensearch.indices.SystemIndices) PluginsService(org.opensearch.plugins.PluginsService) InMemoryPersistedState(org.opensearch.cluster.coordination.InMemoryPersistedState) NamedXContentRegistry(org.opensearch.common.xcontent.NamedXContentRegistry) ClusterService(org.opensearch.cluster.service.ClusterService) ClusterChangedEvent(org.opensearch.cluster.ClusterChangedEvent) BlobStoreRepository(org.opensearch.repositories.blobstore.BlobStoreRepository) Matchers.either(org.hamcrest.Matchers.either) MetadataDeleteIndexService(org.opensearch.cluster.metadata.MetadataDeleteIndexService) NoneCircuitBreakerService(org.opensearch.indices.breaker.NoneCircuitBreakerService) ClusterRerouteRequest(org.opensearch.action.admin.cluster.reroute.ClusterRerouteRequest) ThreadContext(org.opensearch.common.util.concurrent.ThreadContext) PrimaryReplicaSyncer(org.opensearch.index.shard.PrimaryReplicaSyncer) ClusterApplierService(org.opensearch.cluster.service.ClusterApplierService) TransportRestoreSnapshotAction(org.opensearch.action.admin.cluster.snapshots.restore.TransportRestoreSnapshotAction) TransportSearchAction(org.opensearch.action.search.TransportSearchAction) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) AnalysisRegistry(org.opensearch.index.analysis.AnalysisRegistry) After(org.junit.After) TransportCleanupRepositoryAction(org.opensearch.action.admin.cluster.repositories.cleanup.TransportCleanupRepositoryAction) IndicesClusterStateService(org.opensearch.indices.cluster.IndicesClusterStateService) DeterministicTaskQueue(org.opensearch.cluster.coordination.DeterministicTaskQueue) AdminClient(org.opensearch.client.AdminClient) IndicesService(org.opensearch.indices.IndicesService) PeerRecoverySourceService(org.opensearch.indices.recovery.PeerRecoverySourceService) CreateIndexAction(org.opensearch.action.admin.indices.create.CreateIndexAction) BatchedRerouteService(org.opensearch.cluster.routing.BatchedRerouteService) Nullable(org.opensearch.common.Nullable) ClusterModule(org.opensearch.cluster.ClusterModule) TransportAddress(org.opensearch.common.transport.TransportAddress) TransportAction(org.opensearch.action.support.TransportAction) List(java.util.List) GlobalCheckpointSyncAction(org.opensearch.index.seqno.GlobalCheckpointSyncAction) SearchSourceBuilder(org.opensearch.search.builder.SearchSourceBuilder) CoordinationState(org.opensearch.cluster.coordination.CoordinationState) Optional(java.util.Optional) TransportBulkAction(org.opensearch.action.bulk.TransportBulkAction) AllocateEmptyPrimaryAllocationCommand(org.opensearch.cluster.routing.allocation.command.AllocateEmptyPrimaryAllocationCommand) TestEnvironment(org.opensearch.env.TestEnvironment) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) MetaStateService(org.opensearch.gateway.MetaStateService) SnapshotsInProgress(org.opensearch.cluster.SnapshotsInProgress) HashMap(java.util.HashMap) ClusterStateListener(org.opensearch.cluster.ClusterStateListener) AutoCreateIndex(org.opensearch.action.support.AutoCreateIndex) NodeConnectionsService(org.opensearch.cluster.NodeConnectionsService) MetadataCreateIndexService(org.opensearch.cluster.metadata.MetadataCreateIndexService) DeleteIndexRequest(org.opensearch.action.admin.indices.delete.DeleteIndexRequest) NetworkModule(org.opensearch.common.network.NetworkModule) MetadataMappingService(org.opensearch.cluster.metadata.MetadataMappingService) RerouteService(org.opensearch.cluster.routing.RerouteService) NodeMappingRefreshAction(org.opensearch.cluster.action.index.NodeMappingRefreshAction) ClusterSettings(org.opensearch.common.settings.ClusterSettings) SearchService(org.opensearch.search.SearchService) CleanupRepositoryRequest(org.opensearch.action.admin.cluster.repositories.cleanup.CleanupRepositoryRequest) TransportDeleteIndexAction(org.opensearch.action.admin.indices.delete.TransportDeleteIndexAction) CreateSnapshotResponse(org.opensearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse) Collections.emptySet(java.util.Collections.emptySet) CleanupRepositoryResponse(org.opensearch.action.admin.cluster.repositories.cleanup.CleanupRepositoryResponse) ActiveShardCount(org.opensearch.action.support.ActiveShardCount) AcknowledgedResponse(org.opensearch.action.support.master.AcknowledgedResponse) TimeUnit(java.util.concurrent.TimeUnit) NODE_NAME_SETTING(org.opensearch.node.Node.NODE_NAME_SETTING) BulkResponse(org.opensearch.action.bulk.BulkResponse) IndexRequest(org.opensearch.action.index.IndexRequest) Collections(java.util.Collections) ClusterStateResponse(org.opensearch.action.admin.cluster.state.ClusterStateResponse) ClusterStateRequest(org.opensearch.action.admin.cluster.state.ClusterStateRequest) AllocateEmptyPrimaryAllocationCommand(org.opensearch.cluster.routing.allocation.command.AllocateEmptyPrimaryAllocationCommand) DeleteSnapshotRequest(org.opensearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ClusterRerouteRequest(org.opensearch.action.admin.cluster.reroute.ClusterRerouteRequest) MockEventuallyConsistentRepository(org.opensearch.snapshots.mockstore.MockEventuallyConsistentRepository) FsRepository(org.opensearch.repositories.fs.FsRepository) Repository(org.opensearch.repositories.Repository) BlobStoreRepository(org.opensearch.repositories.blobstore.BlobStoreRepository) AbstractRunnable(org.opensearch.common.util.concurrent.AbstractRunnable) StepListener(org.opensearch.action.StepListener) ShardRouting(org.opensearch.cluster.routing.ShardRouting) AdminClient(org.opensearch.client.AdminClient)

Aggregations

ClusterStateResponse (org.opensearch.action.admin.cluster.state.ClusterStateResponse)57 Settings (org.opensearch.common.settings.Settings)20 ClusterStateRequest (org.opensearch.action.admin.cluster.state.ClusterStateRequest)19 DiscoveryNode (org.opensearch.cluster.node.DiscoveryNode)19 List (java.util.List)16 NodeClient (org.opensearch.client.node.NodeClient)13 DiscoveryNodes (org.opensearch.cluster.node.DiscoveryNodes)13 RestRequest (org.opensearch.rest.RestRequest)12 GET (org.opensearch.rest.RestRequest.Method.GET)12 RestResponse (org.opensearch.rest.RestResponse)12 Table (org.opensearch.common.Table)11 ClusterState (org.opensearch.cluster.ClusterState)10 RestResponseListener (org.opensearch.rest.action.RestResponseListener)10 MockTransportService (org.opensearch.test.transport.MockTransportService)9 SearchResponse (org.opensearch.action.search.SearchResponse)8 Client (org.opensearch.client.Client)8 ShardRouting (org.opensearch.cluster.routing.ShardRouting)8 Strings (org.opensearch.common.Strings)8 Arrays.asList (java.util.Arrays.asList)7 Collections.unmodifiableList (java.util.Collections.unmodifiableList)7