Skip to content

Commit cfe13d8

Browse files
update index random function to fix the bogus document deletion
Signed-off-by: Neetika Singhal <neetiks@amazon.com>
1 parent 0a9dfec commit cfe13d8

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

server/src/internalClusterTest/java/org/opensearch/search/basic/TransportTwoNodesSearchIT.java

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ private Set<String> prepareData(int numShards) throws Exception {
128128
fullExpectedIds.add(Integer.toString(i));
129129
}
130130
refresh();
131+
indexRandomForConcurrentSearch("test");
131132
return fullExpectedIds;
132133
}
133134

server/src/internalClusterTest/java/org/opensearch/search/fetch/subphase/highlight/HighlighterSearchIT.java

-16
Original file line numberDiff line numberDiff line change
@@ -2013,10 +2013,6 @@ private static String randomStoreField() {
20132013
}
20142014

20152015
public void testHighlightNoMatchSize() throws IOException, InterruptedException {
2016-
assumeFalse(
2017-
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/10900",
2018-
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
2019-
);
20202016
assertAcked(
20212017
prepareCreate("test").setMapping(
20222018
"text",
@@ -2128,10 +2124,6 @@ public void testHighlightNoMatchSize() throws IOException, InterruptedException
21282124
}
21292125

21302126
public void testHighlightNoMatchSizeWithMultivaluedFields() throws IOException, InterruptedException {
2131-
assumeFalse(
2132-
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/10900",
2133-
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
2134-
);
21352127
assertAcked(
21362128
prepareCreate("test").setMapping(
21372129
"text",
@@ -2228,10 +2220,6 @@ public void testHighlightNoMatchSizeWithMultivaluedFields() throws IOException,
22282220
}
22292221

22302222
public void testHighlightNoMatchSizeNumberOfFragments() throws IOException, InterruptedException {
2231-
assumeFalse(
2232-
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/10900",
2233-
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
2234-
);
22352223
assertAcked(
22362224
prepareCreate("test").setMapping(
22372225
"text",
@@ -3416,10 +3404,6 @@ public void testFiltersFunctionScoreQueryHighlight() throws Exception {
34163404
}
34173405

34183406
public void testHighlightQueryRewriteDatesWithNow() throws Exception {
3419-
assumeFalse(
3420-
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/10434",
3421-
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
3422-
);
34233407
assertAcked(
34243408
client().admin()
34253409
.indices()

test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java

+15-6
Original file line numberDiff line numberDiff line change
@@ -1667,10 +1667,6 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma
16671667
}
16681668
assertThat(actualErrors, emptyIterable());
16691669

1670-
if (dummyDocuments) {
1671-
bogusIds.addAll(indexRandomForMultipleSlices(indicesArray));
1672-
}
1673-
16741670
if (!bogusIds.isEmpty()) {
16751671
// delete the bogus types again - it might trigger merges or at least holes in the segments and enforces deleted docs!
16761672
for (List<String> doc : bogusIds) {
@@ -1686,6 +1682,9 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma
16861682
client().admin().indices().prepareRefresh(indicesArray).setIndicesOptions(IndicesOptions.lenientExpandOpen()).get()
16871683
);
16881684
}
1685+
if (dummyDocuments) {
1686+
indexRandomForMultipleSlices(indicesArray);
1687+
}
16891688
}
16901689

16911690
/*
@@ -1694,7 +1693,7 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma
16941693
* multiple slices based on segment count.
16951694
* @param indices the indices in which bogus documents should be ingested
16961695
* */
1697-
protected Set<List<String>> indexRandomForMultipleSlices(String... indices) throws InterruptedException {
1696+
protected void indexRandomForMultipleSlices(String... indices) throws InterruptedException {
16981697
Set<List<String>> bogusIds = new HashSet<>();
16991698
int refreshCount = randomIntBetween(2, 3);
17001699
for (String index : indices) {
@@ -1731,7 +1730,17 @@ protected Set<List<String>> indexRandomForMultipleSlices(String... indices) thro
17311730
refresh(index);
17321731
}
17331732
}
1734-
return bogusIds;
1733+
if (!bogusIds.isEmpty()) {
1734+
// delete the bogus types again - it might trigger merges or at least holes in the segments and enforces deleted docs!
1735+
for (List<String> doc : bogusIds) {
1736+
assertEquals(
1737+
"failed to delete a dummy doc [" + doc.get(0) + "][" + doc.get(1) + "]",
1738+
DocWriteResponse.Result.DELETED,
1739+
client().prepareDelete(doc.get(0), doc.get(1)).setRouting(doc.get(1)).get().getResult()
1740+
);
1741+
}
1742+
}
1743+
refresh();
17351744
}
17361745

17371746
private final AtomicInteger dummmyDocIdGenerator = new AtomicInteger();

0 commit comments

Comments
 (0)