ASTERIXDB-1473: Sporadic test failure in big_ob...
...ject_load_20M
On unsuccessful confiscate cycle, ensure FIFO queue is flushed
Change-Id: I4f932a148dc06bf6ee5142a876f28fa518f34560
Reviewed-on: https://asterix-gerrit.ics.uci.edu/952
Reviewed-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/AsyncFIFOPageQueueManager.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/AsyncFIFOPageQueueManager.java
index 114dcb8..b693c91 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/AsyncFIFOPageQueueManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/AsyncFIFOPageQueueManager.java
@@ -89,30 +89,38 @@
public void destroyQueue(){
poisoned.set(true);
- //Dummy cached page to act as poison pill
- CachedPage poisonPill = new CachedPage();
- poisonPill.setQueueInfo(new QueueInfo(true,true));
- if(writerThread == null){
- synchronized (this){
- if(writerThread == null) {
+ if (writerThread == null) {
+ synchronized (this) {
+ if (writerThread == null) {
return;
}
}
}
+ //Dummy cached page to act as poison pill
+ CachedPage poisonPill = new CachedPage();
+ poisonPill.setQueueInfo(new QueueInfo(true,true));
+
try{
- synchronized(poisonPill){
+ synchronized (poisonPill) {
queue.put(poisonPill);
while(queue.contains(poisonPill)){
poisonPill.wait();
}
}
} catch (InterruptedException e){
- e.printStackTrace();
+ Thread.currentThread().interrupt();
}
}
public void finishQueue() {
+ if (writerThread == null) {
+ synchronized (this) {
+ if (writerThread == null) {
+ return;
+ }
+ }
+ }
if(DEBUG) System.out.println("[FIFO] Finishing Queue");
try {
//Dummy cached page to act as low water mark
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 ceb8ca2..080c76f 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
@@ -473,6 +473,7 @@
Thread.currentThread().interrupt();
}
}
+ finishQueue();
}
throw new HyracksDataException("Unable to find free page in buffer cache after " + MAX_PIN_ATTEMPT_CYCLES +
" cycles (buffer cache undersized?)");
@@ -1314,6 +1315,7 @@
Thread.currentThread().interrupt();
}
}
+ finishQueue();
}
throw new HyracksDataException("Unable to find free page in buffer cache after " + MAX_PIN_ATTEMPT_CYCLES +
" cycles (buffer cache undersized?)");
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/ClockPageReplacementStrategy.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/ClockPageReplacementStrategy.java
index e397d66..c12f288 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/ClockPageReplacementStrategy.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/ClockPageReplacementStrategy.java
@@ -130,8 +130,8 @@
}
if (looped && clockPtr >= startClockPtr) {
cycleCount++;
- if (LOGGER.isLoggable(Level.WARNING)) {
- LOGGER.warning("completed " + cycleCount + "/" + MAX_UNSUCCESSFUL_CYCLE_COUNT
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.fine("completed " + cycleCount + "/" + MAX_UNSUCCESSFUL_CYCLE_COUNT
+ " clock cycle(s) without finding victim");
}
if (cycleCount >= MAX_UNSUCCESSFUL_CYCLE_COUNT) {