From 2fa028cfa12067d81ac4bef875b5f8fa84bac5ac Mon Sep 17 00:00:00 2001 From: Andrey Ershov Date: Fri, 17 Aug 2018 12:36:45 +0200 Subject: [PATCH] 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 --- .../java/org/elasticsearch/index/shard/IndexShardTests.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java b/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java index 47be03b9917..2228e1b017f 100644 --- a/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java +++ b/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java @@ -2391,8 +2391,7 @@ public class IndexShardTests extends IndexShardTestCase { closeShards(sourceShard, targetShard); } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32766") - public void testDocStats() throws IOException { + public void testDocStats() throws IOException, InterruptedException { IndexShard indexShard = null; try { indexShard = newStartedShard(); @@ -2441,8 +2440,6 @@ public class IndexShardTests extends IndexShardTestCase { assertTrue(searcher.reader().numDocs() <= docStats.getCount()); } assertThat(docStats.getCount(), equalTo(numDocs)); - // Lucene will delete a segment if all docs are deleted from it; this means that we lose the deletes when deleting all docs - assertThat(docStats.getDeleted(), equalTo(numDocsToDelete == numDocs ? 0 : numDocsToDelete)); } // merge them away