Skip to content

Commit 2ba6aac

Browse files
authored
Reduce runtime of PitMultiNodeIT by 6 minutes (#18167)
1 parent 987f4fa commit 2ba6aac

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

server/src/internalClusterTest/java/org/opensearch/search/pit/PitMultiNodeIT.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.opensearch.action.LatchedActionListener;
1414
import org.opensearch.action.admin.cluster.state.ClusterStateRequest;
1515
import org.opensearch.action.admin.cluster.state.ClusterStateResponse;
16-
import org.opensearch.action.admin.indices.flush.FlushRequest;
1716
import org.opensearch.action.admin.indices.stats.IndicesStatsRequest;
1817
import org.opensearch.action.admin.indices.stats.IndicesStatsResponse;
1918
import org.opensearch.action.search.CreatePitAction;
@@ -38,7 +37,6 @@
3837
import org.opensearch.test.ParameterizedStaticSettingsOpenSearchIntegTestCase;
3938
import org.opensearch.threadpool.TestThreadPool;
4039
import org.opensearch.threadpool.ThreadPool;
41-
import org.opensearch.transport.client.Requests;
4240
import org.junit.After;
4341
import org.junit.Assert;
4442
import org.junit.Before;
@@ -83,6 +81,7 @@ public static Collection<Object[]> parameters() {
8381
public void setupIndex() throws ExecutionException, InterruptedException {
8482
createIndex("index", Settings.builder().put("index.number_of_shards", 2).put("index.number_of_replicas", 0).build());
8583
client().prepareIndex("index").setId("1").setSource("field", "value").setRefreshPolicy(IMMEDIATE).execute().get();
84+
flush(); // clear the translog to ensure accurate stats
8685
ensureGreen();
8786
}
8887

@@ -95,6 +94,7 @@ public void testPit() throws Exception {
9594
CreatePitRequest request = new CreatePitRequest(TimeValue.timeValueDays(1), true);
9695
request.setIndices(new String[] { "index" });
9796
indexRandomForConcurrentSearch("index");
97+
flush(); // clear the translog to ensure accurate stats
9898
ActionFuture<CreatePitResponse> execute = client().execute(CreatePitAction.INSTANCE, request);
9999
CreatePitResponse pitResponse = execute.get();
100100
SearchResponse searchResponse = client().prepareSearch("index")
@@ -366,9 +366,6 @@ public void onFailure(Exception e) {}
366366

367367
public void validatePitStats(String index, long expectedPitCurrent, long expectedOpenContexts) throws ExecutionException,
368368
InterruptedException {
369-
// Clear the index transaction log
370-
FlushRequest flushRequest = Requests.flushRequest(index);
371-
client().admin().indices().flush(flushRequest).get();
372369
// Test stats
373370
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
374371
indicesStatsRequest.indices(index);
@@ -501,5 +498,4 @@ public void onFailure(Exception e) {}
501498
ThreadPool.terminate(testThreadPool, 500, TimeUnit.MILLISECONDS);
502499
}
503500
}
504-
505501
}

0 commit comments

Comments
 (0)