Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update index random function to fix the bogus document deletion #11142

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ private Set<String> prepareData(int numShards) throws Exception {
fullExpectedIds.add(Integer.toString(i));
}
refresh();
indexRandomForConcurrentSearch("test");
return fullExpectedIds;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2013,10 +2013,6 @@ private static String randomStoreField() {
}

public void testHighlightNoMatchSize() throws IOException, InterruptedException {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/10900",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
assertAcked(
prepareCreate("test").setMapping(
"text",
Expand Down Expand Up @@ -2128,10 +2124,6 @@ public void testHighlightNoMatchSize() throws IOException, InterruptedException
}

public void testHighlightNoMatchSizeWithMultivaluedFields() throws IOException, InterruptedException {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/10900",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
assertAcked(
prepareCreate("test").setMapping(
"text",
Expand Down Expand Up @@ -2228,10 +2220,6 @@ public void testHighlightNoMatchSizeWithMultivaluedFields() throws IOException,
}

public void testHighlightNoMatchSizeNumberOfFragments() throws IOException, InterruptedException {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/10900",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
assertAcked(
prepareCreate("test").setMapping(
"text",
Expand Down Expand Up @@ -3416,10 +3404,6 @@ public void testFiltersFunctionScoreQueryHighlight() throws Exception {
}

public void testHighlightQueryRewriteDatesWithNow() throws Exception {
assumeFalse(
"Concurrent search case muted pending fix: https://github.com/opensearch-project/OpenSearch/issues/10434",
internalCluster().clusterService().getClusterSettings().get(CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING)
);
assertAcked(
client().admin()
.indices()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1667,10 +1667,6 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma
}
assertThat(actualErrors, emptyIterable());

if (dummyDocuments) {
bogusIds.addAll(indexRandomForMultipleSlices(indicesArray));
}

if (!bogusIds.isEmpty()) {
// delete the bogus types again - it might trigger merges or at least holes in the segments and enforces deleted docs!
for (List<String> doc : bogusIds) {
Expand All @@ -1686,6 +1682,9 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma
client().admin().indices().prepareRefresh(indicesArray).setIndicesOptions(IndicesOptions.lenientExpandOpen()).get()
);
}
if (dummyDocuments) {
indexRandomForMultipleSlices(indicesArray);
}
neetikasinghal marked this conversation as resolved.
Show resolved Hide resolved
}

/*
Expand All @@ -1694,7 +1693,7 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma
* multiple slices based on segment count.
* @param indices the indices in which bogus documents should be ingested
* */
protected Set<List<String>> indexRandomForMultipleSlices(String... indices) throws InterruptedException {
protected void indexRandomForMultipleSlices(String... indices) throws InterruptedException {
Set<List<String>> bogusIds = new HashSet<>();
int refreshCount = randomIntBetween(2, 3);
for (String index : indices) {
Expand Down Expand Up @@ -1731,7 +1730,15 @@ protected Set<List<String>> indexRandomForMultipleSlices(String... indices) thro
refresh(index);
}
}
return bogusIds;
for (List<String> doc : bogusIds) {
assertEquals(
"failed to delete a dummy doc [" + doc.get(0) + "][" + doc.get(1) + "]",
DocWriteResponse.Result.DELETED,
client().prepareDelete(doc.get(0), doc.get(1)).setRouting(doc.get(1)).get().getResult()
);
}
// refresh is called to make sure the bogus docs doesn't affect the search results
refresh();
}

private final AtomicInteger dummmyDocIdGenerator = new AtomicInteger();
Expand Down
Loading