Skip to content

Commit

Permalink
Fix AllocationIdIT and ClusterShardLimitIT
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Kale <[email protected]>
  • Loading branch information
Sachin Kale committed Oct 18, 2023
1 parent cc54931 commit a19ea05
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;

@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.SUITE, numDataNodes = 0)
@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0)
public class AllocationIdIT extends OpenSearchIntegTestCase {

@Override
Expand Down Expand Up @@ -170,10 +170,15 @@ public void testFailedRecoveryOnAllocateStalePrimaryRequiresAnotherAllocateStale
node2 = internalCluster().startNode(node2DataPathSettings);
ensureGreen(indexName);

assertThat(historyUUID(node1, indexName), not(equalTo(historyUUID)));
// historyUUID remains same as we are fetching data from remote store
assertThat(historyUUID(node1, indexName), equalTo(historyUUID));
assertThat(historyUUID(node1, indexName), equalTo(historyUUID(node2, indexName)));

internalCluster().assertSameDocIdsOnShards();

// This is only applicable for remote store as we restore the entire data
assertHitCount(client(node1).prepareSearch(indexName).setQuery(matchAllQuery()).get(), numDocs + numExtraDocs);
assertHitCount(client(node2).prepareSearch(indexName).setQuery(matchAllQuery()).get(), numDocs + numExtraDocs);
}

public void checkHealthStatus(String indexName, ClusterHealthStatus healthStatus) {
Expand All @@ -189,7 +194,7 @@ private int indexDocs(String indexName, Object... source) throws InterruptedExce
// index some docs in several segments
int numDocs = 0;
for (int k = 0, attempts = randomIntBetween(5, 10); k < attempts; k++) {
final int numExtraDocs = between(10, 100);
final int numExtraDocs = between(10, 20);
IndexRequestBuilder[] builders = new IndexRequestBuilder[numExtraDocs];
for (int i = 0; i < builders.length; i++) {
builders[i] = client().prepareIndex(indexName).setSource(source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ public void testOpenIndexOverLimit() {
public void testIgnoreDotSettingOnMultipleNodes() throws IOException, InterruptedException {
int maxAllowedShardsPerNode = 10, indexPrimaryShards = 11, indexReplicaShards = 1;

this.nodeAttributeSettings = null;
InternalTestCluster cluster = new InternalTestCluster(
randomLong(),
createTempDir(),
Expand Down Expand Up @@ -647,6 +648,8 @@ public Path nodeConfigPath(int nodeOrdinal) {
);
cluster.beforeTest(random());

OpenSearchIntegTestCase.remoteStoreNodeAttributeCluster = cluster;

// Starting 3 ClusterManagerOnlyNode nodes
cluster.startClusterManagerOnlyNode(Settings.builder().put("cluster.ignore_dot_indexes", true).build());
cluster.startClusterManagerOnlyNode(Settings.builder().put("cluster.ignore_dot_indexes", false).build());
Expand All @@ -656,6 +659,8 @@ public Path nodeConfigPath(int nodeOrdinal) {
cluster.startDataOnlyNode(Settings.builder().put("cluster.ignore_dot_indexes", false).build());
cluster.startDataOnlyNode(Settings.builder().put("cluster.ignore_dot_indexes", false).build());

OpenSearchIntegTestCase.remoteStoreNodeAttributeCluster = null;

// Setting max shards per node to be 10
cluster.client()
.admin()
Expand Down

0 comments on commit a19ea05

Please sign in to comment.