Skip to content

Commit 5b1ad80

Browse files
authored
TEST: testDocStats should always use forceMerge (#32450)
Due to the recent change in LUCENE-8263, we need to adjust the deletion ration to between 10% to 33% to preserve the current behavior of the test. However, we may need another refinement if soft-deletes is enabled as the actual deletes are different because of delete tombstones. This commit prefers to always execute forceMerge instead of adjusting the deletion ratio so that this test can focus on testing docStats. Closes #32449
1 parent 6e98615 commit 5b1ad80

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,15 +2376,12 @@ public void testRecoverFromLocalShard() throws IOException {
23762376
closeShards(sourceShard, targetShard);
23772377
}
23782378

2379-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32449")
23802379
public void testDocStats() throws IOException {
23812380
IndexShard indexShard = null;
23822381
try {
23832382
indexShard = newStartedShard();
23842383
final long numDocs = randomIntBetween(2, 32); // at least two documents so we have docs to delete
2385-
// Delete at least numDocs/10 documents otherwise the number of deleted docs will be below 10%
2386-
// and forceMerge will refuse to expunge deletes
2387-
final long numDocsToDelete = randomIntBetween((int) Math.ceil(Math.nextUp(numDocs / 10.0)), Math.toIntExact(numDocs));
2384+
final long numDocsToDelete = randomLongBetween(1, numDocs);
23882385
for (int i = 0; i < numDocs; i++) {
23892386
final String id = Integer.toString(i);
23902387
indexDoc(indexShard, "_doc", id);
@@ -2434,7 +2431,6 @@ public void testDocStats() throws IOException {
24342431

24352432
// merge them away
24362433
final ForceMergeRequest forceMergeRequest = new ForceMergeRequest();
2437-
forceMergeRequest.onlyExpungeDeletes(randomBoolean());
24382434
forceMergeRequest.maxNumSegments(1);
24392435
indexShard.forceMerge(forceMergeRequest);
24402436

0 commit comments

Comments
 (0)