Author: mduerig
Date: Thu Sep  7 13:02:35 2017
New Revision: 1807600

URL: http://svn.apache.org/viewvc?rev=1807600&view=rev
Log:
OAK-6634: Confusing log entries when memory requirements are not met at start 
of OnRC
Protect only the compaction phase with the memory barrier.

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=1807600&r1=1807599&r2=1807600&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
 Thu Sep  7 13:02:35 2017
@@ -613,9 +613,6 @@ public class FileStore extends AbstractF
                     return;
                 }
 
-                GCMemoryBarrier gcMemoryBarrier = new GCMemoryBarrier(
-                        sufficientMemory, gcListener, GC_COUNT.get(), 
gcOptions);
-    
                 boolean sufficientEstimatedGain = true;
                 if (gcOptions.isEstimationDisabled()) {
                     gcListener.info("TarMK GC #{}: estimation skipped because 
it was explicitly disabled", GC_COUNT);
@@ -642,18 +639,21 @@ public class FileStore extends AbstractF
     
                 if (sufficientEstimatedGain) {
                     if (!gcOptions.isPaused()) {
-                        CompactionResult compactionResult = compact.get();
-                        if (compactionResult.isSuccess()) {
-                            lastSuccessfullGC = System.currentTimeMillis();
-                        } else {
-                            gcListener.info("TarMK GC #{}: cleaning up after 
failed compaction", GC_COUNT);
+                        try (GCMemoryBarrier gcMemoryBarrier = new 
GCMemoryBarrier(
+                                sufficientMemory, gcListener, GC_COUNT.get(), 
gcOptions))
+                        {
+                            CompactionResult compactionResult = compact.get();
+                            if (compactionResult.isSuccess()) {
+                                lastSuccessfullGC = System.currentTimeMillis();
+                            } else {
+                                gcListener.info("TarMK GC #{}: cleaning up 
after failed compaction", GC_COUNT);
+                            }
+                            fileReaper.add(cleanup(compactionResult));
                         }
-                        fileReaper.add(cleanup(compactionResult));
                     } else {
                         gcListener.skipped("TarMK GC #{}: compaction paused", 
GC_COUNT);
                     }
                 }
-                gcMemoryBarrier.close();
             } finally {
                 compactionMonitor.finished();
                 gcListener.updateStatus(IDLE.message());


Reply via email to