nit0906 commented on code in PR #1621:
URL: https://github.com/apache/jackrabbit-oak/pull/1621#discussion_r1703678977
##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexerBase.java:
##########
@@ -350,15 +352,29 @@ public void reindex() throws CommitFailedException,
IOException {
INDEXING_PHASE_LOGGER.info("[TASK:INDEXING:START] Starting
indexing");
Stopwatch indexerWatch = Stopwatch.createStarted();
try {
-
if (flatFileStores.size() > 1) {
indexParallel(flatFileStores, indexer, progressReporter);
} else if (flatFileStores.size() == 1) {
FlatFileStore flatFileStore = flatFileStores.get(0);
+ TopKSlowestPaths slowestTopKElements = new
TopKSlowestPaths(TOP_SLOWEST_PATHS_TO_LOG);
+ long entryStart = System.nanoTime();
for (NodeStateEntry entry : flatFileStore) {
reportDocumentRead(entry.getPath(), progressReporter);
indexer.index(entry);
+ // Avoid calling System.nanoTime() twice per each
entry, by reusing the timestamp taken at the end
+ // of indexing an entry as the start time of the
following entry. This is less accurate, because
+ // the measured times will also include the
bookkeeping at the end of indexing each entry, but
+ // we are only interested in entries that take a
significant time to index, so this extra
+ // inaccuracy will not significantly change the
results.
+ long entryEnd = System.nanoTime();
+ long elapsedMillis = (entryEnd - entryStart) /
1_000_000;
+ entryStart = entryEnd;
+ slowestTopKElements.add(entry.getPath(),
elapsedMillis);
+ if (elapsedMillis > 1000) {
+ log.info("Indexing {} took {} ms",
entry.getPath(), elapsedMillis);
+ }
}
+ log.info("Top slowest nodes to index (ms): {}",
slowestTopKElements);
Review Comment:
Would it make sense to log the content of the nodes as well ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]