merge branch gerrit/neo into gerrit/trinity
Ext-ref: MB-65953
Change-Id: Idc8a4d0bc04426b6e7cfc777c8c02f9271fa99ef
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 c89097b..f4e52c5 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
@@ -259,6 +259,7 @@
import org.apache.hyracks.api.job.profiling.IOperatorStats;
import org.apache.hyracks.api.result.IResultSet;
import org.apache.hyracks.api.result.ResultSetId;
+import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.control.cc.ClusterControllerService;
import org.apache.hyracks.control.common.controllers.CCConfig;
import org.apache.hyracks.storage.am.common.dataflow.IndexDropOperatorDescriptor.DropOption;
@@ -4888,7 +4889,7 @@
printer.print(jobId);
}
} catch (Exception e) {
- if (org.apache.hyracks.api.util.ExceptionUtils.getRootCause(e) instanceof InterruptedException) {
+ if (ExceptionUtils.causedByInterrupt(e)) {
Thread.currentThread().interrupt();
throw new RuntimeDataException(ErrorCode.REQUEST_CANCELLED, clientRequest.getId());
}
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java
index e015ffc..eaa1367 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java
@@ -34,8 +34,10 @@
import org.apache.asterix.file.StorageComponentProvider;
import org.apache.asterix.test.base.AsterixTestHelper;
import org.apache.asterix.test.common.TestExecutor;
+import org.junit.Ignore;
import org.junit.Test;
+@Ignore("Is this test still needed? And why hasn't it failed before? It is looking for some load-cust.aql script")
public class DmlTest {
private static final String[] ASTERIX_DATA_DIRS = new String[] { "nc1data", "nc2data" };
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/TPCExecutionTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/TPCExecutionTest.java
index f777bd5..fe94fed 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/TPCExecutionTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/TPCExecutionTest.java
@@ -30,6 +30,7 @@
import org.apache.hyracks.control.nc.NodeControllerService;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -39,6 +40,7 @@
* Runs the Transaction Processing Council (TPC) runtime tests with the storage parallelism.
*/
+@Ignore("Only tests data generation function for tpcds, causes intermittent failures")
@RunWith(Parameterized.class)
public class TPCExecutionTest {
protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf";
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java
index 8df3e78..4310fe3 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/OptimizationConfUtil.java
@@ -120,7 +120,7 @@
return externalScanMemorySizeParameter != null ? intByteParser.parse(externalScanMemorySizeParameter)
: compilerExternalScanMemorySize;
} catch (IllegalArgumentException e) {
- throw AsterixException.create(ErrorCode.COMPILATION_ERROR, sourceLoc, e.getMessage());
+ throw AsterixException.create(ErrorCode.COMPILATION_ERROR, e, sourceLoc, e.getMessage());
}
}
@@ -156,7 +156,7 @@
try {
memBudget = parameter == null ? memBudgetInConfiguration : longBytePropertyInterpreter.parse(parameter);
} catch (IllegalArgumentException e) {
- throw AsterixException.create(ErrorCode.COMPILATION_ERROR, sourceLoc, e.getMessage());
+ throw AsterixException.create(ErrorCode.COMPILATION_ERROR, e, sourceLoc, e.getMessage());
}
int frameLimit = (int) (memBudget / frameSize);
if (frameLimit < minFrameLimit) {
@@ -175,7 +175,7 @@
return valueInQuery == null ? compilerProperties.getSortSamples()
: OptionTypes.POSITIVE_INTEGER.parse(valueInQuery);
} catch (IllegalArgumentException e) {
- throw AsterixException.create(ErrorCode.COMPILATION_BAD_QUERY_PARAMETER_VALUE, sourceLoc,
+ throw AsterixException.create(ErrorCode.COMPILATION_BAD_QUERY_PARAMETER_VALUE, e, sourceLoc,
CompilerProperties.COMPILER_SORT_SAMPLES_KEY, 1, "samples");
}
}
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java
index 92714b3..8421ee2 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java
@@ -26,20 +26,37 @@
public class AsterixException extends AlgebricksException {
private static final long serialVersionUID = 1L;
- public AsterixException(ErrorCode error, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
- super(error, cause, sourceLoc, params);
+ public static AsterixException create(ErrorCode error, Serializable... params) {
+ return new AsterixException(error, params);
+ }
+
+ public static AsterixException create(ErrorCode error, Throwable th, Serializable... params) {
+ return new AsterixException(error, th, params);
+ }
+
+ public static AsterixException create(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
+ return new AsterixException(error, sourceLoc, params);
+ }
+
+ public static AsterixException create(ErrorCode error, Throwable th, SourceLocation sourceLoc,
+ Serializable... params) {
+ return new AsterixException(error, th, sourceLoc, params);
+ }
+
+ public AsterixException(ErrorCode error, Serializable... params) {
+ this(error, null, null, params);
+ }
+
+ public AsterixException(ErrorCode error, Throwable cause, Serializable... params) {
+ this(error, cause, null, params);
}
public AsterixException(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
this(error, null, sourceLoc, params);
}
- public AsterixException(ErrorCode error, Serializable... params) {
- super(error, null, null, params);
- }
-
- public AsterixException(ErrorCode error, Throwable cause, Serializable... params) {
- super(error, cause, null, params);
+ public AsterixException(ErrorCode error, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
+ super(error, cause, sourceLoc, params);
}
/**
@@ -65,12 +82,4 @@
public AsterixException(String message, Throwable cause) {
super(message, cause);
}
-
- public static AsterixException create(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
- return new AsterixException(error, sourceLoc, params);
- }
-
- public static AsterixException create(ErrorCode error, Serializable... params) {
- return new AsterixException(error, params);
- }
}
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/CompilationException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/CompilationException.java
index 75fb18d..36b4b2d 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/CompilationException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/CompilationException.java
@@ -27,20 +27,21 @@
public class CompilationException extends AlgebricksException {
private static final long serialVersionUID = 1L;
+ public static CompilationException create(ErrorCode error, Serializable... params) {
+ return new CompilationException(error, params);
+ }
+
+ public static CompilationException create(ErrorCode error, Throwable th, Serializable... params) {
+ return new CompilationException(error, th, params);
+ }
+
public static CompilationException create(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
return new CompilationException(error, sourceLoc, params);
}
- public static CompilationException create(ErrorCode error, Serializable... params) {
- return create(error, null, params);
- }
-
- public CompilationException(ErrorCode error, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
- super(error, cause, sourceLoc, params);
- }
-
- public CompilationException(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
- this(error, null, sourceLoc, params);
+ public static CompilationException create(ErrorCode error, Throwable th, SourceLocation sourceLoc,
+ Serializable... params) {
+ return new CompilationException(error, th, sourceLoc, params);
}
public CompilationException(ErrorCode error, Serializable... params) {
@@ -51,6 +52,14 @@
this(errorCode, cause, null, params);
}
+ public CompilationException(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
+ this(error, null, sourceLoc, params);
+ }
+
+ public CompilationException(ErrorCode error, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
+ super(error, cause, sourceLoc, params);
+ }
+
/**
* @deprecated (Don't use this and provide an error code. This exists for the current exceptions and
* those exceptions need to adopt error code as well.)
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java
index 13a006d..2c54866 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java
@@ -59,20 +59,20 @@
super(message, cause);
}
- public MetadataException(ErrorCode errorCode, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
- super(errorCode, cause, sourceLoc, params);
- }
-
- public MetadataException(ErrorCode errorCode, SourceLocation sourceLoc, Serializable... params) {
- this(errorCode, null, sourceLoc, params);
+ public MetadataException(ErrorCode errorCode, Serializable... params) {
+ this(errorCode, null, null, params);
}
public MetadataException(ErrorCode errorCode, Throwable cause, Serializable... params) {
this(errorCode, cause, null, params);
}
- public MetadataException(ErrorCode errorCode, Serializable... params) {
- this(errorCode, null, null, params);
+ public MetadataException(ErrorCode errorCode, SourceLocation sourceLoc, Serializable... params) {
+ this(errorCode, null, sourceLoc, params);
+ }
+
+ public MetadataException(ErrorCode errorCode, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
+ super(errorCode, cause, sourceLoc, params);
}
public static MetadataException create(Throwable cause) {
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
index 1a0a61f..95bcda7 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
@@ -31,6 +31,10 @@
return new RuntimeDataException(error, params);
}
+ public static RuntimeDataException create(ErrorCode error, Throwable cause, Serializable... params) {
+ return new RuntimeDataException(error, cause, params);
+ }
+
public RuntimeDataException(ErrorCode errorCode, Throwable cause, SourceLocation sourceLoc,
Serializable... params) {
super(errorCode, cause, sourceLoc, params);
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java
index 0f7f71a..77897ea 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/aws/AwsS3InputStream.java
@@ -80,7 +80,7 @@
*
* @return true
*/
- private boolean doGetInputStream(GetObjectRequest request) throws RuntimeDataException {
+ private boolean doGetInputStream(GetObjectRequest request) throws HyracksDataException {
int retries = 0;
while (retries < MAX_RETRIES) {
try {
@@ -93,7 +93,7 @@
return false;
} catch (S3Exception ex) {
if (!shouldRetry(ex.awsErrorDetails().errorCode(), retries++)) {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw RuntimeDataException.create(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
LOGGER.debug(() -> "S3 retryable error: " + LogRedactionUtil.userData(ex.getMessage()));
@@ -101,10 +101,10 @@
try {
Thread.sleep(TimeUnit.SECONDS.toMillis(retries < 3 ? 1 : 2));
} catch (InterruptedException e) {
- Thread.currentThread().interrupt();
+ throw HyracksDataException.create(e);
}
} catch (SdkException ex) {
- throw new RuntimeDataException(ErrorCode.EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw RuntimeDataException.create(ErrorCode.EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
}
return true;
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
index a7f74a9..2e9878c 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/google/gcs/GCSUtils.java
@@ -100,15 +100,15 @@
try {
builder.setCredentials(GoogleCredentials.getApplicationDefault());
} catch (Exception ex) {
- throw CompilationException.create(EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw CompilationException.create(EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
}
} else if (jsonCredentials != null) {
try (InputStream credentialsStream = new ByteArrayInputStream(jsonCredentials.getBytes())) {
builder.setCredentials(GoogleCredentials.fromStream(credentialsStream));
} catch (IOException ex) {
- throw CompilationException.create(EXTERNAL_SOURCE_ERROR, getMessageOrToString(ex));
+ throw CompilationException.create(EXTERNAL_SOURCE_ERROR, ex, getMessageOrToString(ex));
} catch (Exception ex) {
- throw new CompilationException(EXTERNAL_SOURCE_ERROR,
+ throw CompilationException.create(EXTERNAL_SOURCE_ERROR, ex,
"Encountered an issue while processing the JSON credentials. Please ensure the provided credentials are valid.");
}
} else {
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
index 7a6de19..f64d53f 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
@@ -559,7 +559,7 @@
try {
insertFullTextConfigMetadataEntityToCatalog(txnId, config);
} catch (AlgebricksException e) {
- throw new AlgebricksException(e, ErrorCode.ERROR_PROCESSING_TUPLE);
+ throw AlgebricksException.create(ErrorCode.ERROR_PROCESSING_TUPLE, e);
}
}
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/functions/ExternalFunctionCompilerUtil.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/functions/ExternalFunctionCompilerUtil.java
index ce98008..3eb155e 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/functions/ExternalFunctionCompilerUtil.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/functions/ExternalFunctionCompilerUtil.java
@@ -145,7 +145,7 @@
try {
return ExternalFunctionLanguage.valueOf(language);
} catch (IllegalArgumentException e) {
- throw new AsterixException(ErrorCode.METADATA_ERROR, language);
+ throw new AsterixException(ErrorCode.METADATA_ERROR, e, language);
}
}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/ExpressionTypeComputer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/ExpressionTypeComputer.java
index e581140..466e5a6 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/ExpressionTypeComputer.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/ExpressionTypeComputer.java
@@ -54,10 +54,9 @@
try {
return env.getVarType(((VariableReferenceExpression) expr).getVariableReference());
} catch (Exception e) {
- throw new CompilationException(ErrorCode.COMPILATION_ERROR, expr.getSourceLocation(),
- "Could not resolve type for " + expr.toString() + ","
- + "please check whether the used variable has been defined!",
- e);
+ throw new CompilationException(ErrorCode.COMPILATION_ERROR, e, expr.getSourceLocation(),
+ "Could not resolve type for " + expr + ","
+ + "please check whether the used variable has been defined!");
}
default:
throw new IllegalStateException();
diff --git a/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java b/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java
index 0b7af91..a513dd3 100644
--- a/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java
+++ b/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java
@@ -19,8 +19,6 @@
package org.apache.hyracks.algebricks.common.exceptions;
import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Optional;
@@ -44,12 +42,42 @@
@SuppressWarnings("squid:S1165") // exception class not final
private transient volatile String msgCache;
+ public static AlgebricksException create(ErrorCode error, Serializable... params) {
+ return new AlgebricksException(error, params);
+ }
+
+ public static AlgebricksException create(ErrorCode error, Throwable th, Serializable... params) {
+ return new AlgebricksException(error, th, params);
+ }
+
public static AlgebricksException create(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
return new AlgebricksException(error, sourceLoc, params);
}
- public static AlgebricksException create(ErrorCode error, Serializable... params) {
- return create(error, null, params);
+ public static AlgebricksException create(ErrorCode error, Throwable th, SourceLocation sourceLoc,
+ Serializable... params) {
+ return new AlgebricksException(error, th, sourceLoc, params);
+ }
+
+ public AlgebricksException(ErrorCode error, Serializable... params) {
+ this(error, null, null, params);
+ }
+
+ public AlgebricksException(ErrorCode error, Throwable cause, Serializable... params) {
+ this(error, cause, null, null, params);
+ }
+
+ public AlgebricksException(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
+ this(error, null, sourceLoc, null, params);
+ }
+
+ protected AlgebricksException(IError error, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
+ this(error, cause, sourceLoc, null, params);
+ }
+
+ protected AlgebricksException(IError error, Throwable cause, SourceLocation sourceLoc, String nodeId,
+ Serializable... params) {
+ this(error, error.component(), error.intValue(), error.errorMessage(), cause, sourceLoc, nodeId, params);
}
protected AlgebricksException(IError error, String component, int errorCode, String message, Throwable cause,
@@ -61,6 +89,10 @@
this.sourceLoc = sourceLoc;
this.nodeId = nodeId;
this.params = params;
+
+ if (cause instanceof InterruptedException) {
+ Thread.currentThread().interrupt();
+ }
}
/**
@@ -87,22 +119,6 @@
this((IError) null, ErrorMessageUtil.NONE, UNKNOWN, message, cause, null, null);
}
- public AlgebricksException(Throwable cause, ErrorCode error, Serializable... params) {
- this(error, error.component(), error.intValue(), error.errorMessage(), cause, null, null, params);
- }
-
- public AlgebricksException(ErrorCode error, SourceLocation sourceLoc, Serializable... params) {
- this(error, error.component(), error.intValue(), error.errorMessage(), null, sourceLoc, null, params);
- }
-
- public AlgebricksException(ErrorCode error, Serializable... params) {
- this(error, null, params);
- }
-
- protected AlgebricksException(IError error, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
- this(error, error.component(), error.intValue(), error.errorMessage(), cause, sourceLoc, null, params);
- }
-
@Override
public String getComponent() {
return component;
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java
index 5c532d3..8306110 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java
@@ -421,7 +421,7 @@
jsonGenerator.writeString(expression.accept(exprVisitor, null));
return this;
} catch (IOException e) {
- throw new AlgebricksException(e, ErrorCode.ERROR_PRINTING_PLAN);
+ throw new AlgebricksException(ErrorCode.ERROR_PRINTING_PLAN, e);
}
}
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/AbstractRuleController.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/AbstractRuleController.java
index 9a47b8a..dca5d62 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/AbstractRuleController.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/AbstractRuleController.java
@@ -147,7 +147,7 @@
try {
context.getPlanStabilityVerifier().recordPlanSignature(opRef);
} catch (AlgebricksException e) {
- throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE,
+ throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE, e,
String.format("Illegal state before rule %s. %s", rule.getClass().getName(), e.getMessage()));
}
}
@@ -158,7 +158,7 @@
try {
context.getPlanStructureVerifier().verifyPlanStructure(opRef);
} catch (AlgebricksException e) {
- throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE,
+ throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE, e,
String.format("Fired rule %s produced illegal %s", rule.getClass().getName(), e.getMessage()));
}
} else {
@@ -169,7 +169,7 @@
printRuleApplication(rule, "not fired, but failed sanity check: " + e.getMessage(), beforePlan,
getPlanString(opRef));
}
- throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE,
+ throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE, e,
String.format("Non-fired rule %s unexpectedly %s", rule.getClass().getName(), e.getMessage()));
}
}
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java
index 676b9c7..5e2a3be 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/rewriter/base/HeuristicOptimizer.java
@@ -129,7 +129,7 @@
context.getPlanStructureVerifier().verifyPlanStructure(opRef);
}
} catch (AlgebricksException e) {
- throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE,
+ throw AlgebricksException.create(ErrorCode.ILLEGAL_STATE, e,
String.format("Initial plan contains illegal %s", e.getMessage()));
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
index fdda793..0270f7f 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksDataException.java
@@ -43,8 +43,6 @@
}
if (cause instanceof HyracksDataException) {
return (HyracksDataException) cause;
- } else if (cause instanceof InterruptedException) {
- Thread.currentThread().interrupt();
}
return new HyracksDataException(cause);
}
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksException.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksException.java
index 12f1095..b12c8df 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksException.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksException.java
@@ -79,6 +79,10 @@
this.errorCode = intCode;
this.nodeId = nodeId;
this.params = params;
+
+ if (cause instanceof InterruptedException) {
+ Thread.currentThread().interrupt();
+ }
}
protected HyracksException(IError errorCode, Throwable cause, SourceLocation sourceLoc, String nodeId,
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
index d616eb5..a0863b2 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
@@ -29,6 +29,8 @@
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.exceptions.IFormattedException;
import org.apache.hyracks.util.ThrowingFunction;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import com.google.common.util.concurrent.UncheckedExecutionException;
@@ -36,6 +38,7 @@
* @author yingyib
*/
public class ExceptionUtils {
+ private static final Logger LOGGER = LogManager.getLogger();
private ExceptionUtils() {
}
@@ -128,6 +131,9 @@
}
public static Throwable getRootCause(Throwable e) {
+ if (e == null) {
+ return null;
+ }
Throwable current = e;
Throwable cause = e.getCause();
while (cause != null && cause != current) {
@@ -138,7 +144,18 @@
}
public static boolean causedByInterrupt(Throwable th) {
- return getRootCause(th) instanceof InterruptedException;
+ return causedByInterrupt(th, false);
+ }
+
+ public static boolean causedByInterrupt(Throwable th, boolean skipInterruptedCheck) {
+ if (th instanceof InterruptedException) {
+ return true;
+ }
+ boolean isCausedByInterrupt = getRootCause(th) instanceof InterruptedException;
+ if (!skipInterruptedCheck && isCausedByInterrupt && !Thread.currentThread().isInterrupted()) {
+ LOGGER.warn("InterruptedException suppressed and !Thread.currentThread().isInterrupted()", th);
+ }
+ return isCausedByInterrupt;
}
/**