Skip to content

Commit

Permalink
Revert "fix flaky tests in SegmentReplicationPressureIT (opensearch-p…
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishikesh1159 committed Mar 29, 2023
1 parent 027d8c7 commit 715c4c8
Showing 1 changed file with 3 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.opensearch.common.util.concurrent.OpenSearchRejectedExecutionException;
import org.opensearch.index.shard.IndexShard;
import org.opensearch.indices.replication.SegmentReplicationBaseIT;
import org.opensearch.indices.replication.common.ReplicationType;
import org.opensearch.plugins.Plugin;
import org.opensearch.rest.RestStatus;
import org.opensearch.test.OpenSearchIntegTestCase;
Expand Down Expand Up @@ -53,24 +52,12 @@ protected Settings nodeSettings(int nodeOrdinal) {
.build();
}

@Override
public Settings indexSettings() {
// we want to control refreshes
return Settings.builder()
.put(super.indexSettings())
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, SHARD_COUNT)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, REPLICA_COUNT)
.put(IndexModule.INDEX_QUERY_CACHE_ENABLED_SETTING.getKey(), false)
.put(IndexMetadata.SETTING_REPLICATION_TYPE, ReplicationType.SEGMENT)
.put("index.refresh_interval", -1)
.build();
}

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return asList(MockTransportService.TestPlugin.class);
}

@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/6671")
public void testWritesRejected() throws Exception {
final String primaryNode = internalCluster().startNode();
createIndex(INDEX_NAME);
Expand All @@ -89,10 +76,6 @@ public void testWritesRejected() throws Exception {
indexingThread.start();
indexingThread.join();
latch.await();

indexDoc();
totalDocs.incrementAndGet();
refresh(INDEX_NAME);
// index again while we are stale.
assertBusy(() -> {
expectThrows(OpenSearchRejectedExecutionException.class, () -> {
Expand All @@ -107,7 +90,6 @@ public void testWritesRejected() throws Exception {

// index another doc showing there is no pressure enforced.
indexDoc();
refresh(INDEX_NAME);
waitForSearchableDocs(totalDocs.incrementAndGet(), replicaNodes.toArray(new String[] {}));
verifyStoreContent();
}
Expand All @@ -116,6 +98,7 @@ public void testWritesRejected() throws Exception {
* This test ensures that a replica can be added while the index is under write block.
* Ensuring that only write requests are blocked.
*/
@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/6671")
public void testAddReplicaWhileWritesBlocked() throws Exception {
final String primaryNode = internalCluster().startNode();
createIndex(INDEX_NAME);
Expand All @@ -135,9 +118,6 @@ public void testAddReplicaWhileWritesBlocked() throws Exception {
indexingThread.start();
indexingThread.join();
latch.await();
indexDoc();
totalDocs.incrementAndGet();
refresh(INDEX_NAME);
// index again while we are stale.
assertBusy(() -> {
expectThrows(OpenSearchRejectedExecutionException.class, () -> {
Expand All @@ -162,7 +142,6 @@ public void testAddReplicaWhileWritesBlocked() throws Exception {

// index another doc showing there is no pressure enforced.
indexDoc();
refresh(INDEX_NAME);
waitForSearchableDocs(totalDocs.incrementAndGet(), replicaNodes.toArray(new String[] {}));
verifyStoreContent();
}
Expand Down Expand Up @@ -279,7 +258,7 @@ private void assertFailedRequests(BulkResponse response) {
}

private void indexDoc() {
client().prepareIndex(INDEX_NAME).setId(UUIDs.base64UUID()).setSource("{}", "{}").execute().actionGet();
client().prepareIndex(INDEX_NAME).setId(UUIDs.base64UUID()).setSource("{}", "{}").get();
}

private void assertEqualSegmentInfosVersion(List<String> replicaNames, IndexShard primaryShard) {
Expand Down

0 comments on commit 715c4c8

Please sign in to comment.