http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d25513cc/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataManager.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataManager.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataManager.java index 88153a3..43a927b 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataManager.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataManager.java @@ -23,7 +23,6 @@ import java.rmi.RemoteException; import java.util.List; import org.apache.asterix.common.exceptions.ACIDException; -import org.apache.asterix.common.exceptions.MetadataException; import org.apache.asterix.common.functions.FunctionSignature; import org.apache.asterix.common.metadata.IMetadataBootstrap; import org.apache.asterix.external.indexing.ExternalFile; @@ -41,6 +40,7 @@ import org.apache.asterix.metadata.entities.Index; import org.apache.asterix.metadata.entities.Library; import org.apache.asterix.metadata.entities.Node; import org.apache.asterix.metadata.entities.NodeGroup; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; /** * A metadata manager provides user access to Asterix metadata (e.g., types, @@ -86,8 +86,8 @@ public interface IMetadataManager extends IMetadataBootstrap { void abortTransaction(MetadataTransactionContext ctx) throws ACIDException, RemoteException; /** - * Locks the metadata in given mode. The lock acquisition is delegated to - * the metadata node. This method blocks until the lock can be acquired. + * Locks the metadata in given mode. The lock acquisition is delegated to the + * metadata node. This method blocks until the lock can be acquired. * * @param ctx * MetadataTransactionContext of an active metadata transaction. @@ -115,10 +115,10 @@ public interface IMetadataManager extends IMetadataBootstrap { * MetadataTransactionContext of an active metadata transaction. * @param dataverse * Dataverse instance to be inserted. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataverse already exists. */ - void addDataverse(MetadataTransactionContext ctx, Dataverse dataverse) throws MetadataException; + void addDataverse(MetadataTransactionContext ctx, Dataverse dataverse) throws AlgebricksException; /** * Retrieves all dataverses @@ -126,9 +126,9 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param ctx * MetadataTransactionContext of an active metadata transaction. * @return A list of dataverse instances. - * @throws MetadataException + * @throws AlgebricksException */ - List<Dataverse> getDataverses(MetadataTransactionContext ctx) throws MetadataException; + List<Dataverse> getDataverses(MetadataTransactionContext ctx) throws AlgebricksException; /** * Retrieves a dataverse with given name. @@ -138,10 +138,10 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param dataverseName * Name of the dataverse to retrieve. * @return A dataverse instance. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataverse does not exist. */ - Dataverse getDataverse(MetadataTransactionContext ctx, String dataverseName) throws MetadataException; + Dataverse getDataverse(MetadataTransactionContext ctx, String dataverseName) throws AlgebricksException; /** * Retrieves all datasets belonging to the given dataverse. @@ -151,10 +151,10 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param dataverseName * Name of the dataverse of which to find all datasets. * @return A list of dataset instances. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataverse does not exist. */ - List<Dataset> getDataverseDatasets(MetadataTransactionContext ctx, String dataverseName) throws MetadataException; + List<Dataset> getDataverseDatasets(MetadataTransactionContext ctx, String dataverseName) throws AlgebricksException; /** * Deletes the dataverse with given name, and all it's associated datasets, @@ -163,10 +163,10 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param ctx * MetadataTransactionContext of an active metadata transaction. * @return A list of dataset instances. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataverse does not exist. */ - void dropDataverse(MetadataTransactionContext ctx, String dataverseName) throws MetadataException; + void dropDataverse(MetadataTransactionContext ctx, String dataverseName) throws AlgebricksException; /** * Inserts a new dataset into the metadata. @@ -175,10 +175,10 @@ public interface IMetadataManager extends IMetadataBootstrap { * MetadataTransactionContext of an active metadata transaction. * @param dataset * Dataset instance to be inserted. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataset already exists. */ - void addDataset(MetadataTransactionContext ctx, Dataset dataset) throws MetadataException; + void addDataset(MetadataTransactionContext ctx, Dataset dataset) throws AlgebricksException; /** * Retrieves a dataset within a given dataverse. @@ -190,11 +190,11 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param datasetName * Name of dataset to be retrieved. * @return A dataset instance. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataset does not exist. */ Dataset getDataset(MetadataTransactionContext ctx, String dataverseName, String datasetName) - throws MetadataException; + throws AlgebricksException; /** * Retrieves all indexes of a dataset. @@ -206,11 +206,11 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param datasetName * Name of dataset for which to retrieve all indexes. * @return A list of Index instances. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataset and/or dataverse does not exist. */ List<Index> getDatasetIndexes(MetadataTransactionContext ctx, String dataverseName, String datasetName) - throws MetadataException; + throws AlgebricksException; /** * Deletes the dataset with given name, and all it's associated indexes. @@ -221,10 +221,11 @@ public interface IMetadataManager extends IMetadataBootstrap { * Name of dataverse which holds the given dataset. * @param datasetName * Name of dataset to delete. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataset and/or dataverse does not exist. */ - void dropDataset(MetadataTransactionContext ctx, String dataverseName, String datasetName) throws MetadataException; + void dropDataset(MetadataTransactionContext ctx, String dataverseName, String datasetName) + throws AlgebricksException; /** * Inserts an index into the metadata. The index itself knows its name, and @@ -234,10 +235,10 @@ public interface IMetadataManager extends IMetadataBootstrap { * MetadataTransactionContext of an active metadata transaction. * @param index * Index instance to be inserted. - * @throws MetadataException + * @throws AlgebricksException * For example, if the index already exists. */ - void addIndex(MetadataTransactionContext ctx, Index index) throws MetadataException; + void addIndex(MetadataTransactionContext ctx, Index index) throws AlgebricksException; /** * Retrieves the index with given name, in given dataverse and dataset. @@ -251,11 +252,11 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param indexName * Name of the index to retrieve. * @return An Index instance. - * @throws MetadataException + * @throws AlgebricksException * For example, if the index does not exist. */ Index getIndex(MetadataTransactionContext ctx, String dataverseName, String datasetName, String indexName) - throws MetadataException; + throws AlgebricksException; /** * Deletes the index with given name, in given dataverse and dataset. @@ -268,11 +269,11 @@ public interface IMetadataManager extends IMetadataBootstrap { * Name of the dataset holding the index. * @param indexName * Name of the index to retrieve. - * @throws MetadataException + * @throws AlgebricksException * For example, if the index does not exist. */ void dropIndex(MetadataTransactionContext ctx, String dataverseName, String datasetName, String indexName) - throws MetadataException; + throws AlgebricksException; /** * Inserts a datatype. @@ -281,10 +282,10 @@ public interface IMetadataManager extends IMetadataBootstrap { * MetadataTransactionContext of an active metadata transaction. * @param datatype * Datatype instance to be inserted. - * @throws MetadataException + * @throws AlgebricksException * For example, if the datatype already exists. */ - void addDatatype(MetadataTransactionContext ctx, Datatype datatype) throws MetadataException; + void addDatatype(MetadataTransactionContext ctx, Datatype datatype) throws AlgebricksException; /** * Retrieves the datatype with given name in given dataverse. @@ -296,11 +297,11 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param datatypeName * Name of datatype to be retrieved. * @return A datatype instance. - * @throws MetadataException + * @throws AlgebricksException * For example, if the datatype does not exist. */ Datatype getDatatype(MetadataTransactionContext ctx, String dataverseName, String datatypeName) - throws MetadataException; + throws AlgebricksException; /** * Deletes the given datatype in given dataverse. @@ -311,12 +312,12 @@ public interface IMetadataManager extends IMetadataBootstrap { * Name of dataverse holding the datatype. * @param datatypeName * Name of datatype to be deleted. - * @throws MetadataException + * @throws AlgebricksException * For example, if there are still datasets using the type to be * deleted. */ void dropDatatype(MetadataTransactionContext ctx, String dataverseName, String datatypeName) - throws MetadataException; + throws AlgebricksException; /** * Inserts a node group. @@ -325,10 +326,10 @@ public interface IMetadataManager extends IMetadataBootstrap { * MetadataTransactionContext of an active metadata transaction. * @param nodeGroup * Node group instance to insert. - * @throws MetadataException + * @throws AlgebricksException * For example, if the node group already exists. */ - void addNodegroup(MetadataTransactionContext ctx, NodeGroup nodeGroup) throws MetadataException; + void addNodegroup(MetadataTransactionContext ctx, NodeGroup nodeGroup) throws AlgebricksException; /** * Retrieves a node group. @@ -337,10 +338,10 @@ public interface IMetadataManager extends IMetadataBootstrap { * MetadataTransactionContext of an active metadata transaction. * @param nodeGroupName * Name of node group to be retrieved. - * @throws MetadataException + * @throws AlgebricksException * For example, if the node group does not exist. */ - NodeGroup getNodegroup(MetadataTransactionContext ctx, String nodeGroupName) throws MetadataException; + NodeGroup getNodegroup(MetadataTransactionContext ctx, String nodeGroupName) throws AlgebricksException; /** * Deletes a node group. @@ -350,13 +351,14 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param nodeGroupName * Name of node group to be deleted. * @param failSilently - * true means it's a no-op if the node group cannot be dropped; false means it will throw an exception. - * @throws MetadataException + * true means it's a no-op if the node group cannot be dropped; false + * means it will throw an exception. + * @throws AlgebricksException * For example, there are still datasets partitioned on the node * group to be deleted. */ void dropNodegroup(MetadataTransactionContext ctx, String nodeGroupName, boolean failSilently) - throws MetadataException; + throws AlgebricksException; /** * Inserts a node (machine). @@ -365,20 +367,20 @@ public interface IMetadataManager extends IMetadataBootstrap { * MetadataTransactionContext of an active metadata transaction. * @param node * Node instance to be inserted. - * @throws MetadataException + * @throws AlgebricksException * For example, if the node already exists. */ - void addNode(MetadataTransactionContext ctx, Node node) throws MetadataException; + void addNode(MetadataTransactionContext ctx, Node node) throws AlgebricksException; /** * @param mdTxnCtx * MetadataTransactionContext of an active metadata transaction. * @param function - * An instance of type Function that represents the function - * being added - * @throws MetadataException + * An instance of type Function that represents the function being + * added + * @throws AlgebricksException */ - void addFunction(MetadataTransactionContext mdTxnCtx, Function function) throws MetadataException; + void addFunction(MetadataTransactionContext mdTxnCtx, Function function) throws AlgebricksException; /** * @param ctx @@ -386,21 +388,22 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param functionSignature * the functions signature (unique to the function) * @return - * @throws MetadataException + * @throws AlgebricksException */ - Function getFunction(MetadataTransactionContext ctx, FunctionSignature functionSignature) throws MetadataException; + Function getFunction(MetadataTransactionContext ctx, FunctionSignature functionSignature) + throws AlgebricksException; - List<Function> getFunctions(MetadataTransactionContext ctx, String dataverseName) throws MetadataException; + List<Function> getFunctions(MetadataTransactionContext ctx, String dataverseName) throws AlgebricksException; /** * @param ctx * MetadataTransactionContext of an active metadata transaction. * @param functionSignature * the functions signature (unique to the function) - * @throws MetadataException + * @throws AlgebricksException */ - void dropFunction(MetadataTransactionContext ctx, FunctionSignature functionSignature) throws MetadataException; + void dropFunction(MetadataTransactionContext ctx, FunctionSignature functionSignature) throws AlgebricksException; /** * @param mdTxnCtx @@ -408,9 +411,9 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param adapter * An instance of type Adapter that represents the adapter being * added - * @throws MetadataException + * @throws AlgebricksException */ - void addAdapter(MetadataTransactionContext mdTxnCtx, DatasourceAdapter adapter) throws MetadataException; + void addAdapter(MetadataTransactionContext mdTxnCtx, DatasourceAdapter adapter) throws AlgebricksException; /** * @param ctx @@ -420,10 +423,10 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param name * name of the adapter * @return - * @throws MetadataException + * @throws AlgebricksException */ DatasourceAdapter getAdapter(MetadataTransactionContext ctx, String dataverseName, String name) - throws MetadataException; + throws AlgebricksException; /** * @param ctx @@ -432,9 +435,9 @@ public interface IMetadataManager extends IMetadataBootstrap { * the dataverse associated with the adapter being dropped * @param name * name of the adapter - * @throws MetadataException + * @throws AlgebricksException */ - void dropAdapter(MetadataTransactionContext ctx, String dataverseName, String name) throws MetadataException; + void dropAdapter(MetadataTransactionContext ctx, String dataverseName, String name) throws AlgebricksException; /** * @param ctx @@ -442,90 +445,91 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param dataverseName * the dataverse whose associated adapters are being requested * @return - * @throws MetadataException + * @throws AlgebricksException */ List<DatasourceAdapter> getDataverseAdapters(MetadataTransactionContext ctx, String dataverseName) - throws MetadataException; + throws AlgebricksException; /** * @param ctx * @param policy - * @throws MetadataException + * @throws AlgebricksException */ - void addCompactionPolicy(MetadataTransactionContext ctx, CompactionPolicy policy) throws MetadataException; + void addCompactionPolicy(MetadataTransactionContext ctx, CompactionPolicy policy) throws AlgebricksException; /** * @param ctx * @param dataverse * @param policyName * @return - * @throws MetadataException + * @throws AlgebricksException */ CompactionPolicy getCompactionPolicy(MetadataTransactionContext ctx, String dataverse, String policyName) - throws MetadataException; + throws AlgebricksException; /** * @param ctx * @param dataverseName * @return - * @throws MetadataException + * @throws AlgebricksException */ - List<Function> getDataverseFunctions(MetadataTransactionContext ctx, String dataverseName) throws MetadataException; + List<Function> getDataverseFunctions(MetadataTransactionContext ctx, String dataverseName) + throws AlgebricksException; /** * @param ctx * @param feed - * @throws MetadataException + * @throws AlgebricksException */ - void addFeed(MetadataTransactionContext ctx, Feed feed) throws MetadataException; + void addFeed(MetadataTransactionContext ctx, Feed feed) throws AlgebricksException; /** * @param ctx * @param dataverse * @param feedName * @return - * @throws MetadataException + * @throws AlgebricksException */ - Feed getFeed(MetadataTransactionContext ctx, String dataverse, String feedName) throws MetadataException; + Feed getFeed(MetadataTransactionContext ctx, String dataverse, String feedName) throws AlgebricksException; - List<Feed> getFeeds(MetadataTransactionContext ctx, String dataverse) throws MetadataException; + List<Feed> getFeeds(MetadataTransactionContext ctx, String dataverse) throws AlgebricksException; /** * @param ctx * @param dataverse * @param feedName - * @throws MetadataException + * @throws AlgebricksException */ - void dropFeed(MetadataTransactionContext ctx, String dataverse, String feedName) throws MetadataException; + void dropFeed(MetadataTransactionContext ctx, String dataverse, String feedName) throws AlgebricksException; /** * @param ctx * @param policy - * @throws MetadataException + * @throws AlgebricksException */ - void addFeedPolicy(MetadataTransactionContext ctx, FeedPolicyEntity policy) throws MetadataException; + void addFeedPolicy(MetadataTransactionContext ctx, FeedPolicyEntity policy) throws AlgebricksException; /** * @param ctx * @param dataverse * @param policyName - * @throws MetadataException + * @throws AlgebricksException */ - void dropFeedPolicy(MetadataTransactionContext ctx, String dataverse, String policyName) throws MetadataException; + void dropFeedPolicy(MetadataTransactionContext ctx, String dataverse, String policyName) throws AlgebricksException; /** * @param ctx * @param dataverse * @param policyName * @return - * @throws MetadataException + * @throws AlgebricksException */ FeedPolicyEntity getFeedPolicy(MetadataTransactionContext ctx, String dataverse, String policyName) - throws MetadataException; + throws AlgebricksException; - void initializeDatasetIdFactory(MetadataTransactionContext ctx) throws MetadataException; + void initializeDatasetIdFactory(MetadataTransactionContext ctx) throws AlgebricksException; - int getMostRecentDatasetId() throws MetadataException; + int getMostRecentDatasetId() throws AlgebricksException; void acquireWriteLatch(); @@ -536,32 +540,32 @@ public interface IMetadataManager extends IMetadataBootstrap { void releaseReadLatch(); /** - * Removes a library , acquiring local locks on behalf of the given - * transaction id. + * Removes a library , acquiring local locks on behalf of the given transaction + * id. * * @param ctx * MetadataTransactionContext of an active metadata transaction. * @param dataverseName * dataverse asociated with the adapter that is to be deleted. * @param libraryName - * Name of library to be deleted. MetadataException for example, - * if the library does not exists. - * @throws MetadataException + * Name of library to be deleted. AlgebricksException for example, if + * the library does not exists. + * @throws AlgebricksException */ - void dropLibrary(MetadataTransactionContext ctx, String dataverseName, String libraryName) throws MetadataException; + void dropLibrary(MetadataTransactionContext ctx, String dataverseName, String libraryName) + throws AlgebricksException; /** - * Adds a library, acquiring local locks on behalf of the given - * transaction id. + * Adds a library, acquiring local locks on behalf of the given transaction id. * * @param ctx * MetadataTransactionContext of an active metadata transaction. * @param library * Library to be added - * @throws MetadataException + * @throws AlgebricksException * for example, if the library is already added. */ - void addLibrary(MetadataTransactionContext ctx, Library library) throws MetadataException; + void addLibrary(MetadataTransactionContext ctx, Library library) throws AlgebricksException; /** * @param ctx @@ -571,11 +575,11 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param libraryName * name of the library that is to be retrieved * @return Library - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ Library getLibrary(MetadataTransactionContext ctx, String dataverseName, String libraryName) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** * Retireve libraries installed in a given dataverse. @@ -585,19 +589,20 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param dataverseName * dataverse asociated with the library that is to be retrieved. * @return Library - * @throws MetadataException + * @throws AlgebricksException */ - List<Library> getDataverseLibraries(MetadataTransactionContext ctx, String dataverseName) throws MetadataException; + List<Library> getDataverseLibraries(MetadataTransactionContext ctx, String dataverseName) + throws AlgebricksException; /** * @param mdTxnCtx * MetadataTransactionContext of an active metadata transaction. * @param externalFile - * An instance of type ExternalFile that represents the external file being - * added - * @throws MetadataException + * An instance of type ExternalFile that represents the external file + * being added + * @throws AlgebricksException */ - void addExternalFile(MetadataTransactionContext mdTxnCtx, ExternalFile externalFile) throws MetadataException; + void addExternalFile(MetadataTransactionContext mdTxnCtx, ExternalFile externalFile) throws AlgebricksException; /** * @param mdTxnCtx @@ -605,20 +610,20 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param dataset * An instance of type Dataset that represents the "external" dataset * @return A list of external files belonging to the dataset - * @throws MetadataException + * @throws AlgebricksException */ List<ExternalFile> getDatasetExternalFiles(MetadataTransactionContext mdTxnCtx, Dataset dataset) - throws MetadataException; + throws AlgebricksException; /** * @param mdTxnCtx * MetadataTransactionContext of an active metadata transaction. * @param externalFile - * An instance of type ExternalFile that represents the external file being - * dropped - * @throws MetadataException + * An instance of type ExternalFile that represents the external file + * being dropped + * @throws AlgebricksException */ - void dropExternalFile(MetadataTransactionContext mdTxnCtx, ExternalFile externalFile) throws MetadataException; + void dropExternalFile(MetadataTransactionContext mdTxnCtx, ExternalFile externalFile) throws AlgebricksException; /** * @param mdTxnCtx @@ -626,9 +631,9 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param dataset * An instance of type dataset that owns the external files being * dropped - * @throws MetadataException + * @throws AlgebricksException */ - void dropDatasetExternalFiles(MetadataTransactionContext mdTxnCtx, Dataset dataset) throws MetadataException; + void dropDatasetExternalFiles(MetadataTransactionContext mdTxnCtx, Dataset dataset) throws AlgebricksException; /** * Get en external file @@ -638,10 +643,10 @@ public interface IMetadataManager extends IMetadataBootstrap { * @param datasetName * @param fileNumber * @return - * @throws MetadataException + * @throws AlgebricksException */ ExternalFile getExternalFile(MetadataTransactionContext mdTxnCtx, String dataverseName, String datasetName, - Integer fileNumber) throws MetadataException; + Integer fileNumber) throws AlgebricksException; /** * update an existing dataset in metadata. @@ -650,76 +655,80 @@ public interface IMetadataManager extends IMetadataBootstrap { * MetadataTransactionContext of an active metadata transaction. * @param dataset * Existing Dataset. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataset already exists. */ - void updateDataset(MetadataTransactionContext ctx, Dataset dataset) throws MetadataException; + void updateDataset(MetadataTransactionContext ctx, Dataset dataset) throws AlgebricksException; /** * Clean up temporary datasets that have not been active for a long time. * - * @throws MetadataException + * @throws AlgebricksException */ - void cleanupTempDatasets() throws MetadataException; + void cleanupTempDatasets() throws AlgebricksException; /** - * Add an extension entity to its extension dataset under the ongoing metadata transaction + * Add an extension entity to its extension dataset under the ongoing metadata + * transaction * * @param mdTxnCtx * @param entity - * @throws MetadataException + * @throws AlgebricksException */ <T extends IExtensionMetadataEntity> void addEntity(MetadataTransactionContext mdTxnCtx, T entity) - throws MetadataException; + throws AlgebricksException; /** - * Upsert an extension entity to its extension dataset under the ongoing metadata transaction + * Upsert an extension entity to its extension dataset under the ongoing + * metadata transaction * * @param mdTxnCtx * @param entity - * @throws MetadataException + * @throws AlgebricksException */ <T extends IExtensionMetadataEntity> void upsertEntity(MetadataTransactionContext mdTxnCtx, T entity) - throws MetadataException; + throws AlgebricksException; /** - * Deletes an extension entity from its extension dataset under the ongoing metadata transaction + * Deletes an extension entity from its extension dataset under the ongoing + * metadata transaction * * @param mdTxnCtx * @param entity - * @throws MetadataException + * @throws AlgebricksException */ <T extends IExtensionMetadataEntity> void deleteEntity(MetadataTransactionContext mdTxnCtx, T entity) - throws MetadataException; + throws AlgebricksException; /** - * Gets a list of extension entities matching a search key under the ongoing metadata transaction + * Gets a list of extension entities matching a search key under the ongoing + * metadata transaction * * @param mdTxnCtx * @param searchKey * @return - * @throws MetadataException + * @throws AlgebricksException */ <T extends IExtensionMetadataEntity> List<T> getEntities(MetadataTransactionContext mdTxnCtx, - IExtensionMetadataSearchKey searchKey) throws MetadataException; + IExtensionMetadataSearchKey searchKey) throws AlgebricksException; /** - * Indicate when the metadata node has left or rejoined the cluster, and the MetadataManager should - * rebind it + * Indicate when the metadata node has left or rejoined the cluster, and the + * MetadataManager should rebind it */ void rebindMetadataNode(); /** * Feed Connection Related Metadata operations */ - void addFeedConnection(MetadataTransactionContext ctx, FeedConnection feedConnection) throws MetadataException; + void addFeedConnection(MetadataTransactionContext ctx, FeedConnection feedConnection) throws AlgebricksException; void dropFeedConnection(MetadataTransactionContext ctx, String dataverseName, String feedName, String datasetName) - throws MetadataException; + throws AlgebricksException; FeedConnection getFeedConnection(MetadataTransactionContext ctx, String dataverseName, String feedName, - String datasetName) throws MetadataException; + String datasetName) throws AlgebricksException; List<FeedConnection> getFeedConections(MetadataTransactionContext ctx, String dataverseName, String feedName) - throws MetadataException; + throws AlgebricksException; }
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d25513cc/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataNode.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataNode.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataNode.java index a990d29..8c4920f 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataNode.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IMetadataNode.java @@ -25,7 +25,6 @@ import java.rmi.RemoteException; import java.util.List; import org.apache.asterix.common.exceptions.ACIDException; -import org.apache.asterix.common.exceptions.MetadataException; import org.apache.asterix.common.functions.FunctionSignature; import org.apache.asterix.common.transactions.JobId; import org.apache.asterix.external.indexing.ExternalFile; @@ -42,15 +41,15 @@ import org.apache.asterix.metadata.entities.Index; import org.apache.asterix.metadata.entities.Library; import org.apache.asterix.metadata.entities.Node; import org.apache.asterix.metadata.entities.NodeGroup; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; /** * A metadata node stores metadata in its local storage structures (currently * BTrees). A metadata node services requests on behalf of the (possibly remote) * metadata manager by executing local transactions against its local storage. - * This interface mirrors the methods in IMetadataManager. - * Users wanting to lock/access metadata shall always go through the - * MetadataManager, and should never call methods on the MetadataNode directly - * for any reason. + * This interface mirrors the methods in IMetadataManager. Users wanting to + * lock/access metadata shall always go through the MetadataManager, and should + * never call methods on the MetadataNode directly for any reason. */ public interface IMetadataNode extends Remote, Serializable { @@ -96,46 +95,46 @@ public interface IMetadataNode extends Remote, Serializable { void unlock(JobId jobId, byte lockMode) throws ACIDException, RemoteException; /** - * Inserts a new dataverse into the metadata, acquiring local locks on - * behalf of the given transaction id. + * Inserts a new dataverse into the metadata, acquiring local locks on behalf of + * the given transaction id. * * @param jobId * A globally unique id for an active metadata transaction. * @param dataverse * Dataverse instance to be inserted. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataverse already exists. * @throws RemoteException */ - void addDataverse(JobId jobId, Dataverse dataverse) throws MetadataException, RemoteException; + void addDataverse(JobId jobId, Dataverse dataverse) throws AlgebricksException, RemoteException; /** - * Retrieves all dataverses, acquiring local locks on behalf of - * the given transaction id. + * Retrieves all dataverses, acquiring local locks on behalf of the given + * transaction id. * * @param jobId * A globally unique id for an active metadata transaction. * @return A list of dataverse instances. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataverse does not exist. * @throws RemoteException */ - List<Dataverse> getDataverses(JobId jobId) throws MetadataException, RemoteException; + List<Dataverse> getDataverses(JobId jobId) throws AlgebricksException, RemoteException; /** - * Retrieves a dataverse with given name, acquiring local locks on behalf of - * the given transaction id. + * Retrieves a dataverse with given name, acquiring local locks on behalf of the + * given transaction id. * * @param jobId * A globally unique id for an active metadata transaction. * @param dataverseName * Name of the dataverse to retrieve. * @return A dataverse instance. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataverse does not exist. * @throws RemoteException */ - Dataverse getDataverse(JobId jobId, String dataverseName) throws MetadataException, RemoteException; + Dataverse getDataverse(JobId jobId, String dataverseName) throws AlgebricksException, RemoteException; /** * Retrieves all datasets belonging to the given dataverse, acquiring local @@ -146,42 +145,42 @@ public interface IMetadataNode extends Remote, Serializable { * @param dataverseName * Name of the dataverse of which to find all datasets. * @return A list of dataset instances. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataverse does not exist. RemoteException */ - List<Dataset> getDataverseDatasets(JobId jobId, String dataverseName) throws MetadataException, RemoteException; + List<Dataset> getDataverseDatasets(JobId jobId, String dataverseName) throws AlgebricksException, RemoteException; /** * Deletes the dataverse with given name, and all it's associated datasets, - * indexes, and types, acquiring local locks on behalf of the given - * transaction id. + * indexes, and types, acquiring local locks on behalf of the given transaction + * id. * * @param jobId * A globally unique id for an active metadata transaction. * @return A list of dataset instances. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataverse does not exist. * @throws RemoteException */ - void dropDataverse(JobId jobId, String dataverseName) throws MetadataException, RemoteException; + void dropDataverse(JobId jobId, String dataverseName) throws AlgebricksException, RemoteException; /** - * Inserts a new dataset into the metadata, acquiring local locks on behalf - * of the given transaction id. + * Inserts a new dataset into the metadata, acquiring local locks on behalf of + * the given transaction id. * * @param jobId * A globally unique id for an active metadata transaction. * @param dataset * Dataset instance to be inserted. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataset already exists. * @throws RemoteException */ - void addDataset(JobId jobId, Dataset dataset) throws MetadataException, RemoteException; + void addDataset(JobId jobId, Dataset dataset) throws AlgebricksException, RemoteException; /** - * Retrieves a dataset within a given dataverse, acquiring local locks on - * behalf of the given transaction id. + * Retrieves a dataset within a given dataverse, acquiring local locks on behalf + * of the given transaction id. * * @param jobId * A globally unique id for an active metadata transaction. @@ -190,15 +189,16 @@ public interface IMetadataNode extends Remote, Serializable { * @param datasetName * Name of dataset to be retrieved. * @return A dataset instance. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataset does not exist. * @throws RemoteException */ - Dataset getDataset(JobId jobId, String dataverseName, String datasetName) throws MetadataException, RemoteException; + Dataset getDataset(JobId jobId, String dataverseName, String datasetName) + throws AlgebricksException, RemoteException; /** - * Retrieves all indexes of a dataset, acquiring local locks on behalf of - * the given transaction id. + * Retrieves all indexes of a dataset, acquiring local locks on behalf of the + * given transaction id. * * @param jobId * A globally unique id for an active metadata transaction. @@ -207,12 +207,12 @@ public interface IMetadataNode extends Remote, Serializable { * @param datasetName * Name of dataset for which to retrieve all indexes. * @return A list of Index instances. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataset and/or dataverse does not exist. * @throws RemoteException */ List<Index> getDatasetIndexes(JobId jobId, String dataverseName, String datasetName) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** * Deletes the dataset with given name, and all it's associated indexes, @@ -224,26 +224,26 @@ public interface IMetadataNode extends Remote, Serializable { * Name of dataverse which holds the given dataset. * @param datasetName * Name of dataset to delete. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataset and/or dataverse does not exist. * @throws RemoteException */ - void dropDataset(JobId jobId, String dataverseName, String datasetName) throws MetadataException, RemoteException; + void dropDataset(JobId jobId, String dataverseName, String datasetName) throws AlgebricksException, RemoteException; /** - * Inserts an index into the metadata, acquiring local locks on behalf of - * the given transaction id. The index itself knows its name, and which - * dataset it belongs to. + * Inserts an index into the metadata, acquiring local locks on behalf of the + * given transaction id. The index itself knows its name, and which dataset it + * belongs to. * * @param jobId * A globally unique id for an active metadata transaction. * @param index * Index instance to be inserted. - * @throws MetadataException + * @throws AlgebricksException * For example, if the index already exists. * @throws RemoteException */ - void addIndex(JobId jobId, Index index) throws MetadataException, RemoteException; + void addIndex(JobId jobId, Index index) throws AlgebricksException, RemoteException; /** * Retrieves the index with given name, in given dataverse and dataset, @@ -257,16 +257,16 @@ public interface IMetadataNode extends Remote, Serializable { * Name of the dataset holding the index. * @indexName Name of the index to retrieve. * @return An Index instance. - * @throws MetadataException + * @throws AlgebricksException * For example, if the index does not exist. * @throws RemoteException */ Index getIndex(JobId jobId, String dataverseName, String datasetName, String indexName) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** - * Deletes the index with given name, in given dataverse and dataset, - * acquiring local locks on behalf of the given transaction id. + * Deletes the index with given name, in given dataverse and dataset, acquiring + * local locks on behalf of the given transaction id. * * @param jobId * A globally unique id for an active metadata transaction. @@ -275,30 +275,30 @@ public interface IMetadataNode extends Remote, Serializable { * @param datasetName * Name of the dataset holding the index. * @indexName Name of the index to retrieve. - * @throws MetadataException + * @throws AlgebricksException * For example, if the index does not exist. * @throws RemoteException */ void dropIndex(JobId jobId, String dataverseName, String datasetName, String indexName) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** - * Inserts a datatype, acquiring local locks on behalf of the given - * transaction id. + * Inserts a datatype, acquiring local locks on behalf of the given transaction + * id. * * @param jobId * A globally unique id for an active metadata transaction. * @param datatype * Datatype instance to be inserted. - * @throws MetadataException + * @throws AlgebricksException * For example, if the datatype already exists. * @throws RemoteException */ - void addDatatype(JobId jobId, Datatype datatype) throws MetadataException, RemoteException; + void addDatatype(JobId jobId, Datatype datatype) throws AlgebricksException, RemoteException; /** - * Retrieves the datatype with given name in given dataverse, acquiring - * local locks on behalf of the given transaction id. + * Retrieves the datatype with given name in given dataverse, acquiring local + * locks on behalf of the given transaction id. * * @param jobId * A globally unique id for an active metadata transaction. @@ -307,12 +307,12 @@ public interface IMetadataNode extends Remote, Serializable { * @param datatypeName * Name of datatype to be retrieved. * @return A datatype instance. - * @throws MetadataException + * @throws AlgebricksException * For example, if the datatype does not exist. * @throws RemoteException */ Datatype getDatatype(JobId jobId, String dataverseName, String datatypeName) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** * Deletes the given datatype in given dataverse, acquiring local locks on @@ -324,12 +324,13 @@ public interface IMetadataNode extends Remote, Serializable { * Name of dataverse holding the datatype. * @param datatypeName * Name of datatype to be deleted. - * @throws MetadataException + * @throws AlgebricksException * For example, if there are still datasets using the type to be * deleted. * @throws RemoteException */ - void dropDatatype(JobId jobId, String dataverseName, String datatypeName) throws MetadataException, RemoteException; + void dropDatatype(JobId jobId, String dataverseName, String datatypeName) + throws AlgebricksException, RemoteException; /** * Inserts a node group, acquiring local locks on behalf of the given @@ -339,11 +340,11 @@ public interface IMetadataNode extends Remote, Serializable { * A globally unique id for an active metadata transaction. * @param nodeGroup * Node group instance to insert. - * @throws MetadataException + * @throws AlgebricksException * For example, if the node group already exists. * @throws RemoteException */ - void addNodeGroup(JobId jobId, NodeGroup nodeGroup) throws MetadataException, RemoteException; + void addNodeGroup(JobId jobId, NodeGroup nodeGroup) throws AlgebricksException, RemoteException; /** * Retrieves a node group, acquiring local locks on behalf of the given @@ -353,11 +354,11 @@ public interface IMetadataNode extends Remote, Serializable { * A globally unique id for an active metadata transaction. * @param nodeGroupName * Name of node group to be retrieved. - * @throws MetadataException + * @throws AlgebricksException * For example, if the node group does not exist. * @throws RemoteException */ - NodeGroup getNodeGroup(JobId jobId, String nodeGroupName) throws MetadataException, RemoteException; + NodeGroup getNodeGroup(JobId jobId, String nodeGroupName) throws AlgebricksException, RemoteException; /** * Deletes a node group, acquiring local locks on behalf of the given @@ -368,29 +369,30 @@ public interface IMetadataNode extends Remote, Serializable { * @param nodeGroupName * Name of node group to be deleted. * @param failSilently - * true means it's a no-op if the node group cannot be dropped; false means it will throw an exception. + * true means it's a no-op if the node group cannot be dropped; false + * means it will throw an exception. * @return Whether the node group has been successfully dropped. - * @throws MetadataException + * @throws AlgebricksException * For example, there are still datasets partitioned on the node * group to be deleted. * @throws RemoteException */ boolean dropNodegroup(JobId jobId, String nodeGroupName, boolean failSilently) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** - * Inserts a node (compute node), acquiring local locks on behalf of the - * given transaction id. + * Inserts a node (compute node), acquiring local locks on behalf of the given + * transaction id. * * @param jobId * A globally unique id for an active metadata transaction. * @param node * Node instance to be inserted. - * @throws MetadataException + * @throws AlgebricksException * For example, if the node already exists. * @throws RemoteException */ - void addNode(JobId jobId, Node node) throws MetadataException, RemoteException; + void addNode(JobId jobId, Node node) throws AlgebricksException, RemoteException; /** * @param jobId @@ -398,218 +400,223 @@ public interface IMetadataNode extends Remote, Serializable { * @param functionSignature * An instance of functionSignature representing the function * @return - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - Function getFunction(JobId jobId, FunctionSignature functionSignature) throws MetadataException, RemoteException; + Function getFunction(JobId jobId, FunctionSignature functionSignature) throws AlgebricksException, RemoteException; - List<Function> getFunctions(JobId jobId, String dataverseName) throws MetadataException, RemoteException; + List<Function> getFunctions(JobId jobId, String dataverseName) throws AlgebricksException, RemoteException; /** - * Deletes a function, acquiring local locks on behalf of the given - * transaction id. + * Deletes a function, acquiring local locks on behalf of the given transaction + * id. * * @param jobId * A globally unique id for an active metadata transaction. * @param functionSignature * An instance of functionSignature representing the function - * @throws MetadataException + * @throws AlgebricksException * For example, there are still datasets partitioned on the node * group to be deleted. * @throws RemoteException */ - void dropFunction(JobId jobId, FunctionSignature functionSignature) throws MetadataException, RemoteException; + void dropFunction(JobId jobId, FunctionSignature functionSignature) throws AlgebricksException, RemoteException; /** * @param jobId * A globally unique id for an active metadata transaction. * @param function * Function to be inserted - * @throws MetadataException + * @throws AlgebricksException * for example, if the function already exists or refers to an * unknown function * @throws RemoteException */ - void addFunction(JobId jobId, Function function) throws MetadataException, RemoteException; + void addFunction(JobId jobId, Function function) throws AlgebricksException, RemoteException; /** - * @param ctx + * @param jobId * @param dataverseName - * @return List<Function> A list containing the functions in the specified dataverse - * @throws MetadataException + * @return List<Function> A list containing the functions in the specified + * dataverse + * @throws AlgebricksException * @throws RemoteException */ - List<Function> getDataverseFunctions(JobId jobId, String dataverseName) throws MetadataException, RemoteException; + List<Function> getDataverseFunctions(JobId jobId, String dataverseName) throws AlgebricksException, RemoteException; /** - * @param ctx + * @param jobId * @param dataverseName - * @return List<Adapter> A list containing the adapters in the specified dataverse - * @throws MetadataException + * @return List<Adapter> A list containing the adapters in the specified + * dataverse + * @throws AlgebricksException * @throws RemoteException */ List<DatasourceAdapter> getDataverseAdapters(JobId jobId, String dataverseName) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** * @param jobId * @param dataverseName * @param adapterName * @return - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ DatasourceAdapter getAdapter(JobId jobId, String dataverseName, String adapterName) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** - * Deletes a adapter , acquiring local locks on behalf of the given - * transaction id. + * Deletes a adapter , acquiring local locks on behalf of the given transaction + * id. * * @param jobId * A globally unique id for an active metadata transaction. * @param dataverseName * dataverse asociated with the adapter that is to be deleted. * @param adapterName - * Name of adapter to be deleted. MetadataException for example, - * if the adapter does not exists. + * Name of adapter to be deleted. AlgebricksException for example, if + * the adapter does not exists. + * @throws AlgebricksException * @throws RemoteException */ - void dropAdapter(JobId jobId, String dataverseName, String adapterName) throws MetadataException, RemoteException; + void dropAdapter(JobId jobId, String dataverseName, String adapterName) throws AlgebricksException, RemoteException; /** * @param jobId * A globally unique id for an active metadata transaction. * @param adapter * Adapter to be inserted - * @throws MetadataException + * @throws AlgebricksException * for example, if the adapter already exists. * @throws RemoteException */ - void addAdapter(JobId jobId, DatasourceAdapter adapter) throws MetadataException, RemoteException; + void addAdapter(JobId jobId, DatasourceAdapter adapter) throws AlgebricksException, RemoteException; /** * @param jobId * @param compactionPolicy - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - void addCompactionPolicy(JobId jobId, CompactionPolicy compactionPolicy) throws MetadataException, RemoteException; + void addCompactionPolicy(JobId jobId, CompactionPolicy compactionPolicy) + throws AlgebricksException, RemoteException; /** * @param jobId * @param dataverse * @param policy * @return - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ CompactionPolicy getCompactionPolicy(JobId jobId, String dataverse, String policy) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** * @param jobId - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - void initializeDatasetIdFactory(JobId jobId) throws MetadataException, RemoteException; + void initializeDatasetIdFactory(JobId jobId) throws AlgebricksException, RemoteException; /** * @return - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - int getMostRecentDatasetId() throws MetadataException, RemoteException; + int getMostRecentDatasetId() throws AlgebricksException, RemoteException; /** * @param jobId * @param feed - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - void addFeed(JobId jobId, Feed feed) throws MetadataException, RemoteException; + void addFeed(JobId jobId, Feed feed) throws AlgebricksException, RemoteException; /** * @param jobId * @param dataverse * @param feedName * @return - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - Feed getFeed(JobId jobId, String dataverse, String feedName) throws MetadataException, RemoteException; + Feed getFeed(JobId jobId, String dataverse, String feedName) throws AlgebricksException, RemoteException; - List<Feed> getFeeds(JobId jobId, String dataverse) throws MetadataException, RemoteException; + List<Feed> getFeeds(JobId jobId, String dataverse) throws AlgebricksException, RemoteException; /** * @param jobId * @param dataverse * @param feedName - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - void dropFeed(JobId jobId, String dataverse, String feedName) throws MetadataException, RemoteException; + void dropFeed(JobId jobId, String dataverse, String feedName) throws AlgebricksException, RemoteException; /** * @param jobId * @param feedPolicy - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - void addFeedPolicy(JobId jobId, FeedPolicyEntity feedPolicy) throws MetadataException, RemoteException; + void addFeedPolicy(JobId jobId, FeedPolicyEntity feedPolicy) throws AlgebricksException, RemoteException; /** * @param jobId * @param dataverse * @param policy * @return - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ FeedPolicyEntity getFeedPolicy(JobId jobId, String dataverse, String policy) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** - * Removes a library , acquiring local locks on behalf of the given - * transaction id. + * Removes a library , acquiring local locks on behalf of the given transaction + * id. * - * @param txnId + * @param jobId * A globally unique id for an active metadata transaction. * @param dataverseName * dataverse asociated with the adapter that is to be deleted. * @param libraryName - * Name of library to be deleted. MetadataException for example, - * if the library does not exists. + * Name of library to be deleted. AlgebricksException for example, if + * the library does not exists. + * @throws AlgebricksException * @throws RemoteException */ - void dropLibrary(JobId jobId, String dataverseName, String libraryName) throws MetadataException, RemoteException; + void dropLibrary(JobId jobId, String dataverseName, String libraryName) throws AlgebricksException, RemoteException; /** - * Adds a library, acquiring local locks on behalf of the given - * transaction id. + * Adds a library, acquiring local locks on behalf of the given transaction id. * - * @param txnId + * @param jobId * A globally unique id for an active metadata transaction. * @param library * Library to be added - * @throws MetadataException + * @throws AlgebricksException * for example, if the library is already added. * @throws RemoteException */ - void addLibrary(JobId jobId, Library library) throws MetadataException, RemoteException; + void addLibrary(JobId jobId, Library library) throws AlgebricksException, RemoteException; /** - * @param txnId + * @param jobId * A globally unique id for an active metadata transaction. * @param dataverseName * dataverse asociated with the library that is to be retrieved. * @param libraryName * name of the library that is to be retrieved * @return Library - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - Library getLibrary(JobId jobId, String dataverseName, String libraryName) throws MetadataException, RemoteException; + Library getLibrary(JobId jobId, String dataverseName, String libraryName) + throws AlgebricksException, RemoteException; /** * Retireve libraries installed in a given dataverse. @@ -619,19 +626,19 @@ public interface IMetadataNode extends Remote, Serializable { * @param dataverseName * dataverse asociated with the library that is to be retrieved. * @return Library - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - List<Library> getDataverseLibraries(JobId jobId, String dataverseName) throws MetadataException, RemoteException; + List<Library> getDataverseLibraries(JobId jobId, String dataverseName) throws AlgebricksException, RemoteException; /** * @param jobId * @param dataverseName * @return - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - List<Feed> getDataverseFeeds(JobId jobId, String dataverseName) throws MetadataException, RemoteException; + List<Feed> getDataverseFeeds(JobId jobId, String dataverseName) throws AlgebricksException, RemoteException; /** * delete a give feed (ingestion) policy @@ -641,40 +648,41 @@ public interface IMetadataNode extends Remote, Serializable { * @param policyName * @return * @throws RemoteException - * @throws MetadataException + * @throws AlgebricksException */ - void dropFeedPolicy(JobId jobId, String dataverseName, String policyName) throws MetadataException, RemoteException; + void dropFeedPolicy(JobId jobId, String dataverseName, String policyName) + throws AlgebricksException, RemoteException; /** * @param jobId * @param dataverse * @return - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ List<FeedPolicyEntity> getDataversePolicies(JobId jobId, String dataverse) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** * @param jobId * A globally unique id for an active metadata transaction. * @param externalFile * An object representing the external file entity - * @throws MetadataException + * @throws AlgebricksException * for example, if the file already exists. * @throws RemoteException */ - void addExternalFile(JobId jobId, ExternalFile externalFile) throws MetadataException, RemoteException; + void addExternalFile(JobId jobId, ExternalFile externalFile) throws AlgebricksException, RemoteException; /** * @param jobId * A globally unique id for an active metadata transaction. * @param dataset * A dataset the files belongs to. - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ - List<ExternalFile> getExternalFiles(JobId jobId, Dataset dataset) throws MetadataException, RemoteException; + List<ExternalFile> getExternalFiles(JobId jobId, Dataset dataset) throws AlgebricksException, RemoteException; /** * Deletes an externalFile , acquiring local locks on behalf of the given @@ -683,27 +691,30 @@ public interface IMetadataNode extends Remote, Serializable { * @param jobId * A globally unique id for an active metadata transaction. * @param dataverseName - * dataverse asociated with the external dataset that owns the file to be deleted. + * dataverse asociated with the external dataset that owns the file + * to be deleted. * @param datasetName * Name of dataset owning the file to be deleted. * @param fileNumber * the id number for the file to be deleted + * @throws AlgebricksException * @throws RemoteException */ void dropExternalFile(JobId jobId, String dataverseName, String datasetName, int fileNumber) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** - * Deletes all external files belonging to a dataset, acquiring local locks on behalf of the given - * transaction id. + * Deletes all external files belonging to a dataset, acquiring local locks on + * behalf of the given transaction id. * * @param jobId * A globally unique id for an active metadata transaction. * @param dataset * An external dataset the files belong to. + * @throws AlgebricksException * @throws RemoteException */ - void dropExternalFiles(JobId jobId, Dataset dataset) throws MetadataException, RemoteException; + void dropExternalFiles(JobId jobId, Dataset dataset) throws AlgebricksException, RemoteException; /** * Retrieves the file with given number, in given dataverse and dataset, @@ -718,12 +729,12 @@ public interface IMetadataNode extends Remote, Serializable { * @param fileNumber * Number of the file * @return An ExternalFile instance. - * @throws MetadataException + * @throws AlgebricksException * For example, if the index does not exist. * @throws RemoteException */ ExternalFile getExternalFile(JobId jobId, String dataverseName, String datasetName, Integer fileNumber) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** * update an existing dataset in the metadata, acquiring local locks on behalf @@ -733,66 +744,67 @@ public interface IMetadataNode extends Remote, Serializable { * A globally unique id for an active metadata transaction. * @param dataset * updated Dataset instance. - * @throws MetadataException + * @throws AlgebricksException * For example, if the dataset already exists. * @throws RemoteException */ - void updateDataset(JobId jobId, Dataset dataset) throws MetadataException, RemoteException; + void updateDataset(JobId jobId, Dataset dataset) throws AlgebricksException, RemoteException; /** * Adds an extension entity under the ongoing transaction job id * * @param jobId * @param entity - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ <T extends IExtensionMetadataEntity> void addEntity(JobId jobId, T entity) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** * Upserts an extension entity under the ongoing transaction job id * * @param jobId * @param entity - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ <T extends IExtensionMetadataEntity> void upsertEntity(JobId jobId, T entity) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** * Deletes an extension entity under the ongoing transaction job id * * @param jobId * @param entity - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ <T extends IExtensionMetadataEntity> void deleteEntity(JobId jobId, T entity) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; /** - * Gets a list of extension entities matching a search key under the ongoing transaction + * Gets a list of extension entities matching a search key under the ongoing + * transaction * * @param jobId * @param searchKey * @return - * @throws MetadataException + * @throws AlgebricksException * @throws RemoteException */ <T extends IExtensionMetadataEntity> List<T> getEntities(JobId jobId, IExtensionMetadataSearchKey searchKey) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; - void addFeedConnection(JobId jobId, FeedConnection feedConnection) throws MetadataException, RemoteException; + void addFeedConnection(JobId jobId, FeedConnection feedConnection) throws AlgebricksException, RemoteException; FeedConnection getFeedConnection(JobId jobId, String dataverseName, String feedName, String datasetName) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; void dropFeedConnection(JobId jobId, String dataverseName, String feedName, String datasetName) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; List<FeedConnection> getFeedConnections(JobId jobId, String dataverseName, String feedName) - throws MetadataException, RemoteException; + throws AlgebricksException, RemoteException; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d25513cc/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IValueExtractor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IValueExtractor.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IValueExtractor.java index c2b61ee..7d19b20 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IValueExtractor.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IValueExtractor.java @@ -22,8 +22,8 @@ package org.apache.asterix.metadata.api; import java.io.IOException; import java.rmi.RemoteException; -import org.apache.asterix.common.exceptions.MetadataException; import org.apache.asterix.common.transactions.JobId; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; @@ -43,10 +43,9 @@ public interface IValueExtractor<T> { * @param tuple * Tuple from which an object shall be extracted. * @return New object of type T. - * @throws MetadataException + * @throws AlgebricksException * @throws HyracksDataException * @throws IOException */ - public T getValue(JobId jobId, ITupleReference tuple) - throws MetadataException, HyracksDataException, RemoteException; + T getValue(JobId jobId, ITupleReference tuple) throws AlgebricksException, HyracksDataException, RemoteException; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d25513cc/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java index d2622c4..bff721e 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java @@ -70,6 +70,7 @@ import org.apache.asterix.transaction.management.opcallbacks.PrimaryIndexOperati import org.apache.asterix.transaction.management.opcallbacks.SecondaryIndexOperationTrackerFactory; import org.apache.asterix.transaction.management.resource.DatasetLocalResourceFactory; import org.apache.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants.LockMode; +import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.api.application.INCServiceContext; import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; import org.apache.hyracks.api.dataflow.value.ITypeTraits; @@ -127,11 +128,11 @@ public class MetadataBootstrap { * @param isNewUniverse * @throws ACIDException * @throws RemoteException - * @throws MetadataException + * @throws AlgebricksException * @throws Exception */ public static void startUniverse(INCServiceContext ncServiceContext, boolean isNewUniverse) - throws RemoteException, ACIDException, MetadataException { + throws RemoteException, ACIDException, AlgebricksException { MetadataBootstrap.setNewUniverse(isNewUniverse); appContext = (INcApplicationContext) ncServiceContext.getApplicationContext(); @@ -185,7 +186,7 @@ public class MetadataBootstrap { } } - private static void insertInitialDataverses(MetadataTransactionContext mdTxnCtx) throws MetadataException { + private static void insertInitialDataverses(MetadataTransactionContext mdTxnCtx) throws AlgebricksException { String dataFormat = NonTaggedDataFormat.NON_TAGGED_DATA_FORMAT; MetadataManager.INSTANCE.addDataverse(mdTxnCtx, new Dataverse(MetadataConstants.METADATA_DATAVERSE_NAME, dataFormat, MetadataUtil.PENDING_NO_OP)); @@ -193,15 +194,15 @@ public class MetadataBootstrap { } /** - * Inserts a metadata dataset to the physical dataset index - * Should be performed on a bootstrap of a new universe + * Inserts a metadata dataset to the physical dataset index Should be performed + * on a bootstrap of a new universe * * @param mdTxnCtx * @param indexes - * @throws MetadataException + * @throws AlgebricksException */ public static void insertMetadataDatasets(MetadataTransactionContext mdTxnCtx, IMetadataIndex[] indexes) - throws MetadataException { + throws AlgebricksException { for (int i = 0; i < indexes.length; i++) { IDatasetDetails id = new InternalDatasetDetails(FileStructure.BTREE, PartitioningStrategy.HASH, indexes[i].getPartitioningExpr(), indexes[i].getPartitioningExpr(), null, @@ -224,7 +225,7 @@ public class MetadataBootstrap { } } - private static void insertMetadataDatatypes(MetadataTransactionContext mdTxnCtx) throws MetadataException { + private static void insertMetadataDatatypes(MetadataTransactionContext mdTxnCtx) throws AlgebricksException { ArrayList<IAType> types = new ArrayList<>(); types.addAll(BuiltinTypeMap.getAllBuiltinTypes()); getMetadataTypes(types); @@ -238,20 +239,20 @@ public class MetadataBootstrap { } } - private static void insertNodes(MetadataTransactionContext mdTxnCtx) throws MetadataException { + private static void insertNodes(MetadataTransactionContext mdTxnCtx) throws AlgebricksException { for (String nodesName : nodeNames) { MetadataManager.INSTANCE.addNode(mdTxnCtx, new Node(nodesName, 0, 0)); } } - private static void insertInitialGroups(MetadataTransactionContext mdTxnCtx) throws MetadataException { + private static void insertInitialGroups(MetadataTransactionContext mdTxnCtx) throws AlgebricksException { List<String> metadataGroupNodeNames = new ArrayList<>(); metadataGroupNodeNames.add(metadataNodeName); NodeGroup groupRecord = new NodeGroup(MetadataConstants.METADATA_NODEGROUP_NAME, metadataGroupNodeNames); MetadataManager.INSTANCE.addNodegroup(mdTxnCtx, groupRecord); } - private static void insertInitialAdapters(MetadataTransactionContext mdTxnCtx) throws MetadataException { + private static void insertInitialAdapters(MetadataTransactionContext mdTxnCtx) throws AlgebricksException { String[] builtInAdapterClassNames = new String[] { GenericAdapterFactory.class.getName() }; DatasourceAdapter adapter; for (String adapterClassName : builtInAdapterClassNames) { @@ -263,7 +264,8 @@ public class MetadataBootstrap { } } - private static void insertInitialCompactionPolicies(MetadataTransactionContext mdTxnCtx) throws MetadataException { + private static void insertInitialCompactionPolicies(MetadataTransactionContext mdTxnCtx) + throws AlgebricksException { String[] builtInCompactionPolicyClassNames = new String[] { ConstantMergePolicyFactory.class.getName(), PrefixMergePolicyFactory.class.getName(), NoMergePolicyFactory.class.getName(), CorrelatedPrefixMergePolicyFactory.class.getName() }; @@ -273,7 +275,7 @@ public class MetadataBootstrap { } } - private static DatasourceAdapter getAdapter(String adapterFactoryClassName) throws MetadataException { + private static DatasourceAdapter getAdapter(String adapterFactoryClassName) throws AlgebricksException { try { String adapterName = ((IAdapterFactory) (Class.forName(adapterFactoryClassName).newInstance())).getAlias(); return new DatasourceAdapter(new AdapterIdentifier(MetadataConstants.METADATA_DATAVERSE_NAME, adapterName), @@ -284,7 +286,7 @@ public class MetadataBootstrap { } private static CompactionPolicy getCompactionPolicyEntity(String compactionPolicyClassName) - throws MetadataException { + throws AlgebricksException { try { String policyName = ((ILSMMergePolicyFactory) (Class.forName(compactionPolicyClassName).newInstance())).getName(); @@ -296,8 +298,8 @@ public class MetadataBootstrap { } /** - * Enlist a metadata index so it is available for metadata operations - * should be performed upon bootstrapping + * Enlist a metadata index so it is available for metadata operations should be + * performed upon bootstrapping * * @param index * @throws HyracksDataException @@ -320,8 +322,10 @@ public class MetadataBootstrap { IBinaryComparatorFactory[] cmpFactories = index.getKeyBinaryComparatorFactory(); int[] bloomFilterKeyFields = index.getBloomFilterKeyFields(); - // opTrackerProvider and ioOpCallbackFactory should both be acquired through IStorageManager - // We are unable to do this since IStorageManager needs a dataset to determine the appropriate + // opTrackerProvider and ioOpCallbackFactory should both be acquired through + // IStorageManager + // We are unable to do this since IStorageManager needs a dataset to determine + // the appropriate // objects ILSMOperationTrackerFactory opTrackerFactory = index.isPrimaryIndex() ? new PrimaryIndexOperationTrackerFactory(datasetId) @@ -341,7 +345,8 @@ public class MetadataBootstrap { bloomFilterKeyFields, appContext.getBloomFilterFalsePositiveRate(), true, null); DatasetLocalResourceFactory dsLocalResourceFactory = new DatasetLocalResourceFactory(datasetId, lsmBtreeFactory); - // TODO(amoudi) Creating the index should be done through the same code path as other indexes + // TODO(amoudi) Creating the index should be done through the same code path as + // other indexes // This is to be done by having a metadata dataset associated with each index IIndexBuilder indexBuilder = new IndexBuilder(ncServiceCtx, storageComponentProvider.getStorageManager(), index::getResourceId, file, dsLocalResourceFactory, true); @@ -354,7 +359,8 @@ public class MetadataBootstrap { .get(appContext.getTransactionSubsystem().getId()) + " to intialize as a new instance. (WARNING: all data will be lost.)"); } - // Why do we care about metadata dataset's resource ids? why not assign them ids similar to other resources? + // Why do we care about metadata dataset's resource ids? why not assign them ids + // similar to other resources? if (index.getResourceId() != resource.getId()) { throw new HyracksDataException("Resource Id doesn't match expected metadata index resource id"); } @@ -368,9 +374,10 @@ public class MetadataBootstrap { /** * Perform recovery of DDL operations metadata records */ - public static void startDDLRecovery() throws MetadataException { + public static void startDDLRecovery() throws AlgebricksException { // #. clean up any record which has pendingAdd/DelOp flag - // as traversing all records from DATAVERSE_DATASET to DATASET_DATASET, and then to INDEX_DATASET. + // as traversing all records from DATAVERSE_DATASET to DATASET_DATASET, and then + // to INDEX_DATASET. MetadataTransactionContext mdTxnCtx = null; MetadataManager.INSTANCE.acquireWriteLatch(); if (LOGGER.isLoggable(Level.INFO)) { @@ -383,7 +390,8 @@ public class MetadataBootstrap { for (Dataverse dataverse : dataverses) { recoverDataverse(mdTxnCtx, dataverse); } - // the commit wasn't there before. yet, everything was working correctly!!!!!!!!!!! + // the commit wasn't there before. yet, everything was working + // correctly!!!!!!!!!!! MetadataManager.INSTANCE.commitTransaction(mdTxnCtx); if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("Completed DDL recovery."); @@ -404,7 +412,7 @@ public class MetadataBootstrap { } private static void recoverDataverse(MetadataTransactionContext mdTxnCtx, Dataverse dataverse) - throws MetadataException { + throws AlgebricksException { if (dataverse.getPendingOp() != MetadataUtil.PENDING_NO_OP) { // drop pending dataverse MetadataManager.INSTANCE.dropDataverse(mdTxnCtx, dataverse.getDataverseName()); @@ -420,7 +428,8 @@ public class MetadataBootstrap { } } - private static void recoverDataset(MetadataTransactionContext mdTxnCtx, Dataset dataset) throws MetadataException { + private static void recoverDataset(MetadataTransactionContext mdTxnCtx, Dataset dataset) + throws AlgebricksException { if (dataset.getPendingOp() != MetadataUtil.PENDING_NO_OP) { // drop pending dataset MetadataManager.INSTANCE.dropDataset(mdTxnCtx, dataset.getDataverseName(), dataset.getDatasetName());
