Skip to content

Commit d0e65a4

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 8843832 commit d0e65a4

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
@@ -1718,13 +1718,20 @@ public CommitId flush(boolean force, boolean waitIfOngoing) throws EngineExcepti
17181718
try {
17191719
// Only flush if (1) Lucene has uncommitted docs, or (2) forced by caller, or (3) the
17201720
// newly created commit points to a different translog generation (can free translog)
1721-
if (indexWriter.hasUncommittedChanges() || force || shouldPeriodicallyFlush()) {
1721+
boolean hasUncommittedChanges = indexWriter.hasUncommittedChanges();
1722+
boolean shouldPeriodicallyFlush = shouldPeriodicallyFlush();
1723+
if (hasUncommittedChanges || force || shouldPeriodicallyFlush) {
17221724
ensureCanFlush();
17231725
try {
17241726
translog.rollGeneration();
17251727
logger.trace("starting commit for flush; commitTranslog=true");
17261728
commitIndexWriter(indexWriter, translog, null);
17271729
logger.trace("finished commit for flush");
1730+
1731+
// a temporary debugging to investigate test failure - issue#32827. Remove when the issue is resolved
1732+
logger.debug("new commit on flush, hasUncommittedChanges:{}, force:{}, shouldPeriodicallyFlush:{}",
1733+
hasUncommittedChanges, force, shouldPeriodicallyFlush);
1734+
17281735
// we need to refresh in order to clear older version values
17291736
refresh("version_table_flush", SearcherScope.INTERNAL, true);
17301737
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)