Skip to content

Commit 29938b1

Browse files
Add debug log for flush for IndicesRequestCacheIT (#39475)
Add debug log when index is flushed to investigate a failure in IndicesRequestCacheIT "DEBUG" level is used as "TRACE" produces too much output irrelevant for this issue Relates to #32827
1 parent ca94d72 commit 29938b1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

server/src/main/java/org/elasticsearch/index/engine/InternalEngine.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1715,13 +1715,20 @@ public CommitId flush(boolean force, boolean waitIfOngoing) throws EngineExcepti
17151715
try {
17161716
// Only flush if (1) Lucene has uncommitted docs, or (2) forced by caller, or (3) the
17171717
// newly created commit points to a different translog generation (can free translog)
1718-
if (indexWriter.hasUncommittedChanges() || force || shouldPeriodicallyFlush()) {
1718+
boolean hasUncommittedChanges = indexWriter.hasUncommittedChanges();
1719+
boolean shouldPeriodicallyFlush = shouldPeriodicallyFlush();
1720+
if (hasUncommittedChanges || force || shouldPeriodicallyFlush) {
17191721
ensureCanFlush();
17201722
try {
17211723
translog.rollGeneration();
17221724
logger.trace("starting commit for flush; commitTranslog=true");
17231725
commitIndexWriter(indexWriter, translog, null);
17241726
logger.trace("finished commit for flush");
1727+
1728+
// a temporary debugging to investigate test failure - issue#32827. Remove when the issue is resolved
1729+
logger.debug("new commit on flush, hasUncommittedChanges:{}, force:{}, shouldPeriodicallyFlush:{}",
1730+
hasUncommittedChanges, force, shouldPeriodicallyFlush);
1731+
17251732
// we need to refresh in order to clear older version values
17261733
refresh("version_table_flush", SearcherScope.INTERNAL, true);
17271734
translog.trimUnreferencedReaders();

server/src/test/java/org/elasticsearch/indices/IndicesRequestCacheIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
import static org.hamcrest.Matchers.equalTo;
5252
import static org.hamcrest.Matchers.greaterThan;
5353

54-
@TestLogging(value = "org.elasticsearch.indices.IndicesRequestCache:TRACE")
54+
@TestLogging(value = "org.elasticsearch.indices.IndicesRequestCache:TRACE,org.elasticsearch.index.engine.Engine:DEBUG")
5555
public class IndicesRequestCacheIT extends ESIntegTestCase {
5656

5757
// One of the primary purposes of the query cache is to cache aggs results

0 commit comments

Comments
 (0)