asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ti...@apache.org
Subject [2/3] incubator-asterixdb git commit: Some exception cleanup
Date Tue, 02 Feb 2016 05:19:15 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
index ed586aa..4e6a3df 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataNode.java
@@ -19,6 +19,7 @@
 
 package org.apache.asterix.metadata;
 
+import java.io.IOException;
 import java.rmi.RemoteException;
 import java.util.ArrayList;
 import java.util.List;
@@ -29,7 +30,6 @@ import org.apache.asterix.common.config.DatasetConfig.DatasetType;
 import org.apache.asterix.common.config.DatasetConfig.IndexType;
 import org.apache.asterix.common.dataflow.AsterixLSMIndexUtil;
 import org.apache.asterix.common.exceptions.ACIDException;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.functions.FunctionSignature;
 import org.apache.asterix.common.transactions.AbstractOperationCallback;
 import org.apache.asterix.common.transactions.DatasetId;
@@ -95,6 +95,7 @@ import org.apache.hyracks.storage.am.common.api.IIndexAccessor;
 import org.apache.hyracks.storage.am.common.api.IIndexCursor;
 import org.apache.hyracks.storage.am.common.api.IModificationOperationCallback;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor;
+import org.apache.hyracks.storage.am.common.api.IndexException;
 import org.apache.hyracks.storage.am.common.api.TreeIndexException;
 import org.apache.hyracks.storage.am.common.exceptions.TreeIndexDuplicateKeyException;
 import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback;
@@ -169,7 +170,7 @@ public class MetadataNode implements IMetadataNode {
         } catch (TreeIndexDuplicateKeyException e) {
             throw new MetadataException(
                     "A dataverse with this name " + dataverse.getDataverseName() + " already exists.", e);
-        } catch (Exception e) {
+        } catch (ACIDException|IndexException|IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -194,7 +195,7 @@ public class MetadataNode implements IMetadataNode {
         } catch (TreeIndexDuplicateKeyException e) {
             throw new MetadataException("A dataset with this name " + dataset.getDatasetName()
                     + " already exists in dataverse '" + dataset.getDataverseName() + "'.", e);
-        } catch (Exception e) {
+        } catch (ACIDException|IndexException|IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -207,7 +208,7 @@ public class MetadataNode implements IMetadataNode {
             insertTupleIntoIndex(jobId, MetadataPrimaryIndexes.INDEX_DATASET, tuple);
         } catch (TreeIndexDuplicateKeyException e) {
             throw new MetadataException("An index with name '" + index.getIndexName() + "' already exists.", e);
-        } catch (Exception e) {
+        } catch (ACIDException|IndexException|IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -220,7 +221,7 @@ public class MetadataNode implements IMetadataNode {
             insertTupleIntoIndex(jobId, MetadataPrimaryIndexes.NODE_DATASET, tuple);
         } catch (TreeIndexDuplicateKeyException e) {
             throw new MetadataException("A node with name '" + node.getNodeName() + "' already exists.", e);
-        } catch (Exception e) {
+        } catch (ACIDException|IndexException|IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -234,7 +235,7 @@ public class MetadataNode implements IMetadataNode {
         } catch (TreeIndexDuplicateKeyException e) {
             throw new MetadataException("A nodegroup with name '" + nodeGroup.getNodeGroupName() + "' already exists.",
                     e);
-        } catch (Exception e) {
+        } catch (ACIDException|IndexException|IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -247,7 +248,7 @@ public class MetadataNode implements IMetadataNode {
             insertTupleIntoIndex(jobId, MetadataPrimaryIndexes.DATATYPE_DATASET, tuple);
         } catch (TreeIndexDuplicateKeyException e) {
             throw new MetadataException("A datatype with name '" + datatype.getDatatypeName() + "' already exists.", e);
-        } catch (Exception e) {
+        } catch (ACIDException|IndexException|IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -263,13 +264,13 @@ public class MetadataNode implements IMetadataNode {
         } catch (TreeIndexDuplicateKeyException e) {
             throw new MetadataException("A function with this name " + function.getName() + " and arity "
                     + function.getArity() + " already exists in dataverse '" + function.getDataverseName() + "'.", e);
-        } catch (Exception e) {
+        } catch (ACIDException|IndexException|IOException e) {
             throw new MetadataException(e);
         }
     }
 
     private void insertTupleIntoIndex(JobId jobId, IMetadataIndex metadataIndex, ITupleReference tuple)
-            throws Exception {
+            throws ACIDException, HyracksDataException, IndexException {
         long resourceID = metadataIndex.getResourceID();
         String resourceName = metadataIndex.getFile().toString();
         ILSMIndex lsmIndex = (ILSMIndex) datasetLifecycleManager.getIndex(resourceName);
@@ -292,15 +293,13 @@ public class MetadataNode implements IMetadataNode {
 
             // TODO: fix exceptions once new BTree exception model is in hyracks.
             indexAccessor.forceInsert(tuple);
-        } catch (Exception e) {
-            throw e;
         } finally {
             datasetLifecycleManager.close(resourceName);
         }
     }
 
     private IModificationOperationCallback createIndexModificationCallback(JobId jobId, long resourceId,
-            IMetadataIndex metadataIndex, ILSMIndex lsmIndex, IndexOperation indexOp) throws Exception {
+            IMetadataIndex metadataIndex, ILSMIndex lsmIndex, IndexOperation indexOp) throws ACIDException {
         ITransactionContext txnCtx = transactionSubsystem.getTransactionManager().getTransactionContext(jobId, false);
 
         if (metadataIndex.isPrimaryIndex()) {
@@ -383,7 +382,7 @@ public class MetadataNode implements IMetadataNode {
             // BTreeKeyDoesNotExistException.
         } catch (TreeIndexException e) {
             throw new MetadataException("Cannot drop dataverse '" + dataverseName + "' because it doesn't exist.", e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -523,7 +522,7 @@ public class MetadataNode implements IMetadataNode {
         }
     }
 
-    private void forceDropDatatype(JobId jobId, String dataverseName, String datatypeName) throws AsterixException {
+    private void forceDropDatatype(JobId jobId, String dataverseName, String datatypeName) throws MetadataException {
         try {
             ITupleReference searchKey = createTuple(dataverseName, datatypeName);
             // Searches the index for the tuple to be deleted. Acquires an S
@@ -533,16 +532,14 @@ public class MetadataNode implements IMetadataNode {
             // TODO: Change this to be a BTree specific exception, e.g.,
             // BTreeKeyDoesNotExistException.
         } catch (TreeIndexException e) {
-            throw new AsterixException("Cannot drop type '" + datatypeName + "' because it doesn't exist", e);
-        } catch (AsterixException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new AsterixException(e);
+            throw new MetadataException("Cannot drop type '" + datatypeName + "' because it doesn't exist", e);
+        } catch (ACIDException | IndexException | IOException e) {
+            throw new MetadataException(e);
         }
     }
 
     private void deleteTupleFromIndex(JobId jobId, IMetadataIndex metadataIndex, ITupleReference tuple)
-            throws Exception {
+            throws ACIDException, HyracksDataException, IndexException {
         long resourceID = metadataIndex.getResourceID();
         String resourceName = metadataIndex.getFile().toString();
         ILSMIndex lsmIndex = (ILSMIndex) datasetLifecycleManager.getIndex(resourceName);
@@ -562,8 +559,6 @@ public class MetadataNode implements IMetadataNode {
             AsterixLSMIndexUtil.checkAndSetFirstLSN((AbstractLSMIndex) lsmIndex, transactionSubsystem.getLogManager());
 
             indexAccessor.forceDelete(tuple);
-        } catch (Exception e) {
-            throw e;
         } finally {
             datasetLifecycleManager.close(resourceName);
         }
@@ -580,15 +575,13 @@ public class MetadataNode implements IMetadataNode {
                 return null;
             }
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
-
     }
 
     @Override
     public Dataverse getDataverse(JobId jobId, String dataverseName) throws MetadataException, RemoteException {
-
         try {
             ITupleReference searchKey = createTuple(dataverseName);
             DataverseTupleTranslator tupleReaderWriter = new DataverseTupleTranslator(false);
@@ -599,10 +592,9 @@ public class MetadataNode implements IMetadataNode {
                 return null;
             }
             return results.get(0);
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
-
     }
 
     @Override
@@ -615,7 +607,7 @@ public class MetadataNode implements IMetadataNode {
             List<Dataset> results = new ArrayList<Dataset>();
             searchIndex(jobId, MetadataPrimaryIndexes.DATASET_DATASET, searchKey, valueExtractor, results);
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -629,7 +621,7 @@ public class MetadataNode implements IMetadataNode {
             List<Feed> results = new ArrayList<Feed>();
             searchIndex(jobId, MetadataPrimaryIndexes.FEED_DATASET, searchKey, valueExtractor, results);
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -644,7 +636,7 @@ public class MetadataNode implements IMetadataNode {
             List<Library> results = new ArrayList<Library>();
             searchIndex(jobId, MetadataPrimaryIndexes.LIBRARY_DATASET, searchKey, valueExtractor, results);
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -658,7 +650,7 @@ public class MetadataNode implements IMetadataNode {
             List<Datatype> results = new ArrayList<Datatype>();
             searchIndex(jobId, MetadataPrimaryIndexes.DATATYPE_DATASET, searchKey, valueExtractor, results);
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -676,7 +668,7 @@ public class MetadataNode implements IMetadataNode {
                 return null;
             }
             return results.get(0);
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -689,7 +681,7 @@ public class MetadataNode implements IMetadataNode {
             List<Dataset> results = new ArrayList<Dataset>();
             searchIndex(jobId, MetadataPrimaryIndexes.DATASET_DATASET, searchKey, valueExtractor, results);
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -702,7 +694,7 @@ public class MetadataNode implements IMetadataNode {
             List<Datatype> results = new ArrayList<Datatype>();
             searchIndex(jobId, MetadataPrimaryIndexes.DATATYPE_DATASET, searchKey, valueExtractor, results);
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -802,7 +794,7 @@ public class MetadataNode implements IMetadataNode {
                 return null;
             }
             return results.get(0);
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -817,7 +809,7 @@ public class MetadataNode implements IMetadataNode {
             List<Index> results = new ArrayList<Index>();
             searchIndex(jobId, MetadataPrimaryIndexes.INDEX_DATASET, searchKey, valueExtractor, results);
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -835,8 +827,7 @@ public class MetadataNode implements IMetadataNode {
                 return null;
             }
             return results.get(0);
-        } catch (Exception e) {
-            e.printStackTrace();
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -853,7 +844,7 @@ public class MetadataNode implements IMetadataNode {
                 return null;
             }
             return results.get(0);
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -872,8 +863,7 @@ public class MetadataNode implements IMetadataNode {
                 return null;
             }
             return results.get(0);
-        } catch (Exception e) {
-            e.printStackTrace();
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -882,12 +872,8 @@ public class MetadataNode implements IMetadataNode {
     public void dropFunction(JobId jobId, FunctionSignature functionSignature)
             throws MetadataException, RemoteException {
 
-        Function function;
-        try {
-            function = getFunction(jobId, functionSignature);
-        } catch (Exception e) {
-            throw new MetadataException(e);
-        }
+        Function function = getFunction(jobId, functionSignature);
+
         if (function == null) {
             throw new MetadataException(
                     "Cannot drop function '" + functionSignature.toString() + "' because it doesn't exist.");
@@ -907,13 +893,13 @@ public class MetadataNode implements IMetadataNode {
         } catch (TreeIndexException e) {
             throw new MetadataException("There is no function with the name " + functionSignature.getName()
                     + " and arity " + functionSignature.getArity(), e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
 
     private ITupleReference getTupleToBeDeleted(JobId jobId, IMetadataIndex metadataIndex, ITupleReference searchKey)
-            throws Exception {
+            throws MetadataException, IndexException, IOException {
         IValueExtractor<ITupleReference> valueExtractor = new TupleCopyValueExtractor(metadataIndex.getTypeTraits());
         List<ITupleReference> results = new ArrayList<ITupleReference>();
         searchIndex(jobId, metadataIndex, searchKey, valueExtractor, results);
@@ -1011,7 +997,8 @@ public class MetadataNode implements IMetadataNode {
     }
 
     private <ResultType> void searchIndex(JobId jobId, IMetadataIndex index, ITupleReference searchKey,
-            IValueExtractor<ResultType> valueExtractor, List<ResultType> results) throws Exception {
+            IValueExtractor<ResultType> valueExtractor, List<ResultType> results)
+                    throws MetadataException, IndexException, IOException {
         IBinaryComparatorFactory[] comparatorFactories = index.getKeyBinaryComparatorFactory();
         String resourceName = index.getFile().toString();
         IIndex indexInstance = datasetLifecycleManager.getIndex(resourceName);
@@ -1083,7 +1070,7 @@ public class MetadataNode implements IMetadataNode {
                 datasetLifecycleManager.close(resourceName);
             }
 
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
 
@@ -1117,7 +1104,7 @@ public class MetadataNode implements IMetadataNode {
             List<Function> results = new ArrayList<Function>();
             searchIndex(jobId, MetadataPrimaryIndexes.FUNCTION_DATASET, searchKey, valueExtractor, results);
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1135,21 +1122,15 @@ public class MetadataNode implements IMetadataNode {
                     "A adapter with this name " + adapter.getAdapterIdentifier().getName()
                             + " already exists in dataverse '" + adapter.getAdapterIdentifier().getNamespace() + "'.",
                     e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
-
     }
 
     @Override
     public void dropAdapter(JobId jobId, String dataverseName, String adapterName)
             throws MetadataException, RemoteException {
-        DatasourceAdapter adapter;
-        try {
-            adapter = getAdapter(jobId, dataverseName, adapterName);
-        } catch (Exception e) {
-            throw new MetadataException(e);
-        }
+        DatasourceAdapter adapter = getAdapter(jobId, dataverseName, adapterName);
         if (adapter == null) {
             throw new MetadataException("Cannot drop adapter '" + adapter + "' because it doesn't exist.");
         }
@@ -1166,7 +1147,7 @@ public class MetadataNode implements IMetadataNode {
             // BTreeKeyDoesNotExistException.
         } catch (TreeIndexException e) {
             throw new MetadataException("Cannot drop adapter '" + adapterName, e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
 
@@ -1186,7 +1167,7 @@ public class MetadataNode implements IMetadataNode {
                 return null;
             }
             return results.get(0);
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1203,16 +1184,14 @@ public class MetadataNode implements IMetadataNode {
         } catch (TreeIndexDuplicateKeyException e) {
             throw new MetadataException("A compcation policy with this name " + compactionPolicy.getPolicyName()
                     + " already exists in dataverse '" + compactionPolicy.getPolicyName() + "'.", e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
-
     }
 
     @Override
     public CompactionPolicy getCompactionPolicy(JobId jobId, String dataverse, String policyName)
             throws MetadataException, RemoteException {
-
         try {
             ITupleReference searchKey = createTuple(dataverse, policyName);
             CompactionPolicyTupleTranslator tupleReaderWriter = new CompactionPolicyTupleTranslator(false);
@@ -1224,7 +1203,7 @@ public class MetadataNode implements IMetadataNode {
                 return results.get(0);
             }
             return null;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1240,7 +1219,7 @@ public class MetadataNode implements IMetadataNode {
             List<DatasourceAdapter> results = new ArrayList<DatasourceAdapter>();
             searchIndex(jobId, MetadataPrimaryIndexes.DATASOURCE_ADAPTER_DATASET, searchKey, valueExtractor, results);
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1256,21 +1235,15 @@ public class MetadataNode implements IMetadataNode {
         } catch (TreeIndexException e) {
             throw new MetadataException("A library with this name " + library.getDataverseName()
                     + " already exists in dataverse '" + library.getDataverseName() + "'.", e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
-
     }
 
     @Override
     public void dropLibrary(JobId jobId, String dataverseName, String libraryName)
             throws MetadataException, RemoteException {
-        Library library;
-        try {
-            library = getLibrary(jobId, dataverseName, libraryName);
-        } catch (Exception e) {
-            throw new MetadataException(e);
-        }
+        Library library = getLibrary(jobId, dataverseName, libraryName);
         if (library == null) {
             throw new MetadataException("Cannot drop library '" + library + "' because it doesn't exist.");
         }
@@ -1287,7 +1260,7 @@ public class MetadataNode implements IMetadataNode {
             // BTreeKeyDoesNotExistException.
         } catch (TreeIndexException e) {
             throw new MetadataException("Cannot drop library '" + libraryName, e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
 
@@ -1306,7 +1279,7 @@ public class MetadataNode implements IMetadataNode {
                 return null;
             }
             return results.get(0);
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1327,16 +1300,14 @@ public class MetadataNode implements IMetadataNode {
         } catch (TreeIndexException e) {
             throw new MetadataException("A feed policy with this name " + feedPolicy.getPolicyName()
                     + " already exists in dataverse '" + feedPolicy.getPolicyName() + "'.", e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
-
     }
 
     @Override
     public FeedPolicyEntity getFeedPolicy(JobId jobId, String dataverse, String policyName)
             throws MetadataException, RemoteException {
-
         try {
             ITupleReference searchKey = createTuple(dataverse, policyName);
             FeedPolicyTupleTranslator tupleReaderWriter = new FeedPolicyTupleTranslator(false);
@@ -1348,7 +1319,7 @@ public class MetadataNode implements IMetadataNode {
                 return results.get(0);
             }
             return null;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1364,7 +1335,7 @@ public class MetadataNode implements IMetadataNode {
         } catch (TreeIndexException e) {
             throw new MetadataException("A feed with this name " + feed.getFeedName() + " already exists in dataverse '"
                     + feed.getDataverseName() + "'.", e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1381,14 +1352,13 @@ public class MetadataNode implements IMetadataNode {
                 return results.get(0);
             }
             return null;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
 
     @Override
     public void dropFeed(JobId jobId, String dataverse, String feedName) throws MetadataException, RemoteException {
-
         try {
             ITupleReference searchKey = createTuple(dataverse, feedName);
             // Searches the index for the tuple to be deleted. Acquires an S
@@ -1399,10 +1369,9 @@ public class MetadataNode implements IMetadataNode {
             // BTreeKeyDoesNotExistException.
         } catch (TreeIndexException e) {
             throw new MetadataException("Cannot drop feed '" + feedName + "' because it doesn't exist", e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
-
     }
 
     @Override
@@ -1414,7 +1383,7 @@ public class MetadataNode implements IMetadataNode {
             deleteTupleFromIndex(jobId, MetadataPrimaryIndexes.FEED_POLICY_DATASET, tuple);
         } catch (TreeIndexException e) {
             throw new MetadataException("Unknown feed policy " + policyName, e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1430,7 +1399,7 @@ public class MetadataNode implements IMetadataNode {
             List<FeedPolicyEntity> results = new ArrayList<FeedPolicyEntity>();
             searchIndex(jobId, MetadataPrimaryIndexes.FEED_POLICY_DATASET, searchKey, valueExtractor, results);
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1446,7 +1415,7 @@ public class MetadataNode implements IMetadataNode {
             throw new MetadataException("An externalFile with this number " + externalFile.getFileNumber()
                     + " already exists in dataset '" + externalFile.getDatasetName() + "' in dataverse '"
                     + externalFile.getDataverseName() + "'.", e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1461,7 +1430,7 @@ public class MetadataNode implements IMetadataNode {
             List<ExternalFile> results = new ArrayList<ExternalFile>();
             searchIndex(jobId, MetadataPrimaryIndexes.EXTERNAL_FILE_DATASET, searchKey, valueExtractor, results);
             return results;
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1479,27 +1448,18 @@ public class MetadataNode implements IMetadataNode {
             deleteTupleFromIndex(jobId, MetadataPrimaryIndexes.EXTERNAL_FILE_DATASET, datasetTuple);
         } catch (TreeIndexException e) {
             throw new MetadataException("Couldn't drop externalFile.", e);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
 
     @Override
     public void dropExternalFiles(JobId jobId, Dataset dataset) throws MetadataException, RemoteException {
-        List<ExternalFile> files;
-        try {
-            files = getExternalFiles(jobId, dataset);
-        } catch (Exception e) {
-            throw new MetadataException(e);
-        }
-        try {
-            //loop through files and delete them
-            for (int i = 0; i < files.size(); i++) {
-                dropExternalFile(jobId, files.get(i).getDataverseName(), files.get(i).getDatasetName(),
-                        files.get(i).getFileNumber());
-            }
-        } catch (Exception e) {
-            throw new MetadataException(e);
+        List<ExternalFile> files = getExternalFiles(jobId, dataset);
+        //loop through files and delete them
+        for (int i = 0; i < files.size(); i++) {
+            dropExternalFile(jobId, files.get(i).getDataverseName(), files.get(i).getDatasetName(),
+                    files.get(i).getFileNumber());
         }
     }
 
@@ -1548,7 +1508,7 @@ public class MetadataNode implements IMetadataNode {
                 return null;
             }
             return results.get(0);
-        } catch (Exception e) {
+        } catch (IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }
@@ -1570,7 +1530,7 @@ public class MetadataNode implements IMetadataNode {
             DatasetTupleTranslator tupleReaderWriter = new DatasetTupleTranslator(true);
             datasetTuple = tupleReaderWriter.getTupleFromMetadataEntity(dataset);
             insertTupleIntoIndex(jobId, MetadataPrimaryIndexes.DATASET_DATASET, datasetTuple);
-        } catch (Exception e) {
+        } catch (ACIDException | IndexException | IOException e) {
             throw new MetadataException(e);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataTransactionContext.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataTransactionContext.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataTransactionContext.java
index 3d07a00..84a75ef 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataTransactionContext.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/MetadataTransactionContext.java
@@ -99,7 +99,7 @@ public class MetadataTransactionContext extends MetadataCache {
         logAndApply(new MetadataLogicalOperation(datatype, true));
     }
 
-    public void addNogeGroup(NodeGroup nodeGroup) {
+    public void addNodeGroup(NodeGroup nodeGroup) {
         droppedCache.dropNodeGroup(nodeGroup);
         logAndApply(new MetadataLogicalOperation(nodeGroup, true));
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IValueExtractor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IValueExtractor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IValueExtractor.java
index 5effd7d..e90e29b 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IValueExtractor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/api/IValueExtractor.java
@@ -46,5 +46,5 @@ public interface IValueExtractor<T> {
      * @throws HyracksDataException
      * @throws IOException
      */
-    public T getValue(JobId jobId, ITupleReference tuple) throws MetadataException, HyracksDataException, IOException;
+    public T getValue(JobId jobId, ITupleReference tuple) throws MetadataException, IOException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/ExternalDatasetDetails.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/ExternalDatasetDetails.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/ExternalDatasetDetails.java
index b16344d..ab1d2a5 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/ExternalDatasetDetails.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/ExternalDatasetDetails.java
@@ -20,7 +20,6 @@
 package org.apache.asterix.metadata.entities;
 
 import java.io.DataOutput;
-import java.io.IOException;
 import java.util.Date;
 import java.util.Map;
 
@@ -29,7 +28,6 @@ import org.apache.asterix.builders.OrderedListBuilder;
 import org.apache.asterix.builders.RecordBuilder;
 import org.apache.asterix.common.config.DatasetConfig.DatasetType;
 import org.apache.asterix.common.config.DatasetConfig.ExternalDatasetTransactionState;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.IDatasetDetails;
 import org.apache.asterix.metadata.bootstrap.MetadataRecordTypes;
@@ -124,12 +122,7 @@ public class ExternalDatasetDetails implements IDatasetDetails {
         intSerde.serialize(new AInt32(state.ordinal()), fieldValue.getDataOutput());
         externalRecordBuilder.addField(MetadataRecordTypes.EXTERNAL_DETAILS_ARECORD_TRANSACTION_STATE_FIELD_INDEX,
                 fieldValue);
-        try {
-            externalRecordBuilder.write(out, true);
-        } catch (IOException | AsterixException e) {
-            throw new HyracksDataException(e);
-        }
-
+        externalRecordBuilder.write(out, true);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
index 6d047a2..d401864 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
@@ -144,20 +144,16 @@ public class Index implements IMetadataEntity<Index>, Comparable<Index> {
     public static Pair<IAType, Boolean> getNonNullableOpenFieldType(IAType fieldType, List<String> fieldName,
             ARecordType recType) throws AlgebricksException {
         Pair<IAType, Boolean> keyPairType = null;
-
-        try {
-            IAType subType = recType;
-            for (int i = 0; i < fieldName.size(); i++) {
-                subType = ((ARecordType) subType).getFieldType(fieldName.get(i));
-                if (subType == null) {
-                    keyPairType = Index.getNonNullableType(fieldType);
-                    break;
-                }
+        IAType subType = recType;
+        for (int i = 0; i < fieldName.size(); i++) {
+            subType = ((ARecordType) subType).getFieldType(fieldName.get(i));
+            if (subType == null) {
+                keyPairType = Index.getNonNullableType(fieldType);
+                break;
             }
-            if (subType != null)
-                keyPairType = Index.getNonNullableKeyFieldType(fieldName, recType);
-        } catch (IOException e) {
-            throw new AlgebricksException(e);
+        }
+        if (subType != null) {
+            keyPairType = Index.getNonNullableKeyFieldType(fieldName, recType);
         }
         return keyPairType;
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/InternalDatasetDetails.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/InternalDatasetDetails.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/InternalDatasetDetails.java
index 73c263f..a772c39 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/InternalDatasetDetails.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/InternalDatasetDetails.java
@@ -20,14 +20,12 @@
 package org.apache.asterix.metadata.entities;
 
 import java.io.DataOutput;
-import java.io.IOException;
 import java.util.List;
 
 import org.apache.asterix.builders.IARecordBuilder;
 import org.apache.asterix.builders.OrderedListBuilder;
 import org.apache.asterix.builders.RecordBuilder;
 import org.apache.asterix.common.config.DatasetConfig.DatasetType;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.IDatasetDetails;
 import org.apache.asterix.metadata.bootstrap.MetadataRecordTypes;
@@ -156,8 +154,8 @@ public class InternalDatasetDetails implements IDatasetDetails {
                 fieldValue);
 
         // write field 2
-        primaryKeyListBuilder
-                .reset((AOrderedListType) MetadataRecordTypes.INTERNAL_DETAILS_RECORDTYPE.getFieldTypes()[MetadataRecordTypes.INTERNAL_DETAILS_ARECORD_PARTITIONKEY_FIELD_INDEX]);
+        primaryKeyListBuilder.reset((AOrderedListType) MetadataRecordTypes.INTERNAL_DETAILS_RECORDTYPE
+                .getFieldTypes()[MetadataRecordTypes.INTERNAL_DETAILS_ARECORD_PARTITIONKEY_FIELD_INDEX]);
         for (List<String> field : partitioningKeys) {
             listBuilder.reset(stringList);
             for (String subField : field) {
@@ -176,8 +174,8 @@ public class InternalDatasetDetails implements IDatasetDetails {
                 fieldValue);
 
         // write field 3
-        primaryKeyListBuilder
-                .reset((AOrderedListType) MetadataRecordTypes.INTERNAL_DETAILS_RECORDTYPE.getFieldTypes()[MetadataRecordTypes.INTERNAL_DETAILS_ARECORD_PRIMARYKEY_FIELD_INDEX]);
+        primaryKeyListBuilder.reset((AOrderedListType) MetadataRecordTypes.INTERNAL_DETAILS_RECORDTYPE
+                .getFieldTypes()[MetadataRecordTypes.INTERNAL_DETAILS_ARECORD_PRIMARYKEY_FIELD_INDEX]);
         for (List<String> field : primaryKeys) {
             listBuilder.reset(stringList);
             for (String subField : field) {
@@ -216,18 +214,10 @@ public class InternalDatasetDetails implements IDatasetDetails {
             }
             fieldValue.reset();
             listBuilder.write(fieldValue.getDataOutput(), true);
-            try {
-                internalRecordBuilder.addField(nameValue, fieldValue);
-            } catch (AsterixException e) {
-                throw new HyracksDataException(e);
-            }
+            internalRecordBuilder.addField(nameValue, fieldValue);
         }
 
-        try {
-            internalRecordBuilder.write(out, true);
-        } catch (IOException | AsterixException e) {
-            throw new HyracksDataException(e);
-        }
+        internalRecordBuilder.write(out, true);
     }
 
     protected void writePropertyTypeRecord(String name, String value, DataOutput out, ARecordType recordType)
@@ -252,11 +242,7 @@ public class InternalDatasetDetails implements IDatasetDetails {
         stringSerde.serialize(aString, fieldValue.getDataOutput());
         propertyRecordBuilder.addField(1, fieldValue);
 
-        try {
-            propertyRecordBuilder.write(out, true);
-        } catch (IOException | AsterixException e) {
-            throw new HyracksDataException(e);
-        }
+        propertyRecordBuilder.write(out, true);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/CompactionPolicyTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/CompactionPolicyTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/CompactionPolicyTupleTranslator.java
index 9ff90ca..e29b9dd 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/CompactionPolicyTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/CompactionPolicyTupleTranslator.java
@@ -24,7 +24,6 @@ import java.io.DataInput;
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.bootstrap.MetadataPrimaryIndexes;
@@ -71,7 +70,7 @@ public class CompactionPolicyTupleTranslator extends AbstractTupleTranslator<Com
         CompactionPolicy compactionPolicy = null;
         String dataverseName = ((AString) compactionPolicyRecord
                 .getValueByPos(MetadataRecordTypes.COMPACTION_POLICY_ARECORD_DATAVERSE_NAME_FIELD_INDEX))
-                .getStringValue();
+                        .getStringValue();
         String policyName = ((AString) compactionPolicyRecord
                 .getValueByPos(MetadataRecordTypes.COMPACTION_POLICY_ARECORD_POLICY_NAME_FIELD_INDEX)).getStringValue();
         String className = ((AString) compactionPolicyRecord
@@ -82,8 +81,8 @@ public class CompactionPolicyTupleTranslator extends AbstractTupleTranslator<Com
     }
 
     @Override
-    public ITupleReference getTupleFromMetadataEntity(CompactionPolicy compactionPolicy) throws IOException,
-            MetadataException {
+    public ITupleReference getTupleFromMetadataEntity(CompactionPolicy compactionPolicy)
+            throws IOException, MetadataException {
 
         tupleBuilder.reset();
         aString.setValue(compactionPolicy.getDataverseName());
@@ -115,11 +114,7 @@ public class CompactionPolicyTupleTranslator extends AbstractTupleTranslator<Com
         recordBuilder.addField(MetadataRecordTypes.COMPACTION_POLICY_ARECORD_CLASSNAME_FIELD_INDEX, fieldValue);
 
         // write record
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
 
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasetTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasetTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasetTupleTranslator.java
index 00f46d4..f283a83 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasetTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasetTupleTranslator.java
@@ -38,7 +38,6 @@ import org.apache.asterix.builders.RecordBuilder;
 import org.apache.asterix.builders.UnorderedListBuilder;
 import org.apache.asterix.common.config.DatasetConfig.DatasetType;
 import org.apache.asterix.common.config.DatasetConfig.ExternalDatasetTransactionState;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.IDatasetDetails;
 import org.apache.asterix.metadata.MetadataException;
@@ -343,11 +342,7 @@ public class DatasetTupleTranslator extends AbstractTupleTranslator<Dataset> {
         recordBuilder.addField(MetadataRecordTypes.DATASET_ARECORD_PENDINGOP_FIELD_INDEX, fieldValue);
 
         // write record
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
 
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());
@@ -406,11 +401,7 @@ public class DatasetTupleTranslator extends AbstractTupleTranslator<Dataset> {
         stringSerde.serialize(aString, fieldValue.getDataOutput());
         propertyRecordBuilder.addField(1, fieldValue);
 
-        try {
-            propertyRecordBuilder.write(out, true);
-        } catch (IOException | AsterixException ioe) {
-            throw new HyracksDataException(ioe);
-        }
+        propertyRecordBuilder.write(out, true);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasourceAdapterTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasourceAdapterTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasourceAdapterTupleTranslator.java
index b0d5f76..a824551 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasourceAdapterTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatasourceAdapterTupleTranslator.java
@@ -25,9 +25,7 @@ import java.io.DataInputStream;
 import java.io.IOException;
 import java.util.Calendar;
 
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.external.api.IDataSourceAdapter;
-import org.apache.asterix.external.api.IDataSourceAdapter.AdapterType;
 import org.apache.asterix.external.dataset.adapter.AdapterIdentifier;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
@@ -72,13 +70,14 @@ public class DatasourceAdapterTupleTranslator extends AbstractTupleTranslator<Da
     private DatasourceAdapter createAdapterFromARecord(ARecord adapterRecord) {
         String dataverseName = ((AString) adapterRecord
                 .getValueByPos(MetadataRecordTypes.DATASOURCE_ADAPTER_ARECORD_DATAVERSENAME_FIELD_INDEX))
-                .getStringValue();
+                        .getStringValue();
         String adapterName = ((AString) adapterRecord
                 .getValueByPos(MetadataRecordTypes.DATASOURCE_ADAPTER_ARECORD_NAME_FIELD_INDEX)).getStringValue();
         String classname = ((AString) adapterRecord
                 .getValueByPos(MetadataRecordTypes.DATASOURCE_ADAPTER_ARECORD_CLASSNAME_FIELD_INDEX)).getStringValue();
-        IDataSourceAdapter.AdapterType adapterType = IDataSourceAdapter.AdapterType.valueOf(((AString) adapterRecord
-                .getValueByPos(MetadataRecordTypes.DATASOURCE_ADAPTER_ARECORD_TYPE_FIELD_INDEX)).getStringValue());
+        IDataSourceAdapter.AdapterType adapterType = IDataSourceAdapter.AdapterType.valueOf(
+                ((AString) adapterRecord.getValueByPos(MetadataRecordTypes.DATASOURCE_ADAPTER_ARECORD_TYPE_FIELD_INDEX))
+                        .getStringValue());
 
         return new DatasourceAdapter(new AdapterIdentifier(dataverseName, adapterName), classname, adapterType);
     }
@@ -129,11 +128,7 @@ public class DatasourceAdapterTupleTranslator extends AbstractTupleTranslator<Da
         recordBuilder.addField(MetadataRecordTypes.DATASOURCE_ADAPTER_ARECORD_TIMESTAMP_FIELD_INDEX, fieldValue);
 
         // write record
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
 
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
index 8948f43..a1b23d6 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
@@ -24,12 +24,12 @@ import java.io.DataInput;
 import java.io.DataInputStream;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.rmi.RemoteException;
 import java.util.Calendar;
 
 import org.apache.asterix.builders.IARecordBuilder;
 import org.apache.asterix.builders.OrderedListBuilder;
 import org.apache.asterix.builders.RecordBuilder;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.transactions.JobId;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
@@ -207,11 +207,7 @@ public class DatatypeTupleTranslator extends AbstractTupleTranslator<Datatype> {
         // write field 3
         if (fieldType.getTypeTag().isDerivedType()) {
             fieldValue.reset();
-            try {
-                writeDerivedTypeRecord(dataType, (AbstractComplexType) fieldType, fieldValue.getDataOutput());
-            } catch (AsterixException e) {
-                throw new MetadataException(e);
-            }
+            writeDerivedTypeRecord(dataType, (AbstractComplexType) fieldType, fieldValue.getDataOutput());
             recordBuilder.addField(MetadataRecordTypes.DATATYPE_ARECORD_DERIVED_FIELD_INDEX, fieldValue);
         }
 
@@ -222,11 +218,7 @@ public class DatatypeTupleTranslator extends AbstractTupleTranslator<Datatype> {
         recordBuilder.addField(MetadataRecordTypes.DATATYPE_ARECORD_TIMESTAMP_FIELD_INDEX, fieldValue);
 
         // write record
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
 
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());
@@ -234,7 +226,7 @@ public class DatatypeTupleTranslator extends AbstractTupleTranslator<Datatype> {
     }
 
     private void writeDerivedTypeRecord(Datatype type, AbstractComplexType derivedDatatype, DataOutput out)
-            throws IOException, AsterixException {
+            throws HyracksDataException {
         DerivedTypeTag tag = null;
         IARecordBuilder derivedRecordBuilder = new RecordBuilder();
         ArrayBackedValueStorage fieldValue = new ArrayBackedValueStorage();
@@ -292,15 +284,16 @@ public class DatatypeTupleTranslator extends AbstractTupleTranslator<Datatype> {
             throws HyracksDataException {
         AbstractCollectionType listType = (AbstractCollectionType) type;
         IAType itemType = listType.getItemType();
-        if (itemType.getTypeTag().isDerivedType())
+        if (itemType.getTypeTag().isDerivedType()) {
             handleNestedDerivedType(itemType.getTypeName(), (AbstractComplexType) itemType, instance,
                     instance.getDataverseName(), instance.getDatatypeName());
+        }
         aString.setValue(listType.getItemType().getTypeName());
         stringSerde.serialize(aString, out);
     }
 
     private void writeRecordType(Datatype instance, AbstractComplexType type, DataOutput out)
-            throws IOException, AsterixException {
+            throws HyracksDataException {
 
         ArrayBackedValueStorage fieldValue = new ArrayBackedValueStorage();
         ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
@@ -369,13 +362,13 @@ public class DatatypeTupleTranslator extends AbstractTupleTranslator<Datatype> {
             String dataverseName, String datatypeName) throws HyracksDataException {
         try {
             metadataNode.addDatatype(jobId, new Datatype(dataverseName, typeName, nestedType, true));
-
         } catch (MetadataException e) {
             // The nested record type may have been inserted by a previous DDL statement or by
             // a previous nested type.
-            if (!e.getCause().getClass().equals(TreeIndexDuplicateKeyException.class))
+            if (!(e.getCause() instanceof TreeIndexDuplicateKeyException)) {
                 throw new HyracksDataException(e);
-        } catch (Exception e) {
+            }
+        } catch (RemoteException e) {
             // TODO: This should not be a HyracksDataException. Can't
             // fix this currently because of BTree exception model whose
             // fixes must get in.

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DataverseTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DataverseTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DataverseTupleTranslator.java
index ecc53da..74f85ab 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DataverseTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/DataverseTupleTranslator.java
@@ -25,7 +25,6 @@ import java.io.DataInputStream;
 import java.io.IOException;
 import java.util.Calendar;
 
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.bootstrap.MetadataPrimaryIndexes;
@@ -110,11 +109,7 @@ public class DataverseTupleTranslator extends AbstractTupleTranslator<Dataverse>
         aInt32Serde.serialize(aInt32, fieldValue.getDataOutput());
         recordBuilder.addField(MetadataRecordTypes.DATAVERSE_ARECORD_PENDINGOP_FIELD_INDEX, fieldValue);
 
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
 
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/ExternalFileTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/ExternalFileTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/ExternalFileTupleTranslator.java
index efb9318..1c3c7c9 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/ExternalFileTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/ExternalFileTupleTranslator.java
@@ -25,7 +25,6 @@ import java.io.IOException;
 import java.util.Date;
 
 import org.apache.asterix.common.config.DatasetConfig.ExternalFilePendingOp;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.external.indexing.ExternalFile;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
@@ -97,14 +96,13 @@ public class ExternalFileTupleTranslator extends AbstractTupleTranslator<Externa
                 .getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_FILE_NAME_FIELD_INDEX)).getStringValue();
         long fileSize = ((AInt64) externalFileRecord
                 .getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_FILE_SIZE_FIELD_INDEX)).getLongValue();
-        Date lastMoDifiedDate = new Date(
-                ((ADateTime) externalFileRecord
-                        .getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_FILE_MOD_DATE_FIELD_INDEX))
-                        .getChrononTime());
+        Date lastMoDifiedDate = new Date(((ADateTime) externalFileRecord
+                .getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_FILE_MOD_DATE_FIELD_INDEX)).getChrononTime());
         ExternalFilePendingOp pendingOp = ExternalFilePendingOp.values()[((AInt32) externalFileRecord
                 .getValueByPos(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_FILE_PENDING_OP_FIELD_INDEX))
-                .getIntegerValue()];
-        return new ExternalFile(dataverseName, datasetName, fileNumber, fileName, lastMoDifiedDate, fileSize, pendingOp);
+                        .getIntegerValue()];
+        return new ExternalFile(dataverseName, datasetName, fileNumber, fileName, lastMoDifiedDate, fileSize,
+                pendingOp);
     }
 
     @Override
@@ -170,11 +168,7 @@ public class ExternalFileTupleTranslator extends AbstractTupleTranslator<Externa
         recordBuilder.addField(MetadataRecordTypes.EXTERNAL_FILE_ARECORD_FILE_PENDING_OP_FIELD_INDEX, fieldValue);
 
         // write record
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
 
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedPolicyTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedPolicyTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedPolicyTupleTranslator.java
index 00e3e63..4839065 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedPolicyTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedPolicyTupleTranslator.java
@@ -30,7 +30,6 @@ import java.util.Map;
 import org.apache.asterix.builders.IARecordBuilder;
 import org.apache.asterix.builders.RecordBuilder;
 import org.apache.asterix.builders.UnorderedListBuilder;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.bootstrap.MetadataPrimaryIndexes;
@@ -111,7 +110,8 @@ public class FeedPolicyTupleTranslator extends AbstractTupleTranslator<FeedPolic
     }
 
     @Override
-    public ITupleReference getTupleFromMetadataEntity(FeedPolicyEntity feedPolicy) throws IOException, MetadataException {
+    public ITupleReference getTupleFromMetadataEntity(FeedPolicyEntity feedPolicy)
+            throws IOException, MetadataException {
         // write the key in the first three fields of the tuple
         ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
 
@@ -161,11 +161,7 @@ public class FeedPolicyTupleTranslator extends AbstractTupleTranslator<FeedPolic
         recordBuilder.addField(MetadataRecordTypes.FEED_POLICY_ARECORD_PROPERTIES_FIELD_INDEX, fieldValue);
 
         // write record
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
 
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());
@@ -192,10 +188,6 @@ public class FeedPolicyTupleTranslator extends AbstractTupleTranslator<FeedPolic
         stringSerde.serialize(aString, fieldValue.getDataOutput());
         propertyRecordBuilder.addField(1, fieldValue);
 
-        try {
-            propertyRecordBuilder.write(out, true);
-        } catch (IOException | AsterixException e) {
-            throw new HyracksDataException(e);
-        }
+        propertyRecordBuilder.write(out, true);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedTupleTranslator.java
index dc9fb50..955249c 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FeedTupleTranslator.java
@@ -31,7 +31,6 @@ import java.util.Map;
 import org.apache.asterix.builders.IARecordBuilder;
 import org.apache.asterix.builders.OrderedListBuilder;
 import org.apache.asterix.builders.RecordBuilder;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.functions.FunctionSignature;
 import org.apache.asterix.external.feed.api.IFeed;
 import org.apache.asterix.external.feed.api.IFeed.FeedType;
@@ -198,11 +197,7 @@ public class FeedTupleTranslator extends AbstractTupleTranslator<Feed> {
         recordBuilder.addField(MetadataRecordTypes.FEED_ARECORD_TIMESTAMP_FIELD_INDEX, fieldValue);
 
         // write record
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
 
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());
@@ -250,11 +245,7 @@ public class FeedTupleTranslator extends AbstractTupleTranslator<Feed> {
                         MetadataRecordTypes.FEED_ARECORD_PRIMARY_FIELD_DETAILS_ADAPTOR_CONFIGURATION_FIELD_INDEX,
                         primaryRecordfieldValue);
 
-                try {
-                    primaryDetailsRecordBuilder.write(fieldValue.getDataOutput(), true);
-                } catch (IOException | AsterixException e) {
-                    throw new HyracksDataException(e);
-                }
+                primaryDetailsRecordBuilder.write(fieldValue.getDataOutput(), true);
 
                 recordBuilder.addField(MetadataRecordTypes.FEED_ARECORD_PRIMARY_TYPE_DETAILS_FIELD_INDEX, fieldValue);
             }
@@ -273,11 +264,7 @@ public class FeedTupleTranslator extends AbstractTupleTranslator<Feed> {
                         MetadataRecordTypes.FEED_ARECORD_SECONDARY_FIELD_DETAILS_SOURCE_FEED_NAME_FIELD_INDEX,
                         secondaryFieldValue);
 
-                try {
-                    secondaryDetailsRecordBuilder.write(fieldValue.getDataOutput(), true);
-                } catch (IOException | AsterixException e) {
-                    throw new HyracksDataException(e);
-                }
+                secondaryDetailsRecordBuilder.write(fieldValue.getDataOutput(), true);
                 recordBuilder.addField(MetadataRecordTypes.FEED_ARECORD_SECONDARY_TYPE_DETAILS_FIELD_INDEX, fieldValue);
                 break;
         }
@@ -305,10 +292,6 @@ public class FeedTupleTranslator extends AbstractTupleTranslator<Feed> {
         stringSerde.serialize(aString, fieldValue.getDataOutput());
         propertyRecordBuilder.addField(1, fieldValue);
 
-        try {
-            propertyRecordBuilder.write(out, true);
-        } catch (IOException | AsterixException e) {
-            throw new HyracksDataException(e);
-        }
+        propertyRecordBuilder.write(out, true);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FunctionTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FunctionTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FunctionTupleTranslator.java
index 7850c3d..afa2f6e 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FunctionTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/FunctionTupleTranslator.java
@@ -27,7 +27,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.asterix.builders.OrderedListBuilder;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.bootstrap.MetadataPrimaryIndexes;
@@ -146,8 +145,8 @@ public class FunctionTupleTranslator extends AbstractTupleTranslator<Function> {
         // write field 3
         OrderedListBuilder listBuilder = new OrderedListBuilder();
         ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
-        listBuilder
-                .reset((AOrderedListType) MetadataRecordTypes.FUNCTION_RECORDTYPE.getFieldTypes()[MetadataRecordTypes.FUNCTION_ARECORD_FUNCTION_PARAM_LIST_FIELD_INDEX]);
+        listBuilder.reset((AOrderedListType) MetadataRecordTypes.FUNCTION_RECORDTYPE
+                .getFieldTypes()[MetadataRecordTypes.FUNCTION_ARECORD_FUNCTION_PARAM_LIST_FIELD_INDEX]);
         for (String param : function.getParams()) {
             itemValue.reset();
             aString.setValue(param);
@@ -183,11 +182,7 @@ public class FunctionTupleTranslator extends AbstractTupleTranslator<Function> {
         recordBuilder.addField(MetadataRecordTypes.FUNCTION_ARECORD_FUNCTION_KIND_FIELD_INDEX, fieldValue);
 
         // write record
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
 
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/IndexTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/IndexTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/IndexTupleTranslator.java
index 611c703..37f0e48 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/IndexTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/IndexTupleTranslator.java
@@ -29,7 +29,6 @@ import java.util.List;
 
 import org.apache.asterix.builders.OrderedListBuilder;
 import org.apache.asterix.common.config.DatasetConfig.IndexType;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.transactions.JobId;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
@@ -95,7 +94,7 @@ public class IndexTupleTranslator extends AbstractTupleTranslator<Index> {
     }
 
     @Override
-    public Index getMetadataEntityFromTuple(ITupleReference frameTuple) throws IOException, MetadataException {
+    public Index getMetadataEntityFromTuple(ITupleReference frameTuple) throws MetadataException, IOException {
         byte[] serRecord = frameTuple.getFieldData(INDEX_PAYLOAD_TUPLE_FIELD_INDEX);
         int recordStartOffset = frameTuple.getFieldStart(INDEX_PAYLOAD_TUPLE_FIELD_INDEX);
         int recordLength = frameTuple.getFieldLength(INDEX_PAYLOAD_TUPLE_FIELD_INDEX);
@@ -167,7 +166,7 @@ public class IndexTupleTranslator extends AbstractTupleTranslator<Index> {
     }
 
     @Override
-    public ITupleReference getTupleFromMetadataEntity(Index instance) throws IOException, MetadataException {
+    public ITupleReference getTupleFromMetadataEntity(Index instance) throws IOException {
         // write the key in the first 3 fields of the tuple
         tupleBuilder.reset();
         aString.setValue(instance.getDataverseName());
@@ -253,11 +252,7 @@ public class IndexTupleTranslator extends AbstractTupleTranslator<Index> {
             aString.setValue(GRAM_LENGTH_FIELD_NAME);
             stringSerde.serialize(aString, nameValue.getDataOutput());
             intSerde.serialize(new AInt32(instance.getGramLength()), fieldValue.getDataOutput());
-            try {
-                recordBuilder.addField(nameValue, fieldValue);
-            } catch (AsterixException e) {
-                throw new MetadataException(e);
-            }
+            recordBuilder.addField(nameValue, fieldValue);
         }
 
         if (instance.isEnforcingKeyFileds()) {
@@ -279,11 +274,7 @@ public class IndexTupleTranslator extends AbstractTupleTranslator<Index> {
             }
             fieldValue.reset();
             typeListBuilder.write(fieldValue.getDataOutput(), true);
-            try {
-                recordBuilder.addField(nameValue, fieldValue);
-            } catch (AsterixException e) {
-                throw new MetadataException(e);
-            }
+            recordBuilder.addField(nameValue, fieldValue);
 
             // write optional field 10
             fieldValue.reset();
@@ -294,19 +285,11 @@ public class IndexTupleTranslator extends AbstractTupleTranslator<Index> {
 
             booleanSerde.serialize(ABoolean.TRUE, fieldValue.getDataOutput());
 
-            try {
-                recordBuilder.addField(nameValue, fieldValue);
-            } catch (AsterixException e) {
-                throw new MetadataException(e);
-            }
+            recordBuilder.addField(nameValue, fieldValue);
         }
 
         // write record
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
 
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/LibraryTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/LibraryTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/LibraryTupleTranslator.java
index 77c81a1..e500575 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/LibraryTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/LibraryTupleTranslator.java
@@ -25,7 +25,6 @@ import java.io.DataInputStream;
 import java.io.IOException;
 import java.util.Calendar;
 
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.bootstrap.MetadataPrimaryIndexes;
@@ -111,11 +110,7 @@ public class LibraryTupleTranslator extends AbstractTupleTranslator<Library> {
         recordBuilder.addField(MetadataRecordTypes.LIBRARY_ARECORD_TIMESTAMP_FIELD_INDEX, fieldValue);
 
         // write record
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());
         return tuple;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/NodeGroupTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/NodeGroupTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/NodeGroupTupleTranslator.java
index 4cb0cf8..af83ee9 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/NodeGroupTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/NodeGroupTupleTranslator.java
@@ -28,7 +28,6 @@ import java.util.Calendar;
 import java.util.List;
 
 import org.apache.asterix.builders.UnorderedListBuilder;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.bootstrap.MetadataPrimaryIndexes;
@@ -101,8 +100,8 @@ public class NodeGroupTupleTranslator extends AbstractTupleTranslator<NodeGroup>
         recordBuilder.addField(MetadataRecordTypes.NODEGROUP_ARECORD_GROUPNAME_FIELD_INDEX, fieldValue);
 
         // write field 1
-        listBuilder
-                .reset((AUnorderedListType) MetadataRecordTypes.NODEGROUP_RECORDTYPE.getFieldTypes()[MetadataRecordTypes.NODEGROUP_ARECORD_NODENAMES_FIELD_INDEX]);
+        listBuilder.reset((AUnorderedListType) MetadataRecordTypes.NODEGROUP_RECORDTYPE
+                .getFieldTypes()[MetadataRecordTypes.NODEGROUP_ARECORD_NODENAMES_FIELD_INDEX]);
         this.nodeNames = instance.getNodeNames();
         for (String nodeName : this.nodeNames) {
             itemValue.reset();
@@ -120,11 +119,7 @@ public class NodeGroupTupleTranslator extends AbstractTupleTranslator<NodeGroup>
         stringSerde.serialize(aString, fieldValue.getDataOutput());
         recordBuilder.addField(MetadataRecordTypes.NODEGROUP_ARECORD_TIMESTAMP_FIELD_INDEX, fieldValue);
 
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
 
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/NodeTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/NodeTupleTranslator.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/NodeTupleTranslator.java
index a592460..55b61db 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/NodeTupleTranslator.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/entitytupletranslators/NodeTupleTranslator.java
@@ -21,7 +21,6 @@ package org.apache.asterix.metadata.entitytupletranslators;
 
 import java.io.IOException;
 
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.bootstrap.MetadataPrimaryIndexes;
@@ -127,11 +126,7 @@ public class NodeTupleTranslator extends AbstractTupleTranslator<Node> {
         // listBuilder.write(fieldValue.getDataOutput());
         // recordBuilder.addField(3, fieldValue);
 
-        try {
-            recordBuilder.write(tupleBuilder.getDataOutput(), true);
-        } catch (AsterixException e) {
-            throw new MetadataException(e);
-        }
+        recordBuilder.write(tupleBuilder.getDataOutput(), true);
         tupleBuilder.addFieldEndOffset();
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());
         return tuple;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtils.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtils.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtils.java
index f011f04..9919962 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtils.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtils.java
@@ -26,8 +26,8 @@ import java.util.Map;
 
 import org.apache.asterix.builders.IARecordBuilder;
 import org.apache.asterix.builders.RecordBuilder;
-import org.apache.asterix.common.config.MetadataConstants;
 import org.apache.asterix.common.config.DatasetConfig.DatasetType;
+import org.apache.asterix.common.config.MetadataConstants;
 import org.apache.asterix.common.context.CorrelatedPrefixMergePolicyFactory;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.external.indexing.IndexingConstants;
@@ -276,10 +276,6 @@ public class DatasetUtils {
         stringSerde.serialize(aString, fieldValue.getDataOutput());
         propertyRecordBuilder.addField(1, fieldValue);
 
-        try {
-            propertyRecordBuilder.write(out, true);
-        } catch (IOException | AsterixException e) {
-            throw new HyracksDataException(e);
-        }
+        propertyRecordBuilder.write(out, true);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/MetadataEntityValueExtractor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/MetadataEntityValueExtractor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/MetadataEntityValueExtractor.java
index 969feea..1841e5d 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/MetadataEntityValueExtractor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/MetadataEntityValueExtractor.java
@@ -25,7 +25,6 @@ import org.apache.asterix.common.transactions.JobId;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.api.IMetadataEntityTupleTranslator;
 import org.apache.asterix.metadata.api.IValueExtractor;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 
 /**
@@ -39,7 +38,7 @@ public class MetadataEntityValueExtractor<T> implements IValueExtractor<T> {
     }
 
     @Override
-    public T getValue(JobId jobId, ITupleReference tuple) throws MetadataException, HyracksDataException, IOException {
+    public T getValue(JobId jobId, ITupleReference tuple) throws MetadataException, IOException {
         return tupleReaderWriter.getMetadataEntityFromTuple(tuple);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
index bdc36e8..9f63ebf 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
@@ -27,7 +27,6 @@ import java.io.IOException;
 import org.apache.asterix.common.transactions.JobId;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.api.IValueExtractor;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 import org.apache.hyracks.util.string.UTF8StringReader;
 
@@ -35,6 +34,8 @@ import org.apache.hyracks.util.string.UTF8StringReader;
  * Extracts the value of field 'DataypeName' of the first nested type from an
  * ITupleReference that contains a serialized representation of a Datatype
  * metadata entity.
+ *
+ * TODO Is this class used?
  */
 public class NestedDatatypeNameValueExtractor implements IValueExtractor<String> {
 
@@ -47,24 +48,20 @@ public class NestedDatatypeNameValueExtractor implements IValueExtractor<String>
     private final UTF8StringReader reader = new UTF8StringReader();
 
     @Override
-    public String getValue(JobId jobId, ITupleReference tuple) throws MetadataException, HyracksDataException {
+    public String getValue(JobId jobId, ITupleReference tuple) throws MetadataException, IOException {
         byte[] serRecord = tuple.getFieldData(2);
         int recordStartOffset = tuple.getFieldStart(2);
         int recordLength = tuple.getFieldLength(2);
         ByteArrayInputStream stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
         DataInput in = new DataInputStream(stream);
-        try {
-            String nestedType = reader.readUTF(in);
-            if (nestedType.equals(datatypeName)) {
-                recordStartOffset = tuple.getFieldStart(1);
-                recordLength = tuple.getFieldLength(1);
-                stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
-                in = new DataInputStream(stream);
-                return reader.readUTF(in);
-            }
-            return null;
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
+        String nestedType = reader.readUTF(in);
+        if (nestedType.equals(datatypeName)) {
+            recordStartOffset = tuple.getFieldStart(1);
+            recordLength = tuple.getFieldLength(1);
+            stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
+            in = new DataInputStream(stream);
+            return reader.readUTF(in);
         }
+        return null;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/TupleCopyValueExtractor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/TupleCopyValueExtractor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/TupleCopyValueExtractor.java
index b9ca7bd..33f8969 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/TupleCopyValueExtractor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/TupleCopyValueExtractor.java
@@ -26,7 +26,6 @@ import org.apache.asterix.common.transactions.JobId;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.api.IValueExtractor;
 import org.apache.hyracks.api.dataflow.value.ITypeTraits;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 import org.apache.hyracks.storage.am.common.tuples.TypeAwareTupleReference;
 import org.apache.hyracks.storage.am.common.tuples.TypeAwareTupleWriter;
@@ -49,8 +48,7 @@ public class TupleCopyValueExtractor implements IValueExtractor<ITupleReference>
     }
 
     @Override
-    public ITupleReference getValue(JobId jobId, ITupleReference tuple) throws MetadataException, HyracksDataException,
-            IOException {
+    public ITupleReference getValue(JobId jobId, ITupleReference tuple) throws MetadataException, IOException {
         int numBytes = tupleWriter.bytesRequired(tuple);
         tupleBytes = new byte[numBytes];
         tupleWriter.writeTuple(tuple, tupleBytes, 0);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/9dcba3c9/asterix-om/src/main/java/org/apache/asterix/builders/IARecordBuilder.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/builders/IARecordBuilder.java b/asterix-om/src/main/java/org/apache/asterix/builders/IARecordBuilder.java
index ee15d5d..ea3bd51 100644
--- a/asterix-om/src/main/java/org/apache/asterix/builders/IARecordBuilder.java
+++ b/asterix-om/src/main/java/org/apache/asterix/builders/IARecordBuilder.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.ARecordType;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IValueReference;
 
 /**
@@ -57,7 +58,7 @@ public interface IARecordBuilder {
      * @throws AsterixException
      *             if the field name conflicts with a closed field name
      */
-    public void addField(IValueReference name, IValueReference value) throws AsterixException;
+    public void addField(IValueReference name, IValueReference value) throws HyracksDataException;
 
     /**
      * @param out
@@ -69,7 +70,7 @@ public interface IARecordBuilder {
      * @throws AsterixException
      *             if any open field names conflict with each other
      */
-    public void write(DataOutput out, boolean writeTypeTag) throws IOException, AsterixException;
+    public void write(DataOutput out, boolean writeTypeTag) throws HyracksDataException;
 
     public int getFieldId(String fieldName);
 


Mime
View raw message