You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mh...@apache.org on 2019/03/07 17:35:41 UTC

[asterixdb] branch master updated: [NO ISSUE][OTH] Catch All Interrupts on Request Cancellation

This is an automated email from the ASF dual-hosted git repository.

mhubail pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 4c14e21  [NO ISSUE][OTH] Catch All Interrupts on Request Cancellation
4c14e21 is described below

commit 4c14e21abdbc1952c796dafdab1f10d1eba1d553
Author: Murtadha Hubail <mh...@apache.org>
AuthorDate: Thu Mar 7 01:44:28 2019 +0300

    [NO ISSUE][OTH] Catch All Interrupts on Request Cancellation
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    - Catch all exceptions that could be caused by an interrupt
      during request cancellation.
    
    Change-Id: Ib2595ce8a80d8df324e5d97591639d3f9efe1b9d
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/3250
    Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Michael Blow <mb...@apache.org>
---
 .../org/apache/asterix/app/translator/QueryTranslator.java     | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index c49fcdd..0996c6c 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -66,6 +66,7 @@ import org.apache.asterix.common.exceptions.ACIDException;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.exceptions.ExceptionUtils;
 import org.apache.asterix.common.exceptions.MetadataException;
 import org.apache.asterix.common.exceptions.RuntimeDataException;
 import org.apache.asterix.common.functions.FunctionSignature;
@@ -2624,9 +2625,12 @@ public class QueryTranslator extends AbstractLangTranslator implements IStatemen
                 hcc.waitForCompletion(jobId);
                 printer.print(jobId);
             }
-        } catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-            throw new RuntimeDataException(ErrorCode.REQUEST_CANCELLED, clientRequest.getId());
+        } catch (Exception e) {
+            if (ExceptionUtils.getRootCause(e) instanceof InterruptedException) {
+                Thread.currentThread().interrupt();
+                throw new RuntimeDataException(ErrorCode.REQUEST_CANCELLED, clientRequest.getId());
+            }
+            throw e;
         } finally {
             // complete async jobs after their job completes
             if (ResultDelivery.ASYNC == resultDelivery) {