Skip to content

Commit e9382a8

Browse files
author
Vladimir Kotal
authored
report counts of history cache files (#2103)
1 parent 8619532 commit e9382a8

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/org/opensolaris/opengrok/history/FileHistoryCache.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import java.util.ListIterator;
5050
import java.util.Map;
5151
import java.util.concurrent.CountDownLatch;
52+
import java.util.concurrent.atomic.AtomicInteger;
5253
import java.util.logging.Level;
5354
import java.util.logging.Logger;
5455
import java.util.zip.GZIPInputStream;
@@ -381,12 +382,12 @@ private void finishStore(Repository repository, String latestRev) {
381382
// failure), do not create the CachedRevision file as this would
382383
// create confusion (once it starts working again).
383384
LOGGER.log(Level.WARNING,
384-
"Could not store history for repo {0}",
385+
"Could not store history for repository {0}",
385386
repository.getDirectoryName());
386387
} else {
387388
storeLatestCachedRevision(repository, latestRev);
388389
LOGGER.log(Level.FINE,
389-
"Done storing history for repo {0}",
390+
"Done storing history for repository {0}",
390391
repository.getDirectoryName());
391392
}
392393
}
@@ -415,7 +416,7 @@ public void store(History history, Repository repository)
415416
}
416417

417418
LOGGER.log(Level.FINE,
418-
"Storing history for repo {0}",
419+
"Storing history for repository {0}",
419420
new Object[] {repository.getDirectoryName()});
420421

421422
// Firstly store the history for the top-level directory.
@@ -471,6 +472,7 @@ public void store(History history, Repository repository)
471472
* which will be handled separately below.
472473
*/
473474
final File root = RuntimeEnvironment.getInstance().getSourceRootFile();
475+
int fileHistoryCount = 0;
474476
for (Map.Entry<String, List<HistoryEntry>> map_entry : map.entrySet()) {
475477
try {
476478
if (env.isHandleHistoryOfRenamedFiles() &&
@@ -484,8 +486,11 @@ public void store(History history, Repository repository)
484486

485487
doFileHistory(map_entry.getKey(), map_entry.getValue(),
486488
env, repository, null, root, false);
489+
fileHistoryCount++;
487490
}
488491

492+
LOGGER.log(Level.FINE, "Stored history for {0} files", fileHistoryCount);
493+
489494
if (!env.isHandleHistoryOfRenamedFiles()) {
490495
finishStore(repository, latestRev);
491496
return;
@@ -527,6 +532,7 @@ public void store(History history, Repository repository)
527532
}
528533
final Repository repositoryF = repository;
529534
final CountDownLatch latch = new CountDownLatch(renamed_map.size());
535+
AtomicInteger renamedFileHistoryCount = new AtomicInteger();
530536
for (final Map.Entry<String, List<HistoryEntry>> map_entry : renamed_map.entrySet()) {
531537
RuntimeEnvironment.getHistoryRenamedExecutor().submit(new Runnable() {
532538
@Override
@@ -536,6 +542,7 @@ public void run() {
536542
env, repositoryF,
537543
new File(env.getSourceRootPath() + map_entry.getKey()),
538544
root, true);
545+
renamedFileHistoryCount.getAndIncrement();
539546
} catch (Exception ex) {
540547
// We want to catch any exception since we are in thread.
541548
LOGGER.log(Level.WARNING,
@@ -554,6 +561,8 @@ public void run() {
554561
} catch (InterruptedException ex) {
555562
LOGGER.log(Level.SEVERE, "latch exception ",ex);
556563
}
564+
LOGGER.log(Level.FINE, "Stored history for {0} renamed files",
565+
renamedFileHistoryCount.intValue());
557566
finishStore(repository, latestRev);
558567
}
559568

0 commit comments

Comments
 (0)