ASTERIXDB-1570 Debugging
Report how many pins took place on extended pin cycles, in case the
failures are due to unfair queueing
Change-Id: I16a3316d9f6f1d436873c051bd0f260126483ceb
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1282
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
index 28ba981..3be1c46 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
@@ -35,6 +35,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
@@ -82,6 +83,7 @@
//!DEBUG
private IIOReplicationManager ioReplicationManager;
private final List<ICachedPageInternal> cachedPages = new ArrayList<>();
+ private final AtomicLong masterPinCount = new AtomicLong();
private boolean closed;
@@ -1245,6 +1247,7 @@
private ICachedPage getPageLoop(long dpid, int multiplier, boolean confiscate)
throws HyracksDataException {
+ final long startingPinCount = masterPinCount.get();
int cycleCount = 0;
try {
while (true) {
@@ -1252,6 +1255,7 @@
int startCleanedCount = cleanerThread.cleanedCount;
ICachedPage page = confiscate ? confiscateInner(dpid, multiplier) : findPageInner(dpid);
if (page != null) {
+ masterPinCount.incrementAndGet();
return page;
}
// no page available to confiscate. try kicking the cleaner thread.
@@ -1286,13 +1290,15 @@
if (cycleCount > MAX_PIN_ATTEMPT_CYCLES) {
cycleCount = 0; // suppress warning below
throw new HyracksDataException("Unable to find free page in buffer cache after "
- + MAX_PIN_ATTEMPT_CYCLES + " cycles (buffer cache undersized?)");
+ + MAX_PIN_ATTEMPT_CYCLES + " cycles (buffer cache undersized?); "
+ + (masterPinCount.get() - startingPinCount) + " successful pins since start of cycle");
}
}
} finally {
if (cycleCount > PIN_ATTEMPT_CYCLES_WARNING_THRESHOLD && LOGGER.isLoggable(Level.WARNING)) {
LOGGER.warning("Took " + cycleCount + " cycles to find free page in buffer cache. (buffer cache " +
- "undersized?)");
+ "undersized?); " + (masterPinCount.get() - startingPinCount) +
+ " successful pins since start of cycle");
}
}
}