Skip to content

Commit b3a60e3

Browse files
andrershovAndrey Ershov
authored and
Andrey Ershov
committed
Remove assertion in testDocStats on deletedDocs counter (#32914)
testDocStats test is flaky and sometimes it's failing on jenkins and failure is not reproducible locally. The reason for this failure is in timing. If the number of deleted documents is greater than 33% of inserted documents, Lucene will schedule segments to merge if TieredMergePolicy is used (it's not the case for LogMergePolicy, but ES is only using TieredMergePolicy). If this merge is performed before stats are retrieved - we will get 0 for "deleted" counter. So basically this counter could be either 0 or numOfDeletedDocs at this point, but this is the too loose assertion and we decided to remove it at all. Closes #32766
1 parent ba38b2e commit b3a60e3

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,8 +2389,7 @@ public void testRecoverFromLocalShard() throws IOException {
23892389
closeShards(sourceShard, targetShard);
23902390
}
23912391

2392-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32766")
2393-
public void testDocStats() throws IOException {
2392+
public void testDocStats() throws IOException, InterruptedException {
23942393
IndexShard indexShard = null;
23952394
try {
23962395
indexShard = newStartedShard();
@@ -2439,8 +2438,6 @@ public void testDocStats() throws IOException {
24392438
assertTrue(searcher.reader().numDocs() <= docStats.getCount());
24402439
}
24412440
assertThat(docStats.getCount(), equalTo(numDocs));
2442-
// Lucene will delete a segment if all docs are deleted from it; this means that we lose the deletes when deleting all docs
2443-
assertThat(docStats.getDeleted(), equalTo(numDocsToDelete == numDocs ? 0 : numDocsToDelete));
24442441
}
24452442

24462443
// merge them away

0 commit comments

Comments
 (0)