Skip to content

Commit 47da214

Browse files
author
Vladimir Kotal
committed
report statistics for index optimization
1 parent 63b0eeb commit 47da214

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/org/opensolaris/opengrok/index/IndexDatabase.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
import org.opensolaris.opengrok.util.ForbiddenSymlinkException;
9999
import org.opensolaris.opengrok.util.IOUtils;
100100
import org.opensolaris.opengrok.util.ObjectPool;
101+
import org.opensolaris.opengrok.util.Statistics;
101102
import org.opensolaris.opengrok.web.Util;
102103

103104
/**
@@ -597,6 +598,7 @@ public void optimize() throws IOException {
597598
IndexWriter wrt = null;
598599
IOException writerException = null;
599600
try {
601+
Statistics elapsed = new Statistics();
600602
String projectDetail = this.project != null ? " for project " + project.getName() : "";
601603
LOGGER.log(Level.INFO, "Optimizing the index{0}", projectDetail);
602604
Analyzer analyzer = new StandardAnalyzer();
@@ -605,7 +607,7 @@ public void optimize() throws IOException {
605607

606608
wrt = new IndexWriter(indexDirectory, conf);
607609
wrt.forceMerge(1); // this is deprecated and not needed anymore
608-
LOGGER.log(Level.INFO, "Done optimizing index{0}", projectDetail);
610+
elapsed.report(LOGGER, String.format("Done optimizing index%s", projectDetail));
609611
synchronized (lock) {
610612
if (dirtyFile.exists() && !dirtyFile.delete()) {
611613
LOGGER.log(Level.FINE, "Failed to remove \"dirty-file\": {0}",

0 commit comments

Comments
 (0)