From ee4e6b13828cf048fb6fd27c200ecc336815dfd7 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Sat, 21 Sep 2019 15:24:58 +0200 Subject: [PATCH] Add TestLogging for #46701 (#46939) (#46949) This at a very low rate and with the force merge in place before checking the cache size it's not clear why the cache is not of size `0` -> seems something else must be happening here that is unexpected. -> add debug logging to this test to find out Relates #46701 --- .../java/org/elasticsearch/indices/stats/IndexStatsIT.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java b/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java index eb0e564e92d..c4fb87dfc9e 100644 --- a/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java +++ b/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java @@ -62,6 +62,7 @@ import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; import org.elasticsearch.test.InternalSettingsPlugin; +import org.elasticsearch.test.junit.annotations.TestLogging; import java.io.IOException; import java.util.ArrayList; @@ -1007,6 +1008,7 @@ public class IndexStatsIT extends ESIntegTestCase { assertEquals(total, shardTotal); } + @TestLogging(value = "_root:DEBUG", reason = "https://github.com/elastic/elasticsearch/issues/46701") public void testFilterCacheStats() throws Exception { Settings settings = Settings.builder().put(indexSettings()) .put("number_of_replicas", 0) @@ -1064,11 +1066,14 @@ public class IndexStatsIT extends ESIntegTestCase { }); flush("index"); } + logger.info("--> force merging to a single segment"); ForceMergeResponse forceMergeResponse = client().admin().indices().prepareForceMerge("index").setFlush(true).setMaxNumSegments(1).get(); assertAllSuccessful(forceMergeResponse); + logger.info("--> refreshing"); refresh(); + logger.info("--> verifying that cache size is 0"); response = client().admin().indices().prepareStats("index").setQueryCache(true).get(); assertCumulativeQueryCacheStats(response); assertThat(response.getTotal().queryCache.getHitCount(), greaterThan(0L));