Skip to content

Commit

Permalink
Core: also log byte size and doc count when we log slow merges
Browse files Browse the repository at this point in the history
Closes #8855

Closes #8853
  • Loading branch information
mikemccand committed Dec 9, 2014
1 parent 3ea2bb0 commit 9d3dc48
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -29,6 +29,7 @@

import java.io.IOException;
import java.util.Collections;
import java.util.Locale;
import java.util.Set;

/**
Expand Down Expand Up @@ -117,10 +118,17 @@ protected void doMerge(MergePolicy.OneMerge merge) throws IOException {
totalMergesNumDocs.inc(totalNumDocs);
totalMergesSizeInBytes.inc(totalSizeInBytes);
totalMerges.inc(took);
String message = String.format(Locale.ROOT,
"merge segment %s done: took %s, %,.1f MB, %,d docs",
merge.info == null ? "_na_" : merge.info.info.name,
TimeValue.timeValueMillis(took),
totalSizeInBytes/1024f/1024f,
totalNumDocs);

if (took > 20000) { // if more than 20 seconds, DEBUG log it
logger.debug("merge [{}] done, took [{}]", merge.info == null ? "_na_" : merge.info.info.name, TimeValue.timeValueMillis(took));
logger.debug(message);
} else if (logger.isTraceEnabled()) {
logger.trace("merge [{}] done, took [{}]", merge.info == null ? "_na_" : merge.info.info.name, TimeValue.timeValueMillis(took));
logger.trace(message);
}
}
}
Expand Down

0 comments on commit 9d3dc48

Please sign in to comment.