diff --git a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java index 7145bd1..8467ea5 100644 --- a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java +++ b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java @@ -844,8 +844,8 @@ public class FileStore extends AbstractFileStore { return -newGeneration; } - gcListener.info("TarMK GC #{}: compacted {} to {}", - GC_COUNT, before.getRecordId(), after.getRecordId()); + gcListener.info("TarMK GC #{}: compaction cycle 0 completed in {} ({} ms). Compacted {} to {}", + GC_COUNT, watch, watch.elapsed(MILLISECONDS), before.getRecordId(), after.getRecordId()); int cycles = 0; boolean success = false; @@ -859,6 +859,7 @@ public class FileStore extends AbstractFileStore { "Compacting these commits. Cycle {} of {}", GC_COUNT, cycles, gcOptions.getRetryCount()); gcListener.updateStatus(COMPACTION_RETRY.message() + cycles); + Stopwatch cycleWatch = Stopwatch.createStarted(); SegmentNodeState head = getHead(); after = compact(head, writer, cancel); @@ -867,8 +868,9 @@ public class FileStore extends AbstractFileStore { return -newGeneration; } - gcListener.info("TarMK GC #{}: compacted {} against {} to {}", - GC_COUNT, head.getRecordId(), before.getRecordId(), after.getRecordId()); + gcListener.info("TarMK GC #{}: compaction cycle {} completed in {} ({} ms). Compacted {} against {} to {}", + GC_COUNT, cycles, cycleWatch, cycleWatch.elapsed(MILLISECONDS), + head.getRecordId(), before.getRecordId(), after.getRecordId()); before = head; } @@ -877,20 +879,28 @@ public class FileStore extends AbstractFileStore { GC_COUNT, cycles); int forceTimeout = gcOptions.getForceTimeout(); if (forceTimeout > 0) { - gcListener.info("TarMK GC #{}: trying to force compact remaining commits for {} seconds", + gcListener.info("TarMK GC #{}: trying to force compact remaining commits for {} seconds. " + + "Concurrent commits to the store will be blocked.", GC_COUNT, forceTimeout); gcListener.updateStatus(COMPACTION_FORCE_COMPACT.message()); + Stopwatch forceWatch = Stopwatch.createStarted(); cycles++; success = forceCompact(writer, or(cancel, timeOut(forceTimeout, SECONDS))); if (!success) { if (cancel.get()) { - gcListener.warn("TarMK GC #{}: compaction failed to force compact remaining commits. " + - "Compaction was cancelled: {}.", GC_COUNT, cancel); + gcListener.warn("TarMK GC #{}: compaction failed to force compact remaining commits " + + "after {} ({} ms). Compaction was cancelled: {}.", + GC_COUNT, forceWatch, forceWatch.elapsed(MILLISECONDS), cancel); } else { gcListener.warn("TarMK GC #{}: compaction failed to force compact remaining commits. " + - "Most likely compaction didn't get exclusive access to the store.", GC_COUNT); + "after {} ({} ms). Most likely compaction didn't get exclusive access to the store.", + GC_COUNT, forceWatch, forceWatch.elapsed(MILLISECONDS)); } + } else { + gcListener.info("TarMK GC #{}: compaction succeeded to force compact remaining commits " + + "after {} ({} ms).", + GC_COUNT, forceWatch, forceWatch.elapsed(MILLISECONDS)); } } } @@ -1110,7 +1120,7 @@ public class FileStore extends AbstractFileStore { for (TarReader oldReader : oldReaders) { closeAndLogOnFail(oldReader); File file = oldReader.getFile(); - gcListener.info("TarMK GC #{}: cleanup marking file for deletion: {}", GC_COUNT, file.getName()); + gcListener.info("cleanup marking file for deletion: {}", GC_COUNT, file.getName()); toRemove.addLast(file); }