Confusing log entries when memory requirements are not met at start of OnRC
Protect only the compaction phase with the memory barrier.
@@ -613,9 +613,6 @@ public class FileStore extends AbstractFileStore {
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,6 +639,9 @@ public class FileStore extends AbstractFileStore {
if (sufficientEstimatedGain) {
if (!gcOptions.isPaused()) {
+ try (GCMemoryBarrier gcMemoryBarrier = new GCMemoryBarrier(
+ sufficientMemory, gcListener, GC_COUNT.get(), gcOptions))
+ {
CompactionResult compactionResult = compact.get();
if (compactionResult.isSuccess()) {
lastSuccessfullGC = System.currentTimeMillis();
@@ -649,11 +649,11 @@ public class FileStore extends AbstractFileStore {
gcListener.info("TarMK GC #{}: cleaning up after failed compaction", GC_COUNT);
}
fileReaper.add(cleanup(compactionResult));
+ }
} else {
gcListener.skipped("TarMK GC #{}: compaction paused", GC_COUNT);
}
}
- gcMemoryBarrier.close();
} finally {
compactionMonitor.finished();
gcListener.updateStatus(IDLE.message());
