[ASTERIXDB-2158] Remove AsterixException (step 1) - user model changes: no - storage format changes: no - interface changes: replace AsterixException on signatures
Details: This change is the first step towards removing AsterixException from all interfaces. Change-Id: I3e858576f39f671cbf5eb14adc7a22aab1335faf Reviewed-on: https://asterix-gerrit.ics.uci.edu/2135 Reviewed-by: Murtadha Hubail <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Integration-Tests: Murtadha Hubail <[email protected]> Integration-Tests: Jenkins <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/23761dd7 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/23761dd7 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/23761dd7 Branch: refs/heads/master Commit: 23761dd78f01a3bff0ccd25d3ceb3602a1d2cc1c Parents: 81c09a9 Author: Till Westmann <[email protected]> Authored: Wed Nov 8 14:26:33 2017 -0800 Committer: Till Westmann <[email protected]> Committed: Thu Nov 9 17:06:41 2017 -0800 ---------------------------------------------------------------------- .../base/ILangExpressionToPlanTranslator.java | 4 +- .../asterix/optimizer/rules/FuzzyJoinRule.java | 8 +- ...IntroduceSecondaryIndexInsertDeleteRule.java | 49 +++++------ .../optimizer/rules/am/AccessMethodUtils.java | 9 +- .../translator/AbstractLangTranslator.java | 3 +- .../asterix/translator/TypeTranslator.java | 93 +++++++++----------- .../app/active/ActiveNotificationHandler.java | 6 +- .../asterix/app/translator/QueryTranslator.java | 6 +- .../bootstrap/ClusterLifecycleListener.java | 2 +- .../runtime/ClusterStateManagerTest.java | 3 +- .../asterix/test/active/TestEventsListener.java | 4 +- .../asterix/test/optimizer/OptimizerTest.java | 3 +- .../common/api/IMetadataLockManager.java | 85 +++++++++--------- .../common/api/INcApplicationContext.java | 4 +- .../common/cluster/IClusterStateManager.java | 3 +- .../external/api/IDataParserFactory.java | 5 +- .../external/library/java/JObjectAccessors.java | 46 +++++----- .../RecordWithMetadataParserFactory.java | 12 +-- .../factory/TestRecordWithPKParserFactory.java | 4 +- .../asterix/metadata/api/IClusterManager.java | 8 +- .../metadata/cluster/ClusterManager.java | 68 +++++++------- .../cluster/ClusterManagerProvider.java | 6 +- .../metadata/declared/LoadableDataSource.java | 8 +- .../metadata/feeds/FeedMetadataUtil.java | 2 +- .../metadata/lock/MetadataLockManager.java | 45 +++++----- .../metadata/utils/MetadataLockUtil.java | 40 ++++----- ...econdaryCorrelatedRTreeOperationsHelper.java | 2 +- .../utils/SecondaryRTreeOperationsHelper.java | 2 +- .../AOrderedListSerializerDeserializer.java | 3 +- .../AUnorderedListSerializerDeserializer.java | 3 +- .../om/pointables/PointableAllocator.java | 4 +- .../pointables/nonvisitor/AListPointable.java | 2 +- .../pointables/nonvisitor/ARecordPointable.java | 4 +- .../apache/asterix/om/types/TypeTagUtil.java | 7 +- .../comparisons/DeepEqualAssessor.java | 2 +- .../evaluators/functions/PointableHelper.java | 9 +- .../records/GetRecordFieldsEvalFactory.java | 2 - .../records/RecordAddFieldsDescriptor.java | 8 +- .../functions/records/RecordFieldsUtil.java | 14 +-- .../records/RecordMergeDescriptor.java | 7 +- .../records/RecordRemoveFieldsEvalFactory.java | 6 +- .../LSMPrimaryUpsertOperatorNodePushable.java | 2 +- .../runtime/utils/CcApplicationContext.java | 3 +- .../runtime/utils/ClusterStateManager.java | 3 +- .../asterix/tools/datagen/AdmDataGen.java | 2 +- .../tools/translator/ADGenDmlTranslator.java | 2 +- asterixdb/asterix-transactions/pom.xml | 4 + .../service/transaction/DatasetIdFactory.java | 3 +- asterixdb/asterix-yarn/pom.xml | 4 + .../asterix/aoya/AsterixApplicationMaster.java | 4 +- 50 files changed, 296 insertions(+), 332 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/ILangExpressionToPlanTranslator.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/ILangExpressionToPlanTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/ILangExpressionToPlanTranslator.java index ca6710f..8e0214a 100644 --- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/ILangExpressionToPlanTranslator.java +++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/ILangExpressionToPlanTranslator.java @@ -18,7 +18,6 @@ */ package org.apache.asterix.algebra.base; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.lang.common.statement.Query; import org.apache.asterix.translator.CompiledStatements.ICompiledDmlStatement; import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; @@ -40,10 +39,9 @@ public interface ILangExpressionToPlanTranslator { * the compiled dml statement (only for insert/delete). * @return a logical query plan for the query. * @throws AlgebricksException - * @throws AsterixException */ public ILogicalPlan translate(Query query, String outputDatasetName, ICompiledDmlStatement stmt) - throws AlgebricksException, AsterixException; + throws AlgebricksException; /** * Translates a load statement. http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java index f3f5581..160e909 100644 --- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java +++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java @@ -26,7 +26,6 @@ import java.util.Locale; import org.apache.asterix.aqlplus.parser.AQLPlusParser; import org.apache.asterix.aqlplus.parser.ParseException; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.lang.common.base.Clause; import org.apache.asterix.lang.common.struct.Identifier; import org.apache.asterix.metadata.declared.MetadataProvider; @@ -318,12 +317,7 @@ public class FuzzyJoinRule implements IAlgebraicRewriteRule { deepCopyVisitor.updatePrimaryKeys(context); deepCopyVisitor.reset(); - ILogicalPlan plan; - try { - plan = translator.translate(clauses); - } catch (AsterixException e) { - throw new AlgebricksException(e); - } + ILogicalPlan plan = translator.translate(clauses); context.setVarCounter(counter.get()); ILogicalOperator outputOp = plan.getRoots().get(0).getValue(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java index de47ff7..3b6a959 100644 --- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java +++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java @@ -27,7 +27,6 @@ import java.util.Map; import org.apache.asterix.algebra.operators.CommitOperator; import org.apache.asterix.common.config.DatasetConfig.DatasetType; import org.apache.asterix.common.config.DatasetConfig.IndexType; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.lang.common.util.FunctionUtil; import org.apache.asterix.metadata.declared.DataSource; import org.apache.asterix.metadata.declared.DataSourceIndex; @@ -227,34 +226,28 @@ public class IntroduceSecondaryIndexInsertDeleteRule implements IAlgebraicRewrit * if the index is enforcing field types (For open indexes), We add a cast * operator to ensure type safety */ - try { - if (primaryIndexModificationOp.getOperation() == Kind.INSERT - || primaryIndexModificationOp.getOperation() == Kind.UPSERT - /* Actually, delete should not be here but it is now until issue - * https://issues.apache.org/jira/browse/ASTERIXDB-1507 - * is solved - */ - || primaryIndexModificationOp.getOperation() == Kind.DELETE) { - injectFieldAccessesForIndexes(context, dataset, indexes, fieldVarsForNewRecord, recType, metaType, - newRecordVar, newMetaVar, primaryIndexModificationOp, false); - if (replicateOp != null) { - context.computeAndSetTypeEnvironmentForOperator(replicateOp); - } - } - if (primaryIndexModificationOp.getOperation() == Kind.UPSERT - /* Actually, delete should be here but it is not until issue - * https://issues.apache.org/jira/browse/ASTERIXDB-1507 - * is solved - */) { - List<LogicalVariable> beforeOpMetaVars = primaryIndexModificationOp - .getBeforeOpAdditionalNonFilteringVars(); - LogicalVariable beforeOpMetaVar = beforeOpMetaVars == null ? null : beforeOpMetaVars.get(0); - currentTop = injectFieldAccessesForIndexes(context, dataset, indexes, fieldVarsForBeforeOperation, - recType, metaType, primaryIndexModificationOp.getBeforeOpRecordVar(), beforeOpMetaVar, - currentTop, true); + if (primaryIndexModificationOp.getOperation() == Kind.INSERT + || primaryIndexModificationOp.getOperation() == Kind.UPSERT + /* Actually, delete should not be here but it is now until issue + * https://issues.apache.org/jira/browse/ASTERIXDB-1507 + * is solved + */ + || primaryIndexModificationOp.getOperation() == Kind.DELETE) { + injectFieldAccessesForIndexes(context, dataset, indexes, fieldVarsForNewRecord, recType, metaType, + newRecordVar, newMetaVar, primaryIndexModificationOp, false); + if (replicateOp != null) { + context.computeAndSetTypeEnvironmentForOperator(replicateOp); } - } catch (AsterixException e) { - throw new AlgebricksException(e); + } + if (primaryIndexModificationOp.getOperation() == Kind.UPSERT + /* Actually, delete should be here but it is not until issue + * https://issues.apache.org/jira/browse/ASTERIXDB-1507 + * is solved + */) { + List<LogicalVariable> beforeOpMetaVars = primaryIndexModificationOp.getBeforeOpAdditionalNonFilteringVars(); + LogicalVariable beforeOpMetaVar = beforeOpMetaVars == null ? null : beforeOpMetaVars.get(0); + currentTop = injectFieldAccessesForIndexes(context, dataset, indexes, fieldVarsForBeforeOperation, recType, + metaType, primaryIndexModificationOp.getBeforeOpRecordVar(), beforeOpMetaVar, currentTop, true); } // Iterate each secondary index and applying Index Update operations. http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java index fcc2d8b..10630a5 100644 --- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java +++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java @@ -27,7 +27,6 @@ import java.util.Set; import org.apache.asterix.algebra.operators.physical.ExternalDataLookupPOperator; import org.apache.asterix.common.config.DatasetConfig.DatasetType; import org.apache.asterix.common.config.DatasetConfig.IndexType; -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.external.indexing.IndexingConstants; @@ -313,11 +312,7 @@ public class AccessMethodUtils { // Primary keys. if (dataset.getDatasetType() == DatasetType.EXTERNAL) { //add primary keys - try { - appendExternalRecPrimaryKeys(dataset, dest); - } catch (AsterixException e) { - throw new AlgebricksException(e); - } + appendExternalRecPrimaryKeys(dataset, dest); } else { dest.addAll(KeyFieldTypeUtil.getPartitoningKeyTypes(dataset, recordType, metaRecordType)); } @@ -675,7 +670,7 @@ public class AccessMethodUtils { target.add(itemType); } - private static void appendExternalRecPrimaryKeys(Dataset dataset, List<Object> target) throws AsterixException { + private static void appendExternalRecPrimaryKeys(Dataset dataset, List<Object> target) throws AlgebricksException { int numPrimaryKeys = IndexingConstants.getRIDSize(((ExternalDatasetDetails) dataset.getDatasetDetails()).getProperties()); for (int i = 0; i < numPrimaryKeys; i++) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java index db6f985..414d464 100644 --- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java +++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java @@ -38,6 +38,7 @@ import org.apache.asterix.lang.common.statement.InsertStatement; import org.apache.asterix.metadata.dataset.hints.DatasetHints; import org.apache.asterix.metadata.entities.Dataverse; import org.apache.asterix.metadata.utils.MetadataConstants; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.algebricks.common.utils.Pair; import org.apache.hyracks.api.exceptions.HyracksDataException; @@ -50,7 +51,7 @@ public abstract class AbstractLangTranslator { private static final Logger LOGGER = Logger.getLogger(AbstractLangTranslator.class.getName()); public void validateOperation(ICcApplicationContext appCtx, Dataverse defaultDataverse, Statement stmt) - throws AsterixException { + throws AlgebricksException { final IClusterStateManager clusterStateManager = appCtx.getClusterStateManager(); final IGlobalRecoveryManager globalRecoveryManager = appCtx.getGlobalRecoveryManager(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java index e50c7ca..9edfddb 100644 --- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java +++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java @@ -27,13 +27,12 @@ import java.util.Map; import org.apache.asterix.common.annotations.IRecordFieldDataGen; import org.apache.asterix.common.annotations.RecordDataGenAnnotation; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.lang.common.expression.OrderedListTypeDefinition; import org.apache.asterix.lang.common.expression.RecordTypeDefinition; +import org.apache.asterix.lang.common.expression.RecordTypeDefinition.RecordKind; import org.apache.asterix.lang.common.expression.TypeExpression; import org.apache.asterix.lang.common.expression.TypeReferenceExpression; import org.apache.asterix.lang.common.expression.UnorderedListTypeDefinition; -import org.apache.asterix.lang.common.expression.RecordTypeDefinition.RecordKind; import org.apache.asterix.metadata.MetadataManager; import org.apache.asterix.metadata.MetadataTransactionContext; import org.apache.asterix.metadata.entities.BuiltinTypeMap; @@ -61,8 +60,7 @@ public class TypeTranslator { } public static Map<TypeSignature, IAType> computeTypes(MetadataTransactionContext mdTxnCtx, TypeExpression typeExpr, - String typeName, String typeDataverse, Map<TypeSignature, IAType> typeMap) - throws AlgebricksException { + String typeName, String typeDataverse, Map<TypeSignature, IAType> typeMap) throws AlgebricksException { Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes = new HashMap<>(); Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes = new HashMap<>(); Map<TypeSignature, List<TypeSignature>> incompleteTopLevelTypeReferences = new HashMap<>(); @@ -89,48 +87,43 @@ public class TypeTranslator { throw new AlgebricksException("Cannot redefine builtin type " + typeName + " ."); } TypeSignature typeSignature = new TypeSignature(typeDataverse, typeName); - try { - switch (typeExpr.getTypeKind()) { - case TYPEREFERENCE: { - TypeReferenceExpression tre = (TypeReferenceExpression) typeExpr; - IAType t = solveTypeReference(new TypeSignature( - tre.getIdent().first == null ? typeDataverse : tre.getIdent().first.getValue(), - tre.getIdent().second.getValue()), typeMap); - if (t != null) { - typeMap.put(typeSignature, t); - } else { - addIncompleteTopLevelTypeReference(tre, incompleteTopLevelTypeReferences, - typeDataverse); - } - break; - } - case RECORD: { - RecordTypeDefinition rtd = (RecordTypeDefinition) typeExpr; - ARecordType recType = computeRecordType(typeSignature, rtd, typeMap, incompleteFieldTypes, - incompleteItemTypes, typeDataverse); - typeMap.put(typeSignature, recType); - break; - } - case ORDEREDLIST: { - OrderedListTypeDefinition oltd = (OrderedListTypeDefinition) typeExpr; - AOrderedListType olType = computeOrderedListType(typeSignature, oltd, typeMap, incompleteItemTypes, - incompleteFieldTypes, typeDataverse); - typeMap.put(typeSignature, olType); - break; - } - case UNORDEREDLIST: { - UnorderedListTypeDefinition ultd = (UnorderedListTypeDefinition) typeExpr; - AUnorderedListType ulType = computeUnorderedListType(typeSignature, ultd, typeMap, - incompleteItemTypes, incompleteFieldTypes, typeDataverse); - typeMap.put(typeSignature, ulType); - break; - } - default: { - throw new IllegalStateException(); + switch (typeExpr.getTypeKind()) { + case TYPEREFERENCE: { + TypeReferenceExpression tre = (TypeReferenceExpression) typeExpr; + IAType t = solveTypeReference(new TypeSignature( + tre.getIdent().first == null ? typeDataverse : tre.getIdent().first.getValue(), + tre.getIdent().second.getValue()), typeMap); + if (t != null) { + typeMap.put(typeSignature, t); + } else { + addIncompleteTopLevelTypeReference(tre, incompleteTopLevelTypeReferences, typeDataverse); } + break; + } + case RECORD: { + RecordTypeDefinition rtd = (RecordTypeDefinition) typeExpr; + ARecordType recType = computeRecordType(typeSignature, rtd, typeMap, incompleteFieldTypes, + incompleteItemTypes, typeDataverse); + typeMap.put(typeSignature, recType); + break; + } + case ORDEREDLIST: { + OrderedListTypeDefinition oltd = (OrderedListTypeDefinition) typeExpr; + AOrderedListType olType = computeOrderedListType(typeSignature, oltd, typeMap, incompleteItemTypes, + incompleteFieldTypes, typeDataverse); + typeMap.put(typeSignature, olType); + break; + } + case UNORDEREDLIST: { + UnorderedListTypeDefinition ultd = (UnorderedListTypeDefinition) typeExpr; + AUnorderedListType ulType = computeUnorderedListType(typeSignature, ultd, typeMap, incompleteItemTypes, + incompleteFieldTypes, typeDataverse); + typeMap.put(typeSignature, ulType); + break; + } + default: { + throw new IllegalStateException(); } - } catch (AsterixException e) { - throw new AlgebricksException(e); } } @@ -204,7 +197,7 @@ public class TypeTranslator { private static AOrderedListType computeOrderedListType(TypeSignature typeSignature, OrderedListTypeDefinition oltd, Map<TypeSignature, IAType> typeMap, Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes, Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes, String defaultDataverse) - throws AsterixException { + throws AlgebricksException { TypeExpression tExpr = oltd.getItemTypeExpression(); String typeName = typeSignature != null ? typeSignature.getName() : null; AOrderedListType aolt = new AOrderedListType(null, typeName); @@ -216,7 +209,7 @@ public class TypeTranslator { UnorderedListTypeDefinition ultd, Map<TypeSignature, IAType> typeMap, Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes, Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes, String defaulDataverse) - throws AsterixException { + throws AlgebricksException { TypeExpression tExpr = ultd.getItemTypeExpression(); String typeName = typeSignature != null ? typeSignature.getName() : null; AUnorderedListType ault = new AUnorderedListType(null, typeName); @@ -227,7 +220,7 @@ public class TypeTranslator { private static void setCollectionItemType(TypeExpression tExpr, Map<TypeSignature, IAType> typeMap, Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes, Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes, AbstractCollectionType act, - String defaultDataverse) throws AsterixException { + String defaultDataverse) throws AlgebricksException { switch (tExpr.getTypeKind()) { case ORDEREDLIST: { OrderedListTypeDefinition oltd = (OrderedListTypeDefinition) tExpr; @@ -327,7 +320,7 @@ public class TypeTranslator { private static ARecordType computeRecordType(TypeSignature typeSignature, RecordTypeDefinition rtd, Map<TypeSignature, IAType> typeMap, Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes, Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes, String defaultDataverse) - throws AsterixException { + throws AlgebricksException { List<String> names = rtd.getFieldNames(); int n = names.size(); String[] fldNames = new String[n]; @@ -337,8 +330,8 @@ public class TypeTranslator { fldNames[i++] = s; } boolean isOpen = rtd.getRecordKind() == RecordKind.OPEN; - ARecordType recType = new ARecordType(typeSignature == null ? null : typeSignature.getName(), fldNames, - fldTypes, isOpen); + ARecordType recType = + new ARecordType(typeSignature == null ? null : typeSignature.getName(), fldNames, fldTypes, isOpen); List<IRecordFieldDataGen> fieldDataGen = rtd.getFieldDataGen(); if (fieldDataGen.size() == n) { IRecordFieldDataGen[] rfdg = new IRecordFieldDataGen[n]; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/ActiveNotificationHandler.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/ActiveNotificationHandler.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/ActiveNotificationHandler.java index d13a15d..ec0680f 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/ActiveNotificationHandler.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/active/ActiveNotificationHandler.java @@ -33,7 +33,6 @@ import org.apache.asterix.active.IActiveEntityEventsListener; import org.apache.asterix.active.IActiveNotificationHandler; import org.apache.asterix.active.message.ActivePartitionMessage; import org.apache.asterix.common.api.IMetadataLockManager; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.common.exceptions.ErrorCode; import org.apache.asterix.common.exceptions.RuntimeDataException; import org.apache.asterix.metadata.api.IActiveEntityController; @@ -41,6 +40,7 @@ import org.apache.asterix.metadata.declared.MetadataProvider; import org.apache.asterix.metadata.entities.Dataset; import org.apache.asterix.metadata.utils.DatasetUtil; import org.apache.commons.lang3.tuple.Pair; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.exceptions.HyracksException; import org.apache.hyracks.api.job.IJobLifecycleListener; @@ -226,7 +226,7 @@ public class ActiveNotificationHandler extends SingleThreadEventProcessor<Active } public void suspend(MetadataProvider mdProvider) - throws AsterixException, HyracksDataException, InterruptedException { + throws AlgebricksException, HyracksDataException, InterruptedException { synchronized (this) { if (suspended) { throw new RuntimeDataException(ErrorCode.ACTIVE_EVENT_HANDLER_ALREADY_SUSPENDED); @@ -256,7 +256,7 @@ public class ActiveNotificationHandler extends SingleThreadEventProcessor<Active } public void resume(MetadataProvider mdProvider) - throws AsterixException, HyracksDataException, InterruptedException { + throws HyracksDataException, InterruptedException { LOGGER.log(level, "Resuming active events handler"); for (IActiveEntityEventsListener listener : entityEventListeners.values()) { LOGGER.log(level, "Resuming " + listener.getEntityId()); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java ---------------------------------------------------------------------- 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 e45df8b..d6457f2 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 @@ -1768,7 +1768,7 @@ public class QueryTranslator extends AbstractLangTranslator implements IStatemen String dataverseName = getActiveDataverse(stmtInsertUpsert.getDataverseName()); final IMetadataLocker locker = new IMetadataLocker() { @Override - public void lock() throws AsterixException { + public void lock() throws AlgebricksException { MetadataLockUtil.insertDeleteUpsertBegin(lockManager, metadataProvider.getLocks(), dataverseName + "." + stmtInsertUpsert.getDatasetName()); } @@ -2307,9 +2307,9 @@ public class QueryTranslator extends AbstractLangTranslator implements IStatemen } private interface IMetadataLocker { - void lock() throws AsterixException; + void lock() throws AlgebricksException; - void unlock() throws AsterixException; + void unlock() throws AlgebricksException; } private interface IResultPrinter { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java index 84f841c..50fe65e 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java @@ -183,7 +183,7 @@ public class ClusterLifecycleListener implements IClusterLifecycleListener { if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("Added NC at:" + node.getId()); } - } catch (AsterixException e) { + } catch (Exception e) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning("Unable to add NC at:" + node.getId()); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/ClusterStateManagerTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/ClusterStateManagerTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/ClusterStateManagerTest.java index 6c11139..1466088 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/ClusterStateManagerTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/ClusterStateManagerTest.java @@ -35,6 +35,7 @@ import org.apache.asterix.common.metadata.IMetadataBootstrap; import org.apache.asterix.runtime.transaction.ResourceIdManager; import org.apache.asterix.runtime.utils.CcApplicationContext; import org.apache.asterix.runtime.utils.ClusterStateManager; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.api.application.ICCServiceContext; import org.apache.hyracks.api.config.IApplicationConfig; import org.apache.hyracks.api.exceptions.HyracksDataException; @@ -185,7 +186,7 @@ public class ClusterStateManagerTest { } private void notifyNodeJoined(ClusterStateManager csm, String nodeId, int partitionId, boolean registerPartitions) - throws HyracksException, AsterixException { + throws HyracksException, AlgebricksException { csm.notifyNodeJoin(nodeId, Collections.emptyMap()); if (registerPartitions) { csm.registerNodePartitions(nodeId, new ClusterPartition[] { new ClusterPartition(partitionId, nodeId, 0) }); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/TestEventsListener.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/TestEventsListener.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/TestEventsListener.java index 5199b1c..1cedc96 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/TestEventsListener.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/active/TestEventsListener.java @@ -30,13 +30,13 @@ import org.apache.asterix.active.IRetryPolicyFactory; import org.apache.asterix.app.active.ActiveEntityEventsListener; import org.apache.asterix.common.api.IMetadataLockManager; import org.apache.asterix.common.dataflow.ICcApplicationContext; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.common.metadata.LockList; import org.apache.asterix.external.feed.watch.WaitForStateSubscriber; import org.apache.asterix.metadata.declared.MetadataProvider; import org.apache.asterix.metadata.entities.Dataset; import org.apache.asterix.translator.IStatementExecutor; import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.api.client.IHyracksClientConnection; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.job.JobId; @@ -110,7 +110,7 @@ public class TestEventsListener extends ActiveEntityEventsListener { try { metadataProvider.getApplicationContext().getMetadataLockManager() .acquireDatasetReadLock(metadataProvider.getLocks(), "Default.type"); - } catch (AsterixException e) { + } catch (AlgebricksException e) { throw HyracksDataException.create(e); } failCompile(onStart); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java index d1c3ce4..c0a4d80 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java @@ -45,6 +45,7 @@ import org.apache.asterix.test.base.AsterixTestHelper; import org.apache.asterix.test.common.TestHelper; import org.apache.asterix.test.runtime.HDFSCluster; import org.apache.asterix.translator.IStatementExecutorFactory; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.api.client.IHyracksClientConnection; import org.junit.AfterClass; import org.junit.Assume; @@ -189,7 +190,7 @@ public class OptimizerTest { query, plan, provider, statementExecutorFactory, storageComponentProvider); try { asterix.compile(true, false, false, true, true, false, false); - } catch (AsterixException e) { + } catch (AlgebricksException e) { plan.close(); query.close(); throw new Exception("Compile ERROR for " + queryFile + ": " + e.getMessage(), e); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IMetadataLockManager.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IMetadataLockManager.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IMetadataLockManager.java index 4408d84..bed9869 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IMetadataLockManager.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IMetadataLockManager.java @@ -18,7 +18,6 @@ */ package org.apache.asterix.common.api; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.common.metadata.LockList; import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; @@ -31,10 +30,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param dataverseName * the dataverse name - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireDataverseReadLock(LockList locks, String dataverseName) throws AsterixException; + void acquireDataverseReadLock(LockList locks, String dataverseName) throws AlgebricksException; /** * Acquire write lock on the dataverse @@ -43,10 +42,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param dataverseName * the dataverse name - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireDataverseWriteLock(LockList locks, String dataverseName) throws AsterixException; + void acquireDataverseWriteLock(LockList locks, String dataverseName) throws AlgebricksException; /** * Acquire read lock on the dataset (for queries) @@ -55,10 +54,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param datasetFullyQualifiedName * the fully qualified name of the dataset - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireDatasetReadLock(LockList locks, String datasetFullyQualifiedName) throws AsterixException; + void acquireDatasetReadLock(LockList locks, String datasetFullyQualifiedName) throws AlgebricksException; /** * Acquire write lock on the dataset (for dataset create, dataset drop, and index drop) @@ -67,10 +66,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param datasetFullyQualifiedName * the fully qualified name of the dataset - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireDatasetWriteLock(LockList locks, String datasetFullyQualifiedName) throws AsterixException; + void acquireDatasetWriteLock(LockList locks, String datasetFullyQualifiedName) throws AlgebricksException; /** * Acquire modify lock on the dataset (for inserts, upserts, deletes) Mutually exclusive with create index lock @@ -79,10 +78,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param datasetFullyQualifiedName * the fully qualified name of the dataset - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireDatasetModifyLock(LockList locks, String datasetFullyQualifiedName) throws AsterixException; + void acquireDatasetModifyLock(LockList locks, String datasetFullyQualifiedName) throws AlgebricksException; /** * Acquire create index lock on the dataset (for index creation) Mutually exclusive with modify lock @@ -91,10 +90,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param datasetFullyQualifiedName * the fully qualified name of the dataset - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireDatasetCreateIndexLock(LockList locks, String datasetFullyQualifiedName) throws AsterixException; + void acquireDatasetCreateIndexLock(LockList locks, String datasetFullyQualifiedName) throws AlgebricksException; /** * Acquire exclusive modify lock on the dataset. only a single thread can acquire this lock and it is mutually @@ -104,11 +103,11 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param datasetFullyQualifiedName * the fully qualified name of the dataset - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ void acquireDatasetExclusiveModificationLock(LockList locks, String datasetFullyQualifiedName) - throws AsterixException; + throws AlgebricksException; /** * Acquire read lock on the function @@ -117,10 +116,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param functionFullyQualifiedName * the fully qualified name of the function - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireFunctionReadLock(LockList locks, String functionFullyQualifiedName) throws AsterixException; + void acquireFunctionReadLock(LockList locks, String functionFullyQualifiedName) throws AlgebricksException; /** * Acquire write lock on the function @@ -129,10 +128,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param functionFullyQualifiedName * the fully qualified name of the function - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireFunctionWriteLock(LockList locks, String functionFullyQualifiedName) throws AsterixException; + void acquireFunctionWriteLock(LockList locks, String functionFullyQualifiedName) throws AlgebricksException; /** * Acquire read lock on the node group @@ -141,10 +140,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param nodeGroupName * the name of the node group - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireNodeGroupReadLock(LockList locks, String nodeGroupName) throws AsterixException; + void acquireNodeGroupReadLock(LockList locks, String nodeGroupName) throws AlgebricksException; /** * Acquire write lock on the node group @@ -153,10 +152,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param nodeGroupName * the name of the node group - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireNodeGroupWriteLock(LockList locks, String nodeGroupName) throws AsterixException; + void acquireNodeGroupWriteLock(LockList locks, String nodeGroupName) throws AlgebricksException; /** * Acquire read lock on the active entity @@ -165,10 +164,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param entityFullyQualifiedName * the fully qualified name of the active entity - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireActiveEntityReadLock(LockList locks, String entityFullyQualifiedName) throws AsterixException; + void acquireActiveEntityReadLock(LockList locks, String entityFullyQualifiedName) throws AlgebricksException; /** * Acquire write lock on the active entity @@ -177,10 +176,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param entityFullyQualifiedName * the fully qualified name of the active entity - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireActiveEntityWriteLock(LockList locks, String entityFullyQualifiedName) throws AsterixException; + void acquireActiveEntityWriteLock(LockList locks, String entityFullyQualifiedName) throws AlgebricksException; /** * Acquire read lock on the feed policy @@ -189,10 +188,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param feedPolicyFullyQualifiedName * the fully qualified name of the feed policy - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireFeedPolicyWriteLock(LockList locks, String feedPolicyFullyQualifiedName) throws AsterixException; + void acquireFeedPolicyWriteLock(LockList locks, String feedPolicyFullyQualifiedName) throws AlgebricksException; /** * Acquire write lock on the feed policy @@ -201,10 +200,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param feedPolicyFullyQualifiedName * the fully qualified name of the feed policy - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireFeedPolicyReadLock(LockList locks, String feedPolicyFullyQualifiedName) throws AsterixException; + void acquireFeedPolicyReadLock(LockList locks, String feedPolicyFullyQualifiedName) throws AlgebricksException; /** * Acquire read lock on the merge policy @@ -213,10 +212,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param mergePolicyFullyQualifiedName * the fully qualified name of the merge policy - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireMergePolicyReadLock(LockList locks, String mergePolicyFullyQualifiedName) throws AsterixException; + void acquireMergePolicyReadLock(LockList locks, String mergePolicyFullyQualifiedName) throws AlgebricksException; /** * Acquire write lock on the merge policy @@ -225,10 +224,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param mergePolicyFullyQualifiedName * the fully qualified name of the merge policy - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireMergePolicyWriteLock(LockList locks, String mergePolicyFullyQualifiedName) throws AsterixException; + void acquireMergePolicyWriteLock(LockList locks, String mergePolicyFullyQualifiedName) throws AlgebricksException; /** * Acquire read lock on the data type @@ -237,10 +236,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param datatypeFullyQualifiedName * the fully qualified name of the data type - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireDataTypeReadLock(LockList locks, String datatypeFullyQualifiedName) throws AsterixException; + void acquireDataTypeReadLock(LockList locks, String datatypeFullyQualifiedName) throws AlgebricksException; /** * Acquire write lock on the data type @@ -249,10 +248,10 @@ public interface IMetadataLockManager { * the lock list to add the new lock to * @param datatypeFullyQualifiedName * the fully qualified name of the data type - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ - void acquireDataTypeWriteLock(LockList locks, String datatypeFullyQualifiedName) throws AsterixException; + void acquireDataTypeWriteLock(LockList locks, String datatypeFullyQualifiedName) throws AlgebricksException; /** * Acquire read lock on the extension entity @@ -263,11 +262,11 @@ public interface IMetadataLockManager { * the extension key * @param extensionEntityFullyQualifiedName * the fully qualified name of the extension entity - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ void acquireExtensionReadLock(LockList locks, String extension, String extensionEntityFullyQualifiedName) - throws AsterixException; + throws AlgebricksException; /** * Acquire write lock on the extension entity @@ -278,11 +277,11 @@ public interface IMetadataLockManager { * the extension key * @param extensionEntityFullyQualifiedName * the fully qualified name of the extension entity - * @throws AsterixException + * @throws AlgebricksException * if lock couldn't be acquired */ void acquireExtensionWriteLock(LockList locks, String extension, String extensionEntityFullyQualifiedName) - throws AsterixException; + throws AlgebricksException; /** * Upgrade a previously acquired exclusive modification lock on the dataset to a write lock http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java index 548907c..8afa66d 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java @@ -24,12 +24,12 @@ import java.util.concurrent.Executor; import org.apache.asterix.common.context.IStorageComponentProvider; import org.apache.asterix.common.exceptions.ACIDException; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.common.replication.IRemoteRecoveryManager; import org.apache.asterix.common.replication.IReplicaResourcesManager; import org.apache.asterix.common.replication.IReplicationChannel; import org.apache.asterix.common.replication.IReplicationManager; import org.apache.asterix.common.transactions.ITransactionSubsystem; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.api.application.INCServiceContext; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.io.IIOManager; @@ -68,7 +68,7 @@ public interface INcApplicationContext extends IApplicationContext { ILSMOperationTracker getLSMBTreeOperationTracker(int datasetID); - void initialize(boolean initialRun) throws IOException, ACIDException, AsterixException; + void initialize(boolean initialRun) throws IOException, ACIDException, AlgebricksException; void setShuttingdown(boolean b); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/cluster/IClusterStateManager.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/cluster/IClusterStateManager.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/cluster/IClusterStateManager.java index 3948ea6..7616aed 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/cluster/IClusterStateManager.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/cluster/IClusterStateManager.java @@ -27,6 +27,7 @@ import org.apache.asterix.common.dataflow.ICcApplicationContext; import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.event.schema.cluster.Node; import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.api.config.IOption; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.exceptions.HyracksException; @@ -115,7 +116,7 @@ public interface IClusterStateManager { * @param nodePartitions * @throws AsterixException */ - void registerNodePartitions(String nodeId, ClusterPartition[] nodePartitions) throws AsterixException; + void registerNodePartitions(String nodeId, ClusterPartition[] nodePartitions) throws AlgebricksException; /** * De-register the specified node's partitions from this cluster state manager http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/api/IDataParserFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/api/IDataParserFactory.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/api/IDataParserFactory.java index de104d4..b1c6428 100644 --- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/api/IDataParserFactory.java +++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/api/IDataParserFactory.java @@ -22,9 +22,9 @@ import java.io.Serializable; import java.util.List; import java.util.Map; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.external.api.IExternalDataSourceFactory.DataSourceType; import org.apache.asterix.om.types.ARecordType; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; public interface IDataParserFactory extends Serializable { @@ -34,7 +34,6 @@ public interface IDataParserFactory extends Serializable { * an instance of IDataParserFactory with RECORDS data source type must implement IRecordDataParserFactory * <T> * an instance of IDataParserFactory with STREAM data source type must implement IStreamDataParserFactory - * @throws AsterixException */ public DataSourceType getDataSourceType(); @@ -44,7 +43,7 @@ public interface IDataParserFactory extends Serializable { * * @param configuration */ - public void configure(Map<String, String> configuration) throws AsterixException; + public void configure(Map<String, String> configuration) throws AlgebricksException; /** * Set the record type expected to be produced by parsers created by this factory http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java index 2b5e248..ac474a5 100644 --- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java +++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java @@ -26,7 +26,6 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.common.exceptions.ErrorCode; import org.apache.asterix.common.exceptions.RuntimeDataException; import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer; @@ -573,32 +572,27 @@ public class JObjectAccessors { JList list = pointable.ordered() ? new JOrderedList(listType) : new JUnorderedList(listType); IJObject listItem; int index = 0; - try { - for (IVisitablePointable itemPointable : items) { - IVisitablePointable itemTagPointable = itemTags.get(index); - ATypeTag itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER - .deserialize(itemTagPointable.getByteArray()[itemTagPointable.getStartOffset()]); - IAType fieldType; - fieldType = TypeTagUtil.getBuiltinTypeByTag(itemTypeTag); - typeInfo.reset(fieldType, itemTypeTag); - switch (itemTypeTag) { - case OBJECT: - listItem = pointableVisitor.visit((ARecordVisitablePointable) itemPointable, typeInfo); - break; - case MULTISET: - case ARRAY: - listItem = pointableVisitor.visit((AListVisitablePointable) itemPointable, typeInfo); - break; - case ANY: - throw new RuntimeDataException(ErrorCode.LIBRARY_JOBJECT_ACCESSOR_CANNOT_PARSE_TYPE, - listType.getTypeTag()); - default: - listItem = pointableVisitor.visit((AFlatValuePointable) itemPointable, typeInfo); - } - list.add(listItem); + for (IVisitablePointable itemPointable : items) { + IVisitablePointable itemTagPointable = itemTags.get(index); + ATypeTag itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER + .deserialize(itemTagPointable.getByteArray()[itemTagPointable.getStartOffset()]); + final IAType fieldType = TypeTagUtil.getBuiltinTypeByTag(itemTypeTag); + typeInfo.reset(fieldType, itemTypeTag); + switch (itemTypeTag) { + case OBJECT: + listItem = pointableVisitor.visit((ARecordVisitablePointable) itemPointable, typeInfo); + break; + case MULTISET: + case ARRAY: + listItem = pointableVisitor.visit((AListVisitablePointable) itemPointable, typeInfo); + break; + case ANY: + throw new RuntimeDataException(ErrorCode.LIBRARY_JOBJECT_ACCESSOR_CANNOT_PARSE_TYPE, + listType.getTypeTag()); + default: + listItem = pointableVisitor.visit((AFlatValuePointable) itemPointable, typeInfo); } - } catch (AsterixException exception) { - throw HyracksDataException.create(exception); + list.add(listItem); } return list; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/factory/RecordWithMetadataParserFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/factory/RecordWithMetadataParserFactory.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/factory/RecordWithMetadataParserFactory.java index c7bf447..d34b5e0 100644 --- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/factory/RecordWithMetadataParserFactory.java +++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/factory/RecordWithMetadataParserFactory.java @@ -23,7 +23,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.common.exceptions.ErrorCode; import org.apache.asterix.external.api.IRecordDataParser; import org.apache.asterix.external.api.IRecordDataParserFactory; @@ -35,14 +34,15 @@ import org.apache.asterix.external.provider.RecordConverterFactoryProvider; import org.apache.asterix.external.util.ExternalDataCompatibilityUtils; import org.apache.asterix.external.util.ExternalDataConstants; import org.apache.asterix.om.types.ARecordType; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.api.context.IHyracksTaskContext; import org.apache.hyracks.api.exceptions.HyracksDataException; public class RecordWithMetadataParserFactory<I, O> implements IRecordDataParserFactory<I> { private static final long serialVersionUID = 1L; - private static final List<String> parserFormats = Collections - .unmodifiableList(Arrays.asList("record-with-metadata")); + private static final List<String> parserFormats = + Collections.unmodifiableList(Arrays.asList("record-with-metadata")); private ARecordType metaType; private ARecordType recordType; private IRecordDataParserFactory<O> recordParserFactory; @@ -50,16 +50,16 @@ public class RecordWithMetadataParserFactory<I, O> implements IRecordDataParserF @SuppressWarnings("unchecked") @Override - public void configure(Map<String, String> configuration) throws AsterixException { + public void configure(Map<String, String> configuration) throws AlgebricksException { // validate first String recordFormat = configuration.get(ExternalDataConstants.KEY_RECORD_FORMAT); if (recordFormat == null) { - throw new AsterixException(ErrorCode.UNKNOWN_RECORD_FORMAT_FOR_META_PARSER, + throw AlgebricksException.create(ErrorCode.UNKNOWN_RECORD_FORMAT_FOR_META_PARSER, ExternalDataConstants.KEY_FORMAT); } String format = configuration.get(ExternalDataConstants.KEY_FORMAT); if (format == null) { - throw new AsterixException(ErrorCode.UNKNOWN_RECORD_FORMAT_FOR_META_PARSER, + throw AlgebricksException.create(ErrorCode.UNKNOWN_RECORD_FORMAT_FOR_META_PARSER, ExternalDataConstants.KEY_FORMAT); } // Create Parser Factory http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/parser/factory/TestRecordWithPKParserFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/parser/factory/TestRecordWithPKParserFactory.java b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/parser/factory/TestRecordWithPKParserFactory.java index 7284979..42f1f99 100644 --- a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/parser/factory/TestRecordWithPKParserFactory.java +++ b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/parser/factory/TestRecordWithPKParserFactory.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.external.api.IRecordDataParser; import org.apache.asterix.external.api.IRecordDataParserFactory; import org.apache.asterix.external.input.record.RecordWithPK; @@ -32,6 +31,7 @@ import org.apache.asterix.external.provider.ParserFactoryProvider; import org.apache.asterix.external.util.ExternalDataConstants; import org.apache.asterix.om.types.ARecordType; import org.apache.asterix.om.types.IAType; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.api.context.IHyracksTaskContext; import org.apache.hyracks.api.exceptions.HyracksDataException; @@ -49,7 +49,7 @@ public class TestRecordWithPKParserFactory<T> implements IRecordDataParserFactor private int[][] pkIndexes; @Override - public void configure(Map<String, String> configuration) throws AsterixException { + public void configure(Map<String, String> configuration) throws AlgebricksException { TreeMap<String, String> parserConf = new TreeMap<String, String>(); format = configuration.get(ExternalDataConstants.KEY_RECORD_FORMAT); parserFormats.add(format); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IClusterManager.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IClusterManager.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IClusterManager.java index 4acd673..8459f70 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IClusterManager.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IClusterManager.java @@ -29,15 +29,15 @@ public interface IClusterManager { /** * @param node - * @throws AsterixException + * @throws Exception */ - public void addNode(ICcApplicationContext appCtx, Node node) throws AsterixException; + public void addNode(ICcApplicationContext appCtx, Node node) throws Exception; /** * @param node - * @throws AsterixException + * @throws Exception */ - public void removeNode(Node node) throws AsterixException; + public void removeNode(Node node) throws Exception; /** * @param subscriber http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManager.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManager.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManager.java index 1b4f5dc..c1c19a4 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManager.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManager.java @@ -91,42 +91,36 @@ public class ClusterManager implements IClusterManager { } @Override - public void addNode(ICcApplicationContext appCtx, Node node) throws AsterixException { - try { - Cluster cluster = ClusterProperties.INSTANCE.getCluster(); - List<Pattern> pattern = new ArrayList<>(); - String asterixInstanceName = appCtx.getMetadataProperties().getInstanceName(); - Patterns prepareNode = PatternCreator.INSTANCE.createPrepareNodePattern(asterixInstanceName, - ClusterProperties.INSTANCE.getCluster(), node); - cluster.getNode().add(node); - client.submit(prepareNode); - - ExternalProperties externalProps = appCtx.getExternalProperties(); - AsterixEventServiceUtil.poulateClusterEnvironmentProperties(cluster, externalProps.getCCJavaParams(), - externalProps.getNCJavaParams()); - - pattern.clear(); - String ccHost = cluster.getMasterNode().getClusterIp(); - String hostId = node.getId(); - String nodeControllerId = asterixInstanceName + "_" + node.getId(); - String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices(); - Pattern startNC = - PatternCreator.INSTANCE.createNCStartPattern(ccHost, hostId, nodeControllerId, iodevices, false); - pattern.add(startNC); - Patterns startNCPattern = new Patterns(pattern); - client.submit(startNCPattern); - - removeNode(cluster.getSubstituteNodes().getNode(), node); - - AsterixInstance instance = lookupService.getAsterixInstance(cluster.getInstanceName()); - instance.getCluster().getNode().add(node); - removeNode(instance.getCluster().getSubstituteNodes().getNode(), node); - lookupService.updateAsterixInstance(instance); - - } catch (Exception e) { - throw new AsterixException(e); - } - + public void addNode(ICcApplicationContext appCtx, Node node) throws Exception { + Cluster cluster = ClusterProperties.INSTANCE.getCluster(); + List<Pattern> pattern = new ArrayList<>(); + String asterixInstanceName = appCtx.getMetadataProperties().getInstanceName(); + Patterns prepareNode = PatternCreator.INSTANCE.createPrepareNodePattern(asterixInstanceName, + ClusterProperties.INSTANCE.getCluster(), node); + cluster.getNode().add(node); + client.submit(prepareNode); + + ExternalProperties externalProps = appCtx.getExternalProperties(); + AsterixEventServiceUtil.poulateClusterEnvironmentProperties(cluster, externalProps.getCCJavaParams(), + externalProps.getNCJavaParams()); + + pattern.clear(); + String ccHost = cluster.getMasterNode().getClusterIp(); + String hostId = node.getId(); + String nodeControllerId = asterixInstanceName + "_" + node.getId(); + String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices(); + Pattern startNC = + PatternCreator.INSTANCE.createNCStartPattern(ccHost, hostId, nodeControllerId, iodevices, false); + pattern.add(startNC); + Patterns startNCPattern = new Patterns(pattern); + client.submit(startNCPattern); + + removeNode(cluster.getSubstituteNodes().getNode(), node); + + AsterixInstance instance = lookupService.getAsterixInstance(cluster.getInstanceName()); + instance.getCluster().getNode().add(node); + removeNode(instance.getCluster().getSubstituteNodes().getNode(), node); + lookupService.updateAsterixInstance(instance); } private void removeNode(List<Node> list, Node node) { @@ -146,7 +140,7 @@ public class ClusterManager implements IClusterManager { } @Override - public void removeNode(Node node) throws AsterixException { + public void removeNode(Node node) { // to be implemented later. } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManagerProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManagerProvider.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManagerProvider.java index d11e70d..2b7c9df 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManagerProvider.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManagerProvider.java @@ -58,12 +58,12 @@ public class ClusterManagerProvider { } private static class NoopClusterManager implements IClusterManager { @Override - public void addNode(ICcApplicationContext appCtx, Node node) throws AsterixException { + public void addNode(ICcApplicationContext appCtx, Node node) { // no-op } @Override - public void removeNode(Node node) throws AsterixException { + public void removeNode(Node node) { // no-op } @@ -83,7 +83,7 @@ public class ClusterManagerProvider { } @Override - public void notifyStartupCompleted() throws Exception { + public void notifyStartupCompleted() { // no-op } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/LoadableDataSource.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/LoadableDataSource.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/LoadableDataSource.java index b13f4c2..91030bf 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/LoadableDataSource.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/LoadableDataSource.java @@ -65,17 +65,13 @@ public class LoadableDataSource extends DataSource { if (isPKAutoGenerated) { // Since the key is auto-generated, we need to use another // record type (possibly nested) which has all fields except the PK - try { - recType = getStrippedPKType(new LinkedList<>(partitioningKeys.get(0)), recType); - } catch (AsterixException e) { - throw new AlgebricksException(e); - } + recType = getStrippedPKType(new LinkedList<>(partitioningKeys.get(0)), recType); } schemaTypes = new IAType[] { recType }; } private ARecordType getStrippedPKType(List<String> partitioningKeys, ARecordType recType) - throws AsterixException, HyracksDataException { + throws AlgebricksException, HyracksDataException { List<String> fieldNames = new LinkedList<>(); List<IAType> fieldTypes = new LinkedList<>(); int j = 0; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/feeds/FeedMetadataUtil.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/feeds/FeedMetadataUtil.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/feeds/FeedMetadataUtil.java index 3f9c002..3de83eb 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/feeds/FeedMetadataUtil.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/feeds/FeedMetadataUtil.java @@ -99,7 +99,7 @@ public class FeedMetadataUtil { } public static void validateFeed(Feed feed, MetadataTransactionContext mdTxnCtx, ICcApplicationContext appCtx) - throws AsterixException { + throws AlgebricksException { try { String adapterName = feed.getAdapterName(); Map<String, String> configuration = feed.getAdapterConfiguration(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/23761dd7/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/lock/MetadataLockManager.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/lock/MetadataLockManager.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/lock/MetadataLockManager.java index 779fe2a..61bcbc7 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/lock/MetadataLockManager.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/lock/MetadataLockManager.java @@ -22,7 +22,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import org.apache.asterix.common.api.IMetadataLockManager; -import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.common.metadata.IMetadataLock; import org.apache.asterix.common.metadata.LockList; import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; @@ -49,147 +48,149 @@ public class MetadataLockManager implements IMetadataLockManager { } @Override - public void acquireDataverseReadLock(LockList locks, String dataverseName) throws AsterixException { + public void acquireDataverseReadLock(LockList locks, String dataverseName) throws AlgebricksException { String key = DATAVERSE_PREFIX + dataverseName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.READ, lock); } @Override - public void acquireDataverseWriteLock(LockList locks, String dataverseName) throws AsterixException { + public void acquireDataverseWriteLock(LockList locks, String dataverseName) throws AlgebricksException { String key = DATAVERSE_PREFIX + dataverseName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.WRITE, lock); } @Override - public void acquireDatasetReadLock(LockList locks, String datasetName) throws AsterixException { + public void acquireDatasetReadLock(LockList locks, String datasetName) throws AlgebricksException { String key = DATASET_PREFIX + datasetName; DatasetLock lock = (DatasetLock) mdlocks.computeIfAbsent(key, DATASET_LOCK_FUNCTION); locks.add(IMetadataLock.Mode.READ, lock); } @Override - public void acquireDatasetWriteLock(LockList locks, String datasetName) throws AsterixException { + public void acquireDatasetWriteLock(LockList locks, String datasetName) throws AlgebricksException { String key = DATASET_PREFIX + datasetName; DatasetLock lock = (DatasetLock) mdlocks.computeIfAbsent(key, DATASET_LOCK_FUNCTION); locks.add(IMetadataLock.Mode.WRITE, lock); } @Override - public void acquireDatasetModifyLock(LockList locks, String datasetName) throws AsterixException { + public void acquireDatasetModifyLock(LockList locks, String datasetName) throws AlgebricksException { String key = DATASET_PREFIX + datasetName; DatasetLock lock = (DatasetLock) mdlocks.computeIfAbsent(key, DATASET_LOCK_FUNCTION); locks.add(IMetadataLock.Mode.MODIFY, lock); } @Override - public void acquireDatasetCreateIndexLock(LockList locks, String datasetName) throws AsterixException { + public void acquireDatasetCreateIndexLock(LockList locks, String datasetName) throws AlgebricksException { String dsKey = DATASET_PREFIX + datasetName; DatasetLock lock = (DatasetLock) mdlocks.computeIfAbsent(dsKey, DATASET_LOCK_FUNCTION); locks.add(IMetadataLock.Mode.INDEX_BUILD, lock); } @Override - public void acquireDatasetExclusiveModificationLock(LockList locks, String datasetName) throws AsterixException { + public void acquireDatasetExclusiveModificationLock(LockList locks, String datasetName) throws AlgebricksException { String key = DATASET_PREFIX + datasetName; DatasetLock lock = (DatasetLock) mdlocks.computeIfAbsent(key, DATASET_LOCK_FUNCTION); locks.add(IMetadataLock.Mode.EXCLUSIVE_MODIFY, lock); } @Override - public void acquireFunctionReadLock(LockList locks, String functionName) throws AsterixException { + public void acquireFunctionReadLock(LockList locks, String functionName) throws AlgebricksException { String key = FUNCTION_PREFIX + functionName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.READ, lock); } @Override - public void acquireFunctionWriteLock(LockList locks, String functionName) throws AsterixException { + public void acquireFunctionWriteLock(LockList locks, String functionName) throws AlgebricksException { String key = FUNCTION_PREFIX + functionName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.WRITE, lock); } @Override - public void acquireNodeGroupReadLock(LockList locks, String nodeGroupName) throws AsterixException { + public void acquireNodeGroupReadLock(LockList locks, String nodeGroupName) throws AlgebricksException { String key = NODE_GROUP_PREFIX + nodeGroupName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.READ, lock); } @Override - public void acquireNodeGroupWriteLock(LockList locks, String nodeGroupName) throws AsterixException { + public void acquireNodeGroupWriteLock(LockList locks, String nodeGroupName) throws AlgebricksException { String key = NODE_GROUP_PREFIX + nodeGroupName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.WRITE, lock); } @Override - public void acquireActiveEntityReadLock(LockList locks, String entityName) throws AsterixException { + public void acquireActiveEntityReadLock(LockList locks, String entityName) throws AlgebricksException { String key = ACTIVE_PREFIX + entityName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.READ, lock); } @Override - public void acquireActiveEntityWriteLock(LockList locks, String entityName) throws AsterixException { + public void acquireActiveEntityWriteLock(LockList locks, String entityName) throws AlgebricksException { String key = ACTIVE_PREFIX + entityName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.WRITE, lock); } @Override - public void acquireFeedPolicyWriteLock(LockList locks, String feedPolicyName) throws AsterixException { + public void acquireFeedPolicyWriteLock(LockList locks, String feedPolicyName) throws AlgebricksException { String key = FEED_POLICY_PREFIX + feedPolicyName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.WRITE, lock); } @Override - public void acquireFeedPolicyReadLock(LockList locks, String feedPolicyName) throws AsterixException { + public void acquireFeedPolicyReadLock(LockList locks, String feedPolicyName) throws AlgebricksException { String key = FEED_POLICY_PREFIX + feedPolicyName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.READ, lock); } @Override - public void acquireMergePolicyReadLock(LockList locks, String mergePolicyName) throws AsterixException { + public void acquireMergePolicyReadLock(LockList locks, String mergePolicyName) throws AlgebricksException { String key = MERGE_POLICY_PREFIX + mergePolicyName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.READ, lock); } @Override - public void acquireMergePolicyWriteLock(LockList locks, String mergePolicyName) throws AsterixException { + public void acquireMergePolicyWriteLock(LockList locks, String mergePolicyName) throws AlgebricksException { String key = MERGE_POLICY_PREFIX + mergePolicyName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.WRITE, lock); } @Override - public void acquireDataTypeReadLock(LockList locks, String datatypeName) throws AsterixException { + public void acquireDataTypeReadLock(LockList locks, String datatypeName) throws AlgebricksException { String key = DATATYPE_PREFIX + datatypeName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.READ, lock); } @Override - public void acquireDataTypeWriteLock(LockList locks, String datatypeName) throws AsterixException { + public void acquireDataTypeWriteLock(LockList locks, String datatypeName) throws AlgebricksException { String key = DATATYPE_PREFIX + datatypeName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.WRITE, lock); } @Override - public void acquireExtensionReadLock(LockList locks, String extension, String entityName) throws AsterixException { + public void acquireExtensionReadLock(LockList locks, String extension, String entityName) + throws AlgebricksException { String key = EXTENSION_PREFIX + extension + entityName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.READ, lock); } @Override - public void acquireExtensionWriteLock(LockList locks, String extension, String entityName) throws AsterixException { + public void acquireExtensionWriteLock(LockList locks, String extension, String entityName) + throws AlgebricksException { String key = EXTENSION_PREFIX + extension + entityName; IMetadataLock lock = mdlocks.computeIfAbsent(key, LOCK_FUNCTION); locks.add(IMetadataLock.Mode.WRITE, lock);
