asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mhub...@apache.org
Subject asterixdb git commit: [ASTERIXDB-1961][IDX] Prevent NPE in cursor during cancellation
Date Wed, 28 Jun 2017 15:55:30 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 1308eae51 -> 54384a377


[ASTERIXDB-1961][IDX] Prevent NPE in cursor during cancellation

- user model changes: no
- interface changes: no
- storage format changes: no

Details:
- Prevent NPE in cursor when an interruption happens during
cursors initialization.
- Keep track of interruption stack trace to help in diagnosing
future similar issues.

Change-Id: I6937d14bc79d6583bb62c1d7b726ab0f26a59d79
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1856
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/54384a37
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/54384a37
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/54384a37

Branch: refs/heads/master
Commit: 54384a377e3870310a462758ddda3d6f799972b7
Parents: 1308eae
Author: Murtadha Hubail <mhubail@uci.edu>
Authored: Wed Jun 28 17:26:03 2017 +0300
Committer: Murtadha Hubail <hubailmor@gmail.com>
Committed: Wed Jun 28 08:54:59 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/hyracks/control/nc/Task.java   | 17 ++++++++++++++++-
 .../am/lsm/common/impls/LSMIndexSearchCursor.java  | 10 +++++++---
 2 files changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/54384a37/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
index d689bc0..ad4881a 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
@@ -280,6 +280,7 @@ public class Task implements IHyracksTaskContext, ICounterContext, Runnable
{
         }
         ct.setName(displayName + ":" + taskAttemptId + ":" + 0);
         try {
+            Exception operatorException = null;
             try {
                 operator.initialize();
                 if (collectors.length > 0) {
@@ -318,8 +319,22 @@ public class Task implements IHyracksTaskContext, ICounterContext, Runnable
{
                         sem.acquire(collectors.length - 1);
                     }
                 }
+            } catch (Exception e) {
+                // Store the operator exception
+                operatorException = e;
+                throw e;
             } finally {
-                operator.deinitialize();
+                try {
+                    operator.deinitialize();
+                } catch (Exception e) {
+                    if (operatorException != null) {
+                        // Add deinitialize exception to the operator exception to keep track
of both
+                        operatorException.addSuppressed(e);
+                    } else {
+                        operatorException = e;
+                    }
+                    throw operatorException;
+                }
             }
             NodeControllerService ncs = joblet.getNodeController();
             ncs.getWorkQueue().schedule(new NotifyTaskCompleteWork(ncs, this));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/54384a37/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMIndexSearchCursor.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMIndexSearchCursor.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMIndexSearchCursor.java
index f99a859..724a909 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMIndexSearchCursor.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMIndexSearchCursor.java
@@ -137,10 +137,14 @@ public abstract class LSMIndexSearchCursor implements ITreeIndexCursor
{
             if (outputPriorityQueue != null) {
                 outputPriorityQueue.clear();
             }
-            for (int i = 0; i < rangeCursors.length; i++) {
-                rangeCursors[i].close();
+            if (rangeCursors != null) {
+                for (int i = 0; i < rangeCursors.length; i++) {
+                    if (rangeCursors[i] != null) {
+                        rangeCursors[i].close();
+                    }
+                }
+                rangeCursors = null;
             }
-            rangeCursors = null;
         } finally {
             if (lsmHarness != null) {
                 lsmHarness.endSearch(opCtx);


Mime
View raw message