asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amo...@apache.org
Subject incubator-asterixdb-hyracks git commit: Fix Error in Aborting Task in Super Activity
Date Tue, 12 Jan 2016 05:44:27 GMT
Repository: incubator-asterixdb-hyracks
Updated Branches:
  refs/heads/master 384b38491 -> c10677f36


Fix Error in Aborting Task in Super Activity

When aborting a task, its thread gets interrupted. This creates
a problem when interrupting

Change-Id: I603d3c101e0a4de4816eb5a6a7fd4320df317ce4
Reviewed-on: https://asterix-gerrit.ics.uci.edu/582
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <hubailmor@gmail.com>


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

Branch: refs/heads/master
Commit: c10677f36fd1de1ce1a984419e29718a1cd82f55
Parents: 384b384
Author: Abdullah Alamoudi <bamousaa@gmail.com>
Authored: Mon Jan 11 16:33:15 2016 +0300
Committer: abdullah alamoudi <bamousaa@gmail.com>
Committed: Mon Jan 11 21:39:13 2016 -0800

----------------------------------------------------------------------
 .../SuperActivityOperatorNodePushable.java      | 34 +++++++++++---------
 .../org/apache/hyracks/control/nc/Task.java     |  2 +-
 2 files changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/c10677f3/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/rewriter/runtime/SuperActivityOperatorNodePushable.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/rewriter/runtime/SuperActivityOperatorNodePushable.java
b/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/rewriter/runtime/SuperActivityOperatorNodePushable.java
index 4e842bb..827e478 100644
--- a/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/rewriter/runtime/SuperActivityOperatorNodePushable.java
+++ b/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/rewriter/runtime/SuperActivityOperatorNodePushable.java
@@ -196,24 +196,26 @@ public class SuperActivityOperatorNodePushable implements IOperatorNodePushable
 
     private void runInParallel(OperatorNodePushableAction opAction) throws HyracksDataException
{
         List<Future<Void>> initializationTasks = new ArrayList<Future<Void>>();
-        // Run one action for all OperatorNodePushables in parallel through a thread pool.
-        for (final IOperatorNodePushable op : operatorNodePushablesBFSOrder) {
-            initializationTasks.add(ctx.getExecutorService().submit(new Callable<Void>()
{
-                @Override
-                public Void call() throws Exception {
-                    opAction.runAction(op);
-                    return null;
-                }
-            }));
-        }
-
-        // Waits until all parallel actions to finish.
-        for (Future<Void> initializationTask : initializationTasks) {
-            try {
+        try {
+            // Run one action for all OperatorNodePushables in parallel through a thread
pool.
+            for (final IOperatorNodePushable op : operatorNodePushablesBFSOrder) {
+                initializationTasks.add(ctx.getExecutorService().submit(new Callable<Void>()
{
+                    @Override
+                    public Void call() throws Exception {
+                        opAction.runAction(op);
+                        return null;
+                    }
+                }));
+            }
+            // Waits until all parallel actions to finish.
+            for (Future<Void> initializationTask : initializationTasks) {
                 initializationTask.get();
-            } catch (Exception e) {
-                throw new HyracksDataException(e);
             }
+        } catch (Throwable th) {
+            for (Future<Void> initializationTask : initializationTasks) {
+                initializationTask.cancel(true);
+            }
+            throw new HyracksDataException(th);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/c10677f3/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
b/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
index 12df264..61baf82 100644
--- a/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
+++ b/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
@@ -255,8 +255,8 @@ public class Task implements IHyracksTaskContext, ICounterContext, Runnable
{
         addPendingThread(ct);
         try {
             ct.setName(displayName + ":" + taskAttemptId + ":" + 0);
-            operator.initialize();
             try {
+                operator.initialize();
                 if (collectors.length > 0) {
                     final Semaphore sem = new Semaphore(collectors.length - 1);
                     for (int i = 1; i < collectors.length; ++i) {


Mime
View raw message