Michael Blow has submitted this change and it was merged.

Change subject: ASTERIXDB-1473: Sporadic test failure in big_ob...
......................................................................


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 <[email protected]>
Tested-by: Jenkins <[email protected]>
Reviewed-by: abdullah alamoudi <[email protected]>
---
M 
hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/AsyncFIFOPageQueueManager.java
M 
hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
M 
hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/ClockPageReplacementStrategy.java
3 files changed, 20 insertions(+), 10 deletions(-)

Approvals:
  abdullah alamoudi: Looks good to me, approved
  Jenkins: Looks good to me, but someone else must approve; Verified



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) {

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/952
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4f932a148dc06bf6ee5142a876f28fa518f34560
Gerrit-PatchSet: 3
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <[email protected]>
Gerrit-Reviewer: Ian Maxon <[email protected]>
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Michael Blow <[email protected]>
Gerrit-Reviewer: Till Westmann <[email protected]>
Gerrit-Reviewer: abdullah alamoudi <[email protected]>

Reply via email to