Author: mduerig
Date: Wed Oct 25 09:27:50 2017
New Revision: 1813260

URL: http://svn.apache.org/viewvc?rev=1813260&view=rev
Log:
OAK-6866: Force compaction timeout logs wrong number of seconds
Log the correct number of seconds spent in trying to force compact instead of 
the current time stamp

Modified:
    
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java?rev=1813260&r1=1813259&r2=1813260&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java
 Wed Oct 25 09:27:50 2017
@@ -818,7 +818,7 @@ public class FileStore extends AbstractF
                                         GC_COUNT, forceWatch, 
forceWatch.elapsed(MILLISECONDS), cancel);
                             } else {
                                 gcListener.warn("TarMK GC #{}: compaction 
failed to force compact remaining commits. " +
-                                        "after {} ({} ms). Most likely 
compaction didn't get exclusive access to the store.",
+                                        "after {} ({} ms). Could not acquire 
exclusive access to the node store.",
                                         GC_COUNT, forceWatch, 
forceWatch.elapsed(MILLISECONDS));
                             }
                         }
@@ -1105,6 +1105,7 @@ public class FileStore extends AbstractF
             private final FileStore store;
 
             private String reason;
+            private volatile long baseLine;
             private volatile long deadline;
 
             public CancelCompactionSupplier(@Nonnull FileStore store) {
@@ -1118,7 +1119,8 @@ public class FileStore extends AbstractF
              * cancellation took place has no effect.
              */
             public void timeOutAfter(final long duration, @Nonnull final 
TimeUnit unit) {
-                deadline = currentTimeMillis() + 
MILLISECONDS.convert(duration, unit);
+                baseLine = currentTimeMillis();
+                deadline = baseLine + MILLISECONDS.convert(duration, unit);
             }
 
             @Override
@@ -1143,7 +1145,8 @@ public class FileStore extends AbstractF
                     return true;
                 }
                 if (deadline > 0 && currentTimeMillis() > deadline) {
-                    reason = "Timeout after " + deadline/1000 + " seconds";
+                    long dt = SECONDS.convert(currentTimeMillis() - baseLine, 
MILLISECONDS);
+                    reason = "Timeout after " + dt + " seconds";
                     return true;
                 }
                 return false;


Reply via email to