Search in sources :

Example 81 with Tuple

use of org.opensearch.common.collect.Tuple in project OpenSearch by opensearch-project.

the class ChildrenToParentAggregatorTests method testParentChild.

public void testParentChild() throws IOException {
    Directory directory = newDirectory();
    RandomIndexWriter indexWriter = new RandomIndexWriter(random(), directory);
    final Map<String, Tuple<Integer, Integer>> expectedParentChildRelations = setupIndex(indexWriter);
    indexWriter.close();
    IndexReader indexReader = OpenSearchDirectoryReader.wrap(DirectoryReader.open(directory), new ShardId(new Index("foo", "_na_"), 1));
    // TODO set "maybeWrap" to true for IndexSearcher once #23338 is resolved
    IndexSearcher indexSearcher = newSearcher(indexReader, false, true);
    // verify with all documents
    testCase(new MatchAllDocsQuery(), indexSearcher, parent -> {
        int expectedTotalParents = 0;
        int expectedMinValue = Integer.MAX_VALUE;
        for (Tuple<Integer, Integer> expectedValues : expectedParentChildRelations.values()) {
            expectedTotalParents++;
            expectedMinValue = Math.min(expectedMinValue, expectedValues.v2());
        }
        assertEquals("Having " + parent.getDocCount() + " docs and aggregation results: " + parent, expectedTotalParents, parent.getDocCount());
        assertEquals(expectedMinValue, ((InternalMin) parent.getAggregations().get("in_parent")).getValue(), Double.MIN_VALUE);
        assertTrue(JoinAggregationInspectionHelper.hasValue(parent));
    });
    // verify for each children
    for (String parent : expectedParentChildRelations.keySet()) {
        testCase(new TermInSetQuery(IdFieldMapper.NAME, Uid.encodeId("child0_" + parent)), indexSearcher, aggregation -> {
            assertEquals("Expected one result for min-aggregation for parent: " + parent + ", but had aggregation-results: " + aggregation, 1, aggregation.getDocCount());
            assertEquals(expectedParentChildRelations.get(parent).v2(), ((InternalMin) aggregation.getAggregations().get("in_parent")).getValue(), Double.MIN_VALUE);
        });
    }
    indexReader.close();
    directory.close();
}
Also used : IndexSearcher(org.apache.lucene.search.IndexSearcher) Index(org.opensearch.index.Index) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) ShardId(org.opensearch.index.shard.ShardId) TermInSetQuery(org.apache.lucene.search.TermInSetQuery) IndexReader(org.apache.lucene.index.IndexReader) RandomIndexWriter(org.apache.lucene.index.RandomIndexWriter) Tuple(org.opensearch.common.collect.Tuple) Directory(org.apache.lucene.store.Directory)

Example 82 with Tuple

use of org.opensearch.common.collect.Tuple in project OpenSearch by opensearch-project.

the class ParentToChildrenAggregatorTests method testParentChildAsSubAgg.

public void testParentChildAsSubAgg() throws IOException {
    try (Directory directory = newDirectory()) {
        RandomIndexWriter indexWriter = new RandomIndexWriter(random(), directory);
        final Map<String, Tuple<Integer, Integer>> expectedParentChildRelations = setupIndex(indexWriter);
        indexWriter.close();
        try (IndexReader indexReader = OpenSearchDirectoryReader.wrap(DirectoryReader.open(directory), new ShardId(new Index("foo", "_na_"), 1))) {
            IndexSearcher indexSearcher = newSearcher(indexReader, false, true);
            AggregationBuilder request = new TermsAggregationBuilder("t").field("kwd").subAggregation(new ChildrenAggregationBuilder("children", CHILD_TYPE).subAggregation(new MinAggregationBuilder("min").field("number")));
            long expectedEvenChildCount = 0;
            double expectedEvenMin = Double.MAX_VALUE;
            long expectedOddChildCount = 0;
            double expectedOddMin = Double.MAX_VALUE;
            for (Map.Entry<String, Tuple<Integer, Integer>> e : expectedParentChildRelations.entrySet()) {
                if (Integer.valueOf(e.getKey().substring("parent".length())) % 2 == 0) {
                    expectedEvenChildCount += e.getValue().v1();
                    expectedEvenMin = Math.min(expectedEvenMin, e.getValue().v2());
                } else {
                    expectedOddChildCount += e.getValue().v1();
                    expectedOddMin = Math.min(expectedOddMin, e.getValue().v2());
                }
            }
            StringTerms result = searchAndReduce(indexSearcher, new MatchAllDocsQuery(), request, longField("number"), keywordField("kwd"));
            StringTerms.Bucket evenBucket = result.getBucketByKey("even");
            InternalChildren evenChildren = evenBucket.getAggregations().get("children");
            InternalMin evenMin = evenChildren.getAggregations().get("min");
            assertThat(evenChildren.getDocCount(), equalTo(expectedEvenChildCount));
            assertThat(evenMin.getValue(), equalTo(expectedEvenMin));
            if (expectedOddChildCount > 0) {
                StringTerms.Bucket oddBucket = result.getBucketByKey("odd");
                InternalChildren oddChildren = oddBucket.getAggregations().get("children");
                InternalMin oddMin = oddChildren.getAggregations().get("min");
                assertThat(oddChildren.getDocCount(), equalTo(expectedOddChildCount));
                assertThat(oddMin.getValue(), equalTo(expectedOddMin));
            } else {
                assertNull(result.getBucketByKey("odd"));
            }
        }
    }
}
Also used : IndexSearcher(org.apache.lucene.search.IndexSearcher) AggregationBuilder(org.opensearch.search.aggregations.AggregationBuilder) MinAggregationBuilder(org.opensearch.search.aggregations.metrics.MinAggregationBuilder) TermsAggregationBuilder(org.opensearch.search.aggregations.bucket.terms.TermsAggregationBuilder) Index(org.opensearch.index.Index) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) ShardId(org.opensearch.index.shard.ShardId) TermsAggregationBuilder(org.opensearch.search.aggregations.bucket.terms.TermsAggregationBuilder) StringTerms(org.opensearch.search.aggregations.bucket.terms.StringTerms) InternalMin(org.opensearch.search.aggregations.metrics.InternalMin) IndexReader(org.apache.lucene.index.IndexReader) MinAggregationBuilder(org.opensearch.search.aggregations.metrics.MinAggregationBuilder) Map(java.util.Map) HashMap(java.util.HashMap) RandomIndexWriter(org.apache.lucene.index.RandomIndexWriter) Tuple(org.opensearch.common.collect.Tuple) Directory(org.apache.lucene.store.Directory)

Example 83 with Tuple

use of org.opensearch.common.collect.Tuple in project OpenSearch by opensearch-project.

the class TransportTasksAction method nodeOperation.

private void nodeOperation(NodeTaskRequest nodeTaskRequest, ActionListener<NodeTasksResponse> listener) {
    TasksRequest request = nodeTaskRequest.tasksRequest;
    List<OperationTask> tasks = new ArrayList<>();
    processTasks(request, tasks::add);
    if (tasks.isEmpty()) {
        listener.onResponse(new NodeTasksResponse(clusterService.localNode().getId(), emptyList(), emptyList()));
        return;
    }
    AtomicArray<Tuple<TaskResponse, Exception>> responses = new AtomicArray<>(tasks.size());
    final AtomicInteger counter = new AtomicInteger(tasks.size());
    for (int i = 0; i < tasks.size(); i++) {
        final int taskIndex = i;
        ActionListener<TaskResponse> taskListener = new ActionListener<TaskResponse>() {

            @Override
            public void onResponse(TaskResponse response) {
                responses.setOnce(taskIndex, response == null ? null : new Tuple<>(response, null));
                respondIfFinished();
            }

            @Override
            public void onFailure(Exception e) {
                responses.setOnce(taskIndex, new Tuple<>(null, e));
                respondIfFinished();
            }

            private void respondIfFinished() {
                if (counter.decrementAndGet() != 0) {
                    return;
                }
                List<TaskResponse> results = new ArrayList<>();
                List<TaskOperationFailure> exceptions = new ArrayList<>();
                for (Tuple<TaskResponse, Exception> response : responses.asList()) {
                    if (response.v1() == null) {
                        assert response.v2() != null;
                        exceptions.add(new TaskOperationFailure(clusterService.localNode().getId(), tasks.get(taskIndex).getId(), response.v2()));
                    } else {
                        assert response.v2() == null;
                        results.add(response.v1());
                    }
                }
                listener.onResponse(new NodeTasksResponse(clusterService.localNode().getId(), results, exceptions));
            }
        };
        try {
            taskOperation(request, tasks.get(taskIndex), taskListener);
        } catch (Exception e) {
            taskListener.onFailure(e);
        }
    }
}
Also used : AtomicArray(org.opensearch.common.util.concurrent.AtomicArray) ArrayList(java.util.ArrayList) NodeShouldNotConnectException(org.opensearch.transport.NodeShouldNotConnectException) ResourceNotFoundException(org.opensearch.ResourceNotFoundException) FailedNodeException(org.opensearch.action.FailedNodeException) IOException(java.io.IOException) NoSuchNodeException(org.opensearch.action.NoSuchNodeException) TransportException(org.opensearch.transport.TransportException) ActionListener(org.opensearch.action.ActionListener) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) TaskOperationFailure(org.opensearch.action.TaskOperationFailure) Tuple(org.opensearch.common.collect.Tuple)

Example 84 with Tuple

use of org.opensearch.common.collect.Tuple in project OpenSearch by opensearch-project.

the class GoogleCloudStorageBlobContainerRetriesTests method testWriteBlobWithRetries.

public void testWriteBlobWithRetries() throws Exception {
    final int maxRetries = randomIntBetween(2, 10);
    final CountDown countDown = new CountDown(maxRetries);
    final byte[] bytes = randomBlobContent();
    httpServer.createContext("/upload/storage/v1/b/bucket/o", safeHandler(exchange -> {
        assertThat(exchange.getRequestURI().getQuery(), containsString("uploadType=multipart"));
        if (countDown.countDown()) {
            Optional<Tuple<String, BytesReference>> content = parseMultipartRequestBody(exchange.getRequestBody());
            assertThat(content.isPresent(), is(true));
            assertThat(content.get().v1(), equalTo("write_blob_max_retries"));
            if (Objects.deepEquals(bytes, BytesReference.toBytes(content.get().v2()))) {
                byte[] response = ("{\"bucket\":\"bucket\",\"name\":\"" + content.get().v1() + "\"}").getBytes(UTF_8);
                exchange.getResponseHeaders().add("Content-Type", "application/json");
                exchange.sendResponseHeaders(RestStatus.OK.getStatus(), response.length);
                exchange.getResponseBody().write(response);
            } else {
                exchange.sendResponseHeaders(HttpStatus.SC_BAD_REQUEST, -1);
            }
            return;
        }
        if (randomBoolean()) {
            if (randomBoolean()) {
                Streams.readFully(exchange.getRequestBody(), new byte[randomIntBetween(1, Math.max(1, bytes.length - 1))]);
            } else {
                Streams.readFully(exchange.getRequestBody());
                exchange.sendResponseHeaders(HttpStatus.SC_INTERNAL_SERVER_ERROR, -1);
            }
        }
    }));
    final BlobContainer blobContainer = createBlobContainer(maxRetries, null, null, null);
    try (InputStream stream = new InputStreamIndexInput(new ByteArrayIndexInput("desc", bytes), bytes.length)) {
        blobContainer.writeBlob("write_blob_max_retries", stream, bytes.length, false);
    }
    assertThat(countDown.isCountedDown(), is(true));
}
Also used : Arrays(java.util.Arrays) MockSecureSettings(org.opensearch.common.settings.MockSecureSettings) CountDown(org.opensearch.common.util.concurrent.CountDown) HttpStatus(org.apache.http.HttpStatus) StorageOptions(com.google.cloud.storage.StorageOptions) Strings(org.opensearch.common.Strings) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Locale(java.util.Locale) Map(java.util.Map) TOKEN_URI_SETTING(org.opensearch.repositories.gcs.GoogleCloudStorageClientSettings.TOKEN_URI_SETTING) SuppressForbidden(org.opensearch.common.SuppressForbidden) TimeValue(org.opensearch.common.unit.TimeValue) OpenSearchMockAPIBasedRepositoryIntegTestCase(org.opensearch.repositories.blobstore.OpenSearchMockAPIBasedRepositoryIntegTestCase) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) Settings(org.opensearch.common.settings.Settings) RestStatus(org.opensearch.rest.RestStatus) InetSocketAddress(java.net.InetSocketAddress) Nullable(org.opensearch.common.Nullable) Tuple(org.opensearch.common.collect.Tuple) Duration(org.threeten.bp.Duration) Objects(java.util.Objects) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) BytesArray(org.opensearch.common.bytes.BytesArray) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Optional(java.util.Optional) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) Matchers.is(org.hamcrest.Matchers.is) Matchers.anyOf(org.hamcrest.Matchers.anyOf) Matchers.containsString(org.hamcrest.Matchers.containsString) InetAddresses(org.opensearch.common.network.InetAddresses) BytesReference(org.opensearch.common.bytes.BytesReference) BeforeClass(org.junit.BeforeClass) BlobContainer(org.opensearch.common.blobstore.BlobContainer) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ByteSizeValue(org.opensearch.common.unit.ByteSizeValue) HashMap(java.util.HashMap) GoogleCloudStorageHttpHandler.getContentRangeEnd(fixture.gcs.GoogleCloudStorageHttpHandler.getContentRangeEnd) AtomicReference(java.util.concurrent.atomic.AtomicReference) JavaVersion(org.opensearch.bootstrap.JavaVersion) RetrySettings(com.google.api.gax.retrying.RetrySettings) Streams(org.opensearch.common.io.Streams) AbstractBlobContainerRetriesTestCase(org.opensearch.repositories.blobstore.AbstractBlobContainerRetriesTestCase) SocketTimeoutException(java.net.SocketTimeoutException) GoogleCloudStorageHttpHandler.parseMultipartRequestBody(fixture.gcs.GoogleCloudStorageHttpHandler.parseMultipartRequestBody) READ_TIMEOUT_SETTING(org.opensearch.repositories.gcs.GoogleCloudStorageClientSettings.READ_TIMEOUT_SETTING) UUIDs(org.opensearch.common.UUIDs) HttpTransportOptions(com.google.cloud.http.HttpTransportOptions) FakeOAuth2HttpHandler(fixture.gcs.FakeOAuth2HttpHandler) InputStreamIndexInput(org.opensearch.common.lucene.store.InputStreamIndexInput) GoogleCloudStorageHttpHandler.getContentRangeStart(fixture.gcs.GoogleCloudStorageHttpHandler.getContentRangeStart) UTF_8(java.nio.charset.StandardCharsets.UTF_8) RestUtils(org.opensearch.rest.RestUtils) IOException(java.io.IOException) TestUtils.createServiceAccount(org.opensearch.repositories.gcs.TestUtils.createServiceAccount) GoogleCloudStorageHttpHandler.getContentRangeLimit(fixture.gcs.GoogleCloudStorageHttpHandler.getContentRangeLimit) ENDPOINT_SETTING(org.opensearch.repositories.gcs.GoogleCloudStorageClientSettings.ENDPOINT_SETTING) CREDENTIALS_FILE_SETTING(org.opensearch.repositories.gcs.GoogleCloudStorageClientSettings.CREDENTIALS_FILE_SETTING) BlobPath(org.opensearch.common.blobstore.BlobPath) ByteArrayIndexInput(org.opensearch.common.lucene.store.ByteArrayIndexInput) StorageException(com.google.cloud.storage.StorageException) HttpHandler(com.sun.net.httpserver.HttpHandler) InputStream(java.io.InputStream) OpenSearchBlobStoreRepositoryIntegTestCase.randomBytes(org.opensearch.repositories.blobstore.OpenSearchBlobStoreRepositoryIntegTestCase.randomBytes) BytesReference(org.opensearch.common.bytes.BytesReference) Optional(java.util.Optional) InputStream(java.io.InputStream) BlobContainer(org.opensearch.common.blobstore.BlobContainer) InputStreamIndexInput(org.opensearch.common.lucene.store.InputStreamIndexInput) Matchers.containsString(org.hamcrest.Matchers.containsString) ByteArrayIndexInput(org.opensearch.common.lucene.store.ByteArrayIndexInput) CountDown(org.opensearch.common.util.concurrent.CountDown)

Example 85 with Tuple

use of org.opensearch.common.collect.Tuple in project OpenSearch by opensearch-project.

the class StableMasterDisruptionIT method testStaleMasterNotHijackingMajority.

/**
 * Tests that emulates a frozen elected master node that unfreezes and pushes its cluster state to other nodes that already are
 * following another elected master node. These nodes should reject this cluster state and prevent them from following the stale master.
 */
public void testStaleMasterNotHijackingMajority() throws Exception {
    final List<String> nodes = internalCluster().startNodes(3, Settings.builder().put(LeaderChecker.LEADER_CHECK_TIMEOUT_SETTING.getKey(), "1s").put(Coordinator.PUBLISH_TIMEOUT_SETTING.getKey(), "1s").build());
    ensureStableCluster(3);
    // Save the current master node as old master node, because that node will get frozen
    final String oldMasterNode = internalCluster().getMasterName();
    // Simulating a painful gc by suspending all threads for a long time on the current elected master node.
    SingleNodeDisruption masterNodeDisruption = new LongGCDisruption(random(), oldMasterNode);
    // Save the majority side
    final List<String> majoritySide = new ArrayList<>(nodes);
    majoritySide.remove(oldMasterNode);
    // Keeps track of the previous and current master when a master node transition took place on each node on the majority side:
    final Map<String, List<Tuple<String, String>>> masters = Collections.synchronizedMap(new HashMap<>());
    for (final String node : majoritySide) {
        masters.put(node, new ArrayList<>());
        internalCluster().getInstance(ClusterService.class, node).addListener(event -> {
            DiscoveryNode previousMaster = event.previousState().nodes().getMasterNode();
            DiscoveryNode currentMaster = event.state().nodes().getMasterNode();
            if (!Objects.equals(previousMaster, currentMaster)) {
                logger.info("--> node {} received new cluster state: {} \n and had previous cluster state: {}", node, event.state(), event.previousState());
                String previousMasterNodeName = previousMaster != null ? previousMaster.getName() : null;
                String currentMasterNodeName = currentMaster != null ? currentMaster.getName() : null;
                masters.get(node).add(new Tuple<>(previousMasterNodeName, currentMasterNodeName));
            }
        });
    }
    final CountDownLatch oldMasterNodeSteppedDown = new CountDownLatch(1);
    internalCluster().getInstance(ClusterService.class, oldMasterNode).addListener(event -> {
        if (event.state().nodes().getMasterNodeId() == null) {
            oldMasterNodeSteppedDown.countDown();
        }
    });
    internalCluster().setDisruptionScheme(masterNodeDisruption);
    logger.info("--> freezing node [{}]", oldMasterNode);
    masterNodeDisruption.startDisrupting();
    // Wait for majority side to elect a new master
    assertBusy(() -> {
        for (final Map.Entry<String, List<Tuple<String, String>>> entry : masters.entrySet()) {
            final List<Tuple<String, String>> transitions = entry.getValue();
            assertTrue(entry.getKey() + ": " + transitions, transitions.stream().anyMatch(transition -> transition.v2() != null));
        }
    });
    // The old master node is frozen, but here we submit a cluster state update task that doesn't get executed, but will be queued and
    // once the old master node un-freezes it gets executed. The old master node will send this update + the cluster state where it is
    // flagged as master to the other nodes that follow the new master. These nodes should ignore this update.
    internalCluster().getInstance(ClusterService.class, oldMasterNode).submitStateUpdateTask("sneaky-update", new ClusterStateUpdateTask(Priority.IMMEDIATE) {

        @Override
        public ClusterState execute(ClusterState currentState) {
            return ClusterState.builder(currentState).build();
        }

        @Override
        public void onFailure(String source, Exception e) {
            logger.warn(() -> new ParameterizedMessage("failure [{}]", source), e);
        }
    });
    // Save the new elected master node
    final String newMasterNode = internalCluster().getMasterName(majoritySide.get(0));
    logger.info("--> new detected master node [{}]", newMasterNode);
    // Stop disruption
    logger.info("--> unfreezing node [{}]", oldMasterNode);
    masterNodeDisruption.stopDisrupting();
    oldMasterNodeSteppedDown.await(30, TimeUnit.SECONDS);
    logger.info("--> [{}] stepped down as master", oldMasterNode);
    ensureStableCluster(3);
    assertThat(masters.size(), equalTo(2));
    for (Map.Entry<String, List<Tuple<String, String>>> entry : masters.entrySet()) {
        String nodeName = entry.getKey();
        List<Tuple<String, String>> transitions = entry.getValue();
        assertTrue("[" + nodeName + "] should not apply state from old master [" + oldMasterNode + "] but it did: " + transitions, transitions.stream().noneMatch(t -> oldMasterNode.equals(t.v2())));
    }
}
Also used : Arrays(java.util.Arrays) FollowersChecker(org.opensearch.cluster.coordination.FollowersChecker) Priority(org.opensearch.common.Priority) HashMap(java.util.HashMap) MockTransportService(org.opensearch.test.transport.MockTransportService) ParameterizedMessage(org.apache.logging.log4j.message.ParameterizedMessage) Strings(org.opensearch.common.Strings) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ClusterState(org.opensearch.cluster.ClusterState) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) Collections.singleton(java.util.Collections.singleton) LeaderChecker(org.opensearch.cluster.coordination.LeaderChecker) Map(java.util.Map) Coordinator(org.opensearch.cluster.coordination.Coordinator) SingleNodeDisruption(org.opensearch.test.disruption.SingleNodeDisruption) LongGCDisruption(org.opensearch.test.disruption.LongGCDisruption) Collection(java.util.Collection) Set(java.util.Set) Settings(org.opensearch.common.settings.Settings) Collectors(java.util.stream.Collectors) Plugin(org.opensearch.plugins.Plugin) Tuple(org.opensearch.common.collect.Tuple) Objects(java.util.Objects) TimeUnit(java.util.concurrent.TimeUnit) ClusterStateRequest(org.opensearch.action.admin.cluster.state.ClusterStateRequest) CountDownLatch(java.util.concurrent.CountDownLatch) Sets(org.opensearch.common.util.set.Sets) TwoPartitions(org.opensearch.test.disruption.NetworkDisruption.TwoPartitions) List(java.util.List) ClusterStateUpdateTask(org.opensearch.cluster.ClusterStateUpdateTask) Matchers.equalTo(org.hamcrest.Matchers.equalTo) ClusterService(org.opensearch.cluster.service.ClusterService) NetworkDisruption(org.opensearch.test.disruption.NetworkDisruption) NetworkLinkDisruptionType(org.opensearch.test.disruption.NetworkDisruption.NetworkLinkDisruptionType) OpenSearchIntegTestCase(org.opensearch.test.OpenSearchIntegTestCase) Collections(java.util.Collections) ClusterState(org.opensearch.cluster.ClusterState) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) ArrayList(java.util.ArrayList) ClusterStateUpdateTask(org.opensearch.cluster.ClusterStateUpdateTask) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterService(org.opensearch.cluster.service.ClusterService) LongGCDisruption(org.opensearch.test.disruption.LongGCDisruption) SingleNodeDisruption(org.opensearch.test.disruption.SingleNodeDisruption) ArrayList(java.util.ArrayList) List(java.util.List) ParameterizedMessage(org.apache.logging.log4j.message.ParameterizedMessage) HashMap(java.util.HashMap) Map(java.util.Map) Tuple(org.opensearch.common.collect.Tuple)

Aggregations

Tuple (org.opensearch.common.collect.Tuple)151 ArrayList (java.util.ArrayList)65 List (java.util.List)49 IOException (java.io.IOException)45 Collections (java.util.Collections)44 HashMap (java.util.HashMap)40 Map (java.util.Map)40 Settings (org.opensearch.common.settings.Settings)38 ClusterState (org.opensearch.cluster.ClusterState)34 HashSet (java.util.HashSet)28 ShardId (org.opensearch.index.shard.ShardId)28 Arrays (java.util.Arrays)27 Collectors (java.util.stream.Collectors)26 Set (java.util.Set)25 Index (org.opensearch.index.Index)25 BytesReference (org.opensearch.common.bytes.BytesReference)24 OpenSearchTestCase (org.opensearch.test.OpenSearchTestCase)24 CountDownLatch (java.util.concurrent.CountDownLatch)22 Version (org.opensearch.Version)21 Strings (org.opensearch.common.Strings)21