Skip to content

Commit

Permalink
TEST: testDocStats should always use forceMerge
Browse files Browse the repository at this point in the history
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 elastic#32449
  • Loading branch information
dnhatn committed Jul 28, 2018
1 parent 139631c commit 99014e7
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2376,15 +2376,12 @@ public void testRecoverFromLocalShard() throws IOException {
closeShards(sourceShard, targetShard);
}

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

// merge them away
final ForceMergeRequest forceMergeRequest = new ForceMergeRequest();
forceMergeRequest.onlyExpungeDeletes(randomBoolean());
forceMergeRequest.maxNumSegments(1);
indexShard.forceMerge(forceMergeRequest);

Expand Down

0 comments on commit 99014e7

Please sign in to comment.