Merged asterix_stabilization r235:r248.
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix-fix-issue-9@249 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
index 554ce3c..fcc0158 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
@@ -23,8 +23,8 @@
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.config.GlobalConfig;
import edu.uci.ics.asterix.common.config.OptimizationConfUtil;
+import edu.uci.ics.asterix.common.context.AsterixIndexRegistryProvider;
import edu.uci.ics.asterix.common.context.AsterixStorageManagerInterface;
-import edu.uci.ics.asterix.common.context.AsterixTreeRegistryProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.formats.base.IDataFormat;
import edu.uci.ics.asterix.metadata.declared.AqlCompiledDatasetDecl;
@@ -89,7 +89,7 @@
LOGGER.info("DROP DATASETPATH: " + datasetPath);
- IIndexRegistryProvider<IIndex> btreeRegistryProvider = AsterixTreeRegistryProvider.INSTANCE;
+ IIndexRegistryProvider<IIndex> indexRegistryProvider = AsterixIndexRegistryProvider.INSTANCE;
IStorageManagerInterface storageManager = AsterixStorageManagerInterface.INSTANCE;
AqlCompiledDatasetDecl adecl = metadata.findDataset(datasetName);
@@ -114,7 +114,7 @@
Pair<IFileSplitProvider, AlgebricksPartitionConstraint> idxSplitsAndConstraint = metadata
.splitProviderAndPartitionConstraintsForInternalOrFeedDataset(datasetName, acid.getIndexName());
TreeIndexDropOperatorDescriptor secondaryBtreeDrop = new TreeIndexDropOperatorDescriptor(specs[i],
- storageManager, btreeRegistryProvider, idxSplitsAndConstraint.first);
+ storageManager, indexRegistryProvider, idxSplitsAndConstraint.first);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(specs[i], secondaryBtreeDrop,
idxSplitsAndConstraint.second);
i++;
@@ -128,7 +128,7 @@
Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitsAndConstraint = metadata
.splitProviderAndPartitionConstraintsForInternalOrFeedDataset(datasetName, datasetName);
TreeIndexDropOperatorDescriptor primaryBtreeDrop = new TreeIndexDropOperatorDescriptor(specPrimary,
- storageManager, btreeRegistryProvider, splitsAndConstraint.first);
+ storageManager, indexRegistryProvider, splitsAndConstraint.first);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(specPrimary, primaryBtreeDrop,
splitsAndConstraint.second);
@@ -161,8 +161,8 @@
compiledDatasetDecl, metadata.getFormat().getBinaryComparatorFactoryProvider());
ITypeTraits[] typeTraits = DatasetUtils.computeTupleTypeTraits(compiledDatasetDecl, metadata);
- AqlCompiledExternalDatasetDetails externalDatasetDetails = new AqlCompiledExternalDatasetDetails(loadStmt.getAdapter(),
- loadStmt.getProperties());
+ AqlCompiledExternalDatasetDetails externalDatasetDetails = new AqlCompiledExternalDatasetDetails(
+ loadStmt.getAdapter(), loadStmt.getProperties());
Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> p = AqlMetadataProvider
.buildExternalDataScannerRuntime(spec, itemType, externalDatasetDetails, format);
IOperatorDescriptor scanner = p.first;
@@ -201,10 +201,10 @@
}
LOGGER.info("LOAD into File Splits: " + sb.toString());
- IIndexRegistryProvider<IIndex> btreeRegistryProvider = AsterixTreeRegistryProvider.INSTANCE;
+ IIndexRegistryProvider<IIndex> indexRegistryProvider = AsterixIndexRegistryProvider.INSTANCE;
IStorageManagerInterface storageManager = AsterixStorageManagerInterface.INSTANCE;
TreeIndexBulkLoadOperatorDescriptor btreeBulkLoad = new TreeIndexBulkLoadOperatorDescriptor(spec,
- storageManager, btreeRegistryProvider, splitsAndConstraint.first, typeTraits, comparatorFactories,
+ storageManager, indexRegistryProvider, splitsAndConstraint.first, typeTraits, comparatorFactories,
fieldPermutation, GlobalConfig.DEFAULT_BTREE_FILL_FACTOR, new BTreeDataflowHelperFactory(),
NoOpOperationCallbackProvider.INSTANCE);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, btreeBulkLoad,
@@ -232,7 +232,7 @@
return new Job(spec);
}
-
+
private static String stringOf(FileSplit fs) {
return fs.getNodeName() + ":" + fs.getLocalFile().toString();
}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java
index 0ce064b..e788e0f 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java
@@ -1,11 +1,10 @@
package edu.uci.ics.asterix.file;
-import java.util.logging.Logger;
import edu.uci.ics.asterix.aql.translator.DdlTranslator.CompiledIndexDropStatement;
import edu.uci.ics.asterix.common.config.OptimizationConfUtil;
+import edu.uci.ics.asterix.common.context.AsterixIndexRegistryProvider;
import edu.uci.ics.asterix.common.context.AsterixStorageManagerInterface;
-import edu.uci.ics.asterix.common.context.AsterixTreeRegistryProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.metadata.MetadataException;
import edu.uci.ics.asterix.metadata.declared.AqlCompiledMetadataDeclarations;
@@ -27,8 +26,6 @@
private static final PhysicalOptimizationConfig physicalOptimizationConfig = OptimizationConfUtil
.getPhysicalOptimizationConfig();
- private static final Logger LOGGER = Logger.getLogger(IndexOperations.class.getName());
-
public static JobSpecification buildCreateIndexJobSpec(CompiledCreateIndexStatement createIndexStmt,
AqlCompiledMetadataDeclarations metadata) throws AsterixException, AlgebricksException {
SecondaryIndexCreator secondaryIndexCreator = SecondaryIndexCreator.createIndexCreator(createIndexStmt.getIndexType(), physicalOptimizationConfig);
@@ -41,13 +38,13 @@
String indexName = deleteStmt.getIndexName();
JobSpecification spec = new JobSpecification();
- IIndexRegistryProvider<IIndex> btreeRegistryProvider = AsterixTreeRegistryProvider.INSTANCE;
+ IIndexRegistryProvider<IIndex> indexRegistryProvider = AsterixIndexRegistryProvider.INSTANCE;
IStorageManagerInterface storageManager = AsterixStorageManagerInterface.INSTANCE;
Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitsAndConstraint = datasetDecls
.splitProviderAndPartitionConstraintsForInternalOrFeedDataset(datasetName, indexName);
TreeIndexDropOperatorDescriptor btreeDrop = new TreeIndexDropOperatorDescriptor(spec, storageManager,
- btreeRegistryProvider, splitsAndConstraint.first);
+ indexRegistryProvider, splitsAndConstraint.first);
AlgebricksPartitionConstraintHelper
.setPartitionConstraintInJobSpec(spec, btreeDrop, splitsAndConstraint.second);
spec.addRoot(btreeDrop);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java
index 7b01858..d9585fd 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java
@@ -5,8 +5,8 @@
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.config.DatasetConfig.IndexType;
+import edu.uci.ics.asterix.common.context.AsterixIndexRegistryProvider;
import edu.uci.ics.asterix.common.context.AsterixStorageManagerInterface;
-import edu.uci.ics.asterix.common.context.AsterixTreeRegistryProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.formats.nontagged.AqlBinaryBooleanInspectorImpl;
import edu.uci.ics.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
@@ -207,7 +207,7 @@
// +Infinity
int[] highKeyFields = null;
BTreeSearchOperatorDescriptor primarySearchOp = new BTreeSearchOperatorDescriptor(spec, primaryRecDesc,
- AsterixStorageManagerInterface.INSTANCE, AsterixTreeRegistryProvider.INSTANCE,
+ AsterixStorageManagerInterface.INSTANCE, AsterixIndexRegistryProvider.INSTANCE,
primaryFileSplitProvider, primaryRecDesc.getTypeTraits(), primaryComparatorFactories, lowKeyFields,
highKeyFields, true, true, new BTreeDataflowHelperFactory(), NoOpOperationCallbackProvider.INSTANCE);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, primarySearchOp,
@@ -261,7 +261,7 @@
Pair<IFileSplitProvider, AlgebricksPartitionConstraint> secondarySplitsAndConstraint = metadata
.splitProviderAndPartitionConstraintsForInternalOrFeedDataset(datasetName, secondaryIndexName);
TreeIndexBulkLoadOperatorDescriptor treeIndexBulkLoadOp = new TreeIndexBulkLoadOperatorDescriptor(spec,
- AsterixStorageManagerInterface.INSTANCE, AsterixTreeRegistryProvider.INSTANCE,
+ AsterixStorageManagerInterface.INSTANCE, AsterixIndexRegistryProvider.INSTANCE,
secondarySplitsAndConstraint.first, secondaryRecDesc.getTypeTraits(), secondaryComparatorFactories,
fieldPermutation, fillFactor, dataflowHelperFactory, NoOpOperationCallbackProvider.INSTANCE);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, treeIndexBulkLoadOp,
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java
index a5268b2..4f0d3a5 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java
@@ -4,8 +4,8 @@
import java.util.List;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
+import edu.uci.ics.asterix.common.context.AsterixIndexRegistryProvider;
import edu.uci.ics.asterix.common.context.AsterixStorageManagerInterface;
-import edu.uci.ics.asterix.common.context.AsterixTreeRegistryProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
import edu.uci.ics.asterix.formats.nontagged.AqlBinaryTokenizerFactoryProvider;
@@ -100,7 +100,7 @@
// ---------- START GENERAL BTREE STUFF
- IIndexRegistryProvider<IIndex> treeRegistryProvider = AsterixTreeRegistryProvider.INSTANCE;
+ IIndexRegistryProvider<IIndex> treeRegistryProvider = AsterixIndexRegistryProvider.INSTANCE;
IStorageManagerInterface storageManager = AsterixStorageManagerInterface.INSTANCE;
// ---------- END GENERAL BTREE STUFF
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestKeywordIndexJob.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestKeywordIndexJob.java
index a96ccee..f755752 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestKeywordIndexJob.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestKeywordIndexJob.java
@@ -6,8 +6,8 @@
import java.util.HashMap;
import java.util.List;
+import edu.uci.ics.asterix.common.context.AsterixIndexRegistryProvider;
import edu.uci.ics.asterix.common.context.AsterixStorageManagerInterface;
-import edu.uci.ics.asterix.common.context.AsterixTreeRegistryProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.AObjectAscBinaryComparatorFactory;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AObjectSerializerDeserializer;
@@ -66,7 +66,7 @@
// ---------- START GENERAL BTREE STUFF
- IIndexRegistryProvider<IIndex> btreeRegistryProvider = AsterixTreeRegistryProvider.INSTANCE;
+ IIndexRegistryProvider<IIndex> indexRegistryProvider = AsterixIndexRegistryProvider.INSTANCE;
IStorageManagerInterface storageManager = AsterixStorageManagerInterface.INSTANCE;
// ---------- END GENERAL BTREE STUFF
@@ -104,25 +104,25 @@
ITypeTraits[] secondaryTypeTraits = new ITypeTraits[2];
secondaryTypeTraits[0] = new ITypeTraits() {
-
+
@Override
public boolean isFixedLength() {
return false;
}
-
+
@Override
public int getFixedLength() {
return -1;
}
};
-
+
secondaryTypeTraits[1] = new ITypeTraits() {
-
+
@Override
public boolean isFixedLength() {
return true;
}
-
+
@Override
public int getFixedLength() {
return 5;
@@ -144,8 +144,8 @@
new FileSplit("nc1", new FileReference(new File("/tmp/nc1/demo1112/Customers_idx_NameInvIndex"))),
new FileSplit("nc2", new FileReference(new File("/tmp/nc2/demo1112/Customers_idx_NameInvIndex"))) });
BTreeSearchOperatorDescriptor secondarySearchOp = new BTreeSearchOperatorDescriptor(spec, secondaryRecDesc,
- storageManager, btreeRegistryProvider, secondarySplitProvider,
- secondaryTypeTraits, secondaryComparatorFactories, lowKeyFields, highKeyFields, true, true,
+ storageManager, indexRegistryProvider, secondarySplitProvider, secondaryTypeTraits,
+ secondaryComparatorFactories, lowKeyFields, highKeyFields, true, true,
new BTreeDataflowHelperFactory(), NoOpOperationCallbackProvider.INSTANCE);
String[] secondarySearchOpLocationConstraint = new String[nodeGroup.size()];
for (int p = 0; p < nodeGroup.size(); p++) {
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestSecondaryIndexJob.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestSecondaryIndexJob.java
index 01279f3..17d8c9f 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestSecondaryIndexJob.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestSecondaryIndexJob.java
@@ -6,8 +6,8 @@
import java.util.HashMap;
import java.util.List;
+import edu.uci.ics.asterix.common.context.AsterixIndexRegistryProvider;
import edu.uci.ics.asterix.common.context.AsterixStorageManagerInterface;
-import edu.uci.ics.asterix.common.context.AsterixTreeRegistryProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.dataflow.data.nontagged.comparators.AObjectAscBinaryComparatorFactory;
import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AObjectSerializerDeserializer;
@@ -66,7 +66,7 @@
// ---------- START GENERAL BTREE STUFF
- IIndexRegistryProvider<IIndex> btreeRegistryProvider = AsterixTreeRegistryProvider.INSTANCE;
+ IIndexRegistryProvider<IIndex> indexRegistryProvider = AsterixIndexRegistryProvider.INSTANCE;
IStorageManagerInterface storageManager = AsterixStorageManagerInterface.INSTANCE;
// ---------- END GENERAL BTREE STUFF
@@ -143,12 +143,10 @@
IFileSplitProvider secondarySplitProvider = new ConstantFileSplitProvider(new FileSplit[] {
new FileSplit("nc1", new FileReference(new File("/tmp/nc1/demo1112/Customers_idx_NameBtreeIndex"))),
new FileSplit("nc2", new FileReference(new File("/tmp/nc2/demo1112/Customers_idx_NameBtreeIndex"))) });
- BTreeSearchOperatorDescriptor secondarySearchOp = new BTreeSearchOperatorDescriptor(
- spec, secondaryRecDesc, storageManager, btreeRegistryProvider,
- secondarySplitProvider, secondaryTypeTraits,
- secondaryComparatorFactories, lowKeyFields, highKeyFields,
- true, true, new BTreeDataflowHelperFactory(),
- NoOpOperationCallbackProvider.INSTANCE);
+ BTreeSearchOperatorDescriptor secondarySearchOp = new BTreeSearchOperatorDescriptor(spec, secondaryRecDesc,
+ storageManager, indexRegistryProvider, secondarySplitProvider, secondaryTypeTraits,
+ secondaryComparatorFactories, lowKeyFields, highKeyFields, true, true,
+ new BTreeDataflowHelperFactory(), NoOpOperationCallbackProvider.INSTANCE);
String[] secondarySearchOpLocationConstraint = new String[nodeGroup.size()];
for (int p = 0; p < nodeGroup.size(); p++) {
secondarySearchOpLocationConstraint[p] = nodeGroup.get(p);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCBootstrapImpl.java b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCBootstrapImpl.java
index c6d38d3..ccba498 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCBootstrapImpl.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCBootstrapImpl.java
@@ -19,6 +19,7 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.jetty.server.Server;
@@ -28,7 +29,6 @@
import edu.uci.ics.asterix.api.aqlj.server.APIClientThreadFactory;
import edu.uci.ics.asterix.api.aqlj.server.ThreadedServer;
import edu.uci.ics.asterix.api.http.servlet.APIServlet;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfoImpl;
import edu.uci.ics.asterix.common.config.GlobalConfig;
import edu.uci.ics.asterix.metadata.MetadataManager;
import edu.uci.ics.asterix.metadata.api.IAsterixStateProxy;
@@ -41,63 +41,46 @@
private static final Logger LOGGER = Logger.getLogger(CCBootstrapImpl.class.getName());
private static final int DEFAULT_WEB_SERVER_PORT = 19001;
+
public static final int DEFAULT_API_SERVER_PORT = 14600;
private static final int DEFAULT_API_NODEDATA_SERVER_PORT = 14601;
- private Server server;
+ private Server webServer;
private static IAsterixStateProxy proxy;
private ICCApplicationContext appCtx;
private ThreadedServer apiServer;
@Override
public void start() throws Exception {
- LOGGER.info("Starting Asterix CC Bootstrap");
- String portStr = System.getProperty(GlobalConfig.WEB_SERVER_PORT_PROPERTY);
- int port = DEFAULT_WEB_SERVER_PORT;
- if (portStr != null) {
- port = Integer.parseInt(portStr);
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("Starting Asterix cluster controller");
}
- server = new Server(port);
- ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
- context.setContextPath("/");
- server.setHandler(context);
- context.addServlet(new ServletHolder(new APIServlet()), "/*");
- server.start();
+ // Set the AsterixStateProxy to be the distributed object
proxy = AsterixStateProxy.registerRemoteObject();
proxy.setAsterixProperties(AsterixProperties.INSTANCE);
-
- // set the APINodeDataServer ports
- int startPort = DEFAULT_API_NODEDATA_SERVER_PORT;
- Map<String, Set<String>> nodeNameMap = new HashMap<String, Set<String>>();
- try {
- appCtx.getCCContext().getIPAddressNodeMap(nodeNameMap);
- } catch (Exception e) {
- throw new IOException(" unable to obtain IP address node map", e);
- }
- AsterixAppContextInfoImpl.setNodeControllerInfo(nodeNameMap);
- for (Map.Entry<String, Set<String>> entry : nodeNameMap.entrySet()) {
- Set<String> nodeNames = entry.getValue();
- Iterator<String> it = nodeNames.iterator();
- while (it.hasNext()) {
- AsterixNodeState ns = new AsterixNodeState();
- ns.setAPINodeDataServerPort(startPort);
- proxy.setAsterixNodeState(it.next(), ns);
- startPort++;
- }
- }
-
appCtx.setDistributedState(proxy);
+
+ // Create the metadata manager
MetadataManager.INSTANCE = new MetadataManager(proxy);
- apiServer = new ThreadedServer(DEFAULT_API_SERVER_PORT, new APIClientThreadFactory(appCtx));
+
+ // Setup and start the web interface
+ setupWebServer();
+ webServer.start();
+
+ // Setup and start the API server
+ setupAPIServer();
apiServer.start();
}
@Override
public void stop() throws Exception {
- LOGGER.info("Stopping Asterix CC Bootstrap");
- AsterixStateProxy.deRegisterRemoteObject();
- server.stop();
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("Stopping Asterix cluster controller");
+ }
+ AsterixStateProxy.unregisterRemoteObject();
+
+ webServer.stop();
apiServer.shutdown();
}
@@ -106,4 +89,40 @@
this.appCtx = appCtx;
}
+ private void setupWebServer() throws Exception {
+ String portStr = System.getProperty(GlobalConfig.WEB_SERVER_PORT_PROPERTY);
+ int port = DEFAULT_WEB_SERVER_PORT;
+ if (portStr != null) {
+ port = Integer.parseInt(portStr);
+ }
+ webServer = new Server(port);
+
+ ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
+ context.setContextPath("/");
+ webServer.setHandler(context);
+ context.addServlet(new ServletHolder(new APIServlet()), "/*");
+ }
+
+ private void setupAPIServer() throws Exception {
+ // set the APINodeDataServer ports
+ int startPort = DEFAULT_API_NODEDATA_SERVER_PORT;
+ Map<String, Set<String>> nodeNameMap = new HashMap<String, Set<String>>();
+ try {
+ appCtx.getCCContext().getIPAddressNodeMap(nodeNameMap);
+ } catch (Exception e) {
+ throw new IOException("Unable to obtain IP address node map", e);
+ }
+
+ for (Map.Entry<String, Set<String>> entry : nodeNameMap.entrySet()) {
+ Set<String> nodeNames = entry.getValue();
+ Iterator<String> it = nodeNames.iterator();
+ while (it.hasNext()) {
+ AsterixNodeState ns = new AsterixNodeState();
+ ns.setAPINodeDataServerPort(startPort++);
+ proxy.setAsterixNodeState(it.next(), ns);
+ }
+ }
+
+ apiServer = new ThreadedServer(DEFAULT_API_SERVER_PORT, new APIClientThreadFactory(appCtx));
+ }
}
\ No newline at end of file
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCBootstrapImpl.java b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCBootstrapImpl.java
index 7cdca49..b1e7481 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCBootstrapImpl.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCBootstrapImpl.java
@@ -14,103 +14,96 @@
*/
package edu.uci.ics.asterix.hyracks.bootstrap;
+import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
+import java.util.logging.Level;
import java.util.logging.Logger;
import edu.uci.ics.asterix.api.aqlj.server.NodeDataClientThreadFactory;
import edu.uci.ics.asterix.api.aqlj.server.ThreadedServer;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfoImpl;
-import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.common.context.AsterixAppRuntimeContext;
import edu.uci.ics.asterix.metadata.MetadataManager;
import edu.uci.ics.asterix.metadata.MetadataNode;
import edu.uci.ics.asterix.metadata.api.IAsterixStateProxy;
import edu.uci.ics.asterix.metadata.api.IMetadataNode;
-import edu.uci.ics.asterix.metadata.bootstrap.AsterixProperties;
import edu.uci.ics.asterix.metadata.bootstrap.MetadataBootstrap;
-import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
-import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionProvider;
import edu.uci.ics.hyracks.api.application.INCApplicationContext;
import edu.uci.ics.hyracks.api.application.INCBootstrap;
public class NCBootstrapImpl implements INCBootstrap {
private static final Logger LOGGER = Logger.getLogger(NCBootstrapImpl.class.getName());
- public static final int DEFAULT_AQLJ_NODE_DATA_SERVER_PORT = 6061;
-
- private INCApplicationContext ncAppContext = null;
-
- private static IMetadataNode metadataNode;
+ private INCApplicationContext ncApplicationContext = null;
+ private AsterixAppRuntimeContext runtimeContext;
private String nodeId;
-
+ private boolean isMetadataNode = false;
private ThreadedServer apiNodeDataServer;
@Override
public void start() throws Exception {
-
- LOGGER.info("Starting Asterix NC " + nodeId + " Bootstrap");
- IAsterixStateProxy p = (IAsterixStateProxy) ncAppContext.getDistributedState();
- LOGGER.info("\nMetadata node " + p.getAsterixProperties().getMetadataNodeName());
- initializeTransactionSupport(ncAppContext, nodeId);
- if (nodeId.equals(p.getAsterixProperties().getMetadataNodeName())) {
- AsterixAppRuntimeContext.initialize(ncAppContext);
- LOGGER.info("Initialized AsterixRuntimeContext: " + AsterixAppRuntimeContext.getInstance());
- metadataNode = registerRemoteObject(ncAppContext, p.getAsterixProperties());
- p.setMetadataNode(metadataNode);
- MetadataManager.INSTANCE = new MetadataManager(p);
- LOGGER.info("Bootstrapping Metadata");
- MetadataManager.INSTANCE.init();
- MetadataBootstrap.startUniverse(p.getAsterixProperties(), AsterixAppContextInfoImpl.INSTANCE);
- } else {
- Thread.sleep(5000);
- AsterixAppRuntimeContext.initialize(ncAppContext);
- LOGGER.info("Initialized AsterixRuntimeContext: " + AsterixAppRuntimeContext.getInstance());
+ nodeId = ncApplicationContext.getNodeId();
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("Starting Asterix node controller: " + nodeId);
}
- IAsterixStateProxy proxy = (IAsterixStateProxy) ncAppContext.getDistributedState();
- AsterixNodeState ns = (AsterixNodeState) proxy.getAsterixNodeState(ncAppContext.getNodeId());
+ runtimeContext = new AsterixAppRuntimeContext(ncApplicationContext);
+ runtimeContext.initialize();
+
+ ncApplicationContext.setApplicationObject(runtimeContext);
+
+ // Initialize metadata if this node is the metadata node
+ IAsterixStateProxy proxy = (IAsterixStateProxy) ncApplicationContext.getDistributedState();
+ isMetadataNode = nodeId.equals(proxy.getAsterixProperties().getMetadataNodeName());
+ if (isMetadataNode) {
+ registerRemoteMetadataNode(proxy);
+
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("Bootstrapping metadata");
+ }
+
+ MetadataManager.INSTANCE = new MetadataManager(proxy);
+ MetadataManager.INSTANCE.init();
+ MetadataBootstrap.startUniverse(proxy.getAsterixProperties(), ncApplicationContext);
+
+ }
+
+ // Start a sub-component for the API server. This server is only connected to by the
+ // API server that lives on the CC and never by a client wishing to execute AQL.
+ // TODO: The API sub-system will change dramatically in the future and this code will go away,
+ // but leave it for now.
+ AsterixNodeState ns = (AsterixNodeState) proxy.getAsterixNodeState(nodeId);
apiNodeDataServer = new ThreadedServer(ns.getAPINodeDataServerPort(), new NodeDataClientThreadFactory());
apiNodeDataServer.start();
}
- public static IMetadataNode registerRemoteObject(INCApplicationContext ncAppContext,
- AsterixProperties asterixProperties) throws AsterixException {
- try {
- TransactionProvider factory = (TransactionProvider) ncAppContext.getApplicationObject();
- MetadataNode.INSTANCE = new MetadataNode(asterixProperties, AsterixAppContextInfoImpl.INSTANCE, factory);
- IMetadataNode stub = (IMetadataNode) UnicastRemoteObject.exportObject(MetadataNode.INSTANCE, 0);
- LOGGER.info("MetadataNode bound.");
- return stub;
- } catch (Exception e) {
- LOGGER.info("MetadataNode exception.");
- throw new AsterixException(e);
+ public void registerRemoteMetadataNode(IAsterixStateProxy proxy) throws RemoteException {
+ IMetadataNode stub = null;
+ MetadataNode.INSTANCE.initialize(runtimeContext);
+ stub = (IMetadataNode) UnicastRemoteObject.exportObject(MetadataNode.INSTANCE, 0);
+ proxy.setMetadataNode(stub);
+
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("Metadata node bound");
}
}
@Override
public void stop() throws Exception {
- LOGGER.info("Stopping Asterix NC Bootstrap");
- IAsterixStateProxy p = (IAsterixStateProxy) ncAppContext.getDistributedState();
- if (nodeId.equals(p.getAsterixProperties().getMetadataNodeName())) {
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("Stopping Asterix node controller: " + nodeId);
+ }
+
+ // Quiesce metadata
+ if (isMetadataNode) {
MetadataBootstrap.stopUniverse();
}
- AsterixAppRuntimeContext.deinitialize();
+
apiNodeDataServer.shutdown();
+ runtimeContext.deinitialize();
}
@Override
public void setApplicationContext(INCApplicationContext appCtx) {
- this.ncAppContext = appCtx;
- this.nodeId = ncAppContext.getNodeId();
- }
-
- private void initializeTransactionSupport(INCApplicationContext ncAppContext, String nodeId) {
- try {
- TransactionProvider factory = new TransactionProvider(nodeId);
- ncAppContext.setApplicationObject(factory);
- } catch (ACIDException e) {
- e.printStackTrace();
- LOGGER.severe(" Could not initialize transaction support ");
- }
+ this.ncApplicationContext = appCtx;
}
}
\ No newline at end of file
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
index 1ae6466..4dfe106 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
@@ -6,8 +6,8 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FileReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
@@ -48,7 +48,7 @@
public static void runScriptAndCompareWithResult(IHyracksClientConnection hcc, File scriptFile, PrintWriter print,
File expectedFile, File actualFile) throws Exception {
- Reader query = new BufferedReader(new FileReader(scriptFile));
+ Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(scriptFile), "UTF-8"));
AsterixJavaClient asterix = new AsterixJavaClient(hcc, query, print);
try {
asterix.compile(true, false, true, true, false, true, false);
@@ -58,8 +58,10 @@
query.close();
}
asterix.execute();
- BufferedReader readerExpected = new BufferedReader(new FileReader(expectedFile));
- BufferedReader readerActual = new BufferedReader(new FileReader(actualFile));
+ BufferedReader readerExpected = new BufferedReader(new InputStreamReader(new FileInputStream(expectedFile),
+ "UTF-8"));
+ BufferedReader readerActual = new BufferedReader(
+ new InputStreamReader(new FileInputStream(actualFile), "UTF-8"));
String lineExpected, lineActual;
int num = 1;
try {
@@ -122,8 +124,10 @@
}
fos.close();
- BufferedReader readerExpected = new BufferedReader(new FileReader(expectedFile));
- BufferedReader readerActual = new BufferedReader(new FileReader(actualFile));
+ BufferedReader readerExpected = new BufferedReader(new InputStreamReader(new FileInputStream(expectedFile),
+ "UTF-8"));
+ BufferedReader readerActual = new BufferedReader(
+ new InputStreamReader(new FileInputStream(actualFile), "UTF-8"));
String lineExpected, lineActual;
int num = 1;
try {
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aqlj/ClientAPITest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aqlj/ClientAPITest.java
index fcc4eaf..0301675 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aqlj/ClientAPITest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aqlj/ClientAPITest.java
@@ -2,9 +2,10 @@
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.FileReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
@@ -48,7 +49,7 @@
ArrayList<String> list = new ArrayList<String>();
BufferedReader result;
try {
- result = new BufferedReader(new FileReader(PATH_BASE + fileName));
+ result = new BufferedReader(new InputStreamReader(new FileInputStream(PATH_BASE + fileName), "UTF-8"));
while (true) {
String line = result.readLine();
if (line == null) {
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/dml/DmlTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/dml/DmlTest.java
index 3e82ff6..5b88edb 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/dml/DmlTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/dml/DmlTest.java
@@ -2,7 +2,8 @@
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileReader;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
@@ -34,7 +35,8 @@
outdir.mkdirs();
AsterixHyracksIntegrationUtil.init();
- Reader loadReader = new BufferedReader(new FileReader(LOAD_FOR_ENLIST_FILE));
+ Reader loadReader = new BufferedReader(
+ new InputStreamReader(new FileInputStream(LOAD_FOR_ENLIST_FILE), "UTF-8"));
AsterixJavaClient asterixLoad = new AsterixJavaClient(
AsterixHyracksIntegrationUtil.getHyracksClientConnection(), loadReader, ERR);
try {
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java
index baa91dc..6fec201 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java
@@ -1,11 +1,8 @@
package edu.uci.ics.asterix.test.metadata;
import java.io.BufferedReader;
-import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
@@ -52,26 +49,6 @@
return fname.substring(0, dot + 1) + EXTENSION_RESULT;
}
- public static ArrayList<String> readFile(String fileName) {
- ArrayList<String> list = new ArrayList<String>();
- BufferedReader result;
- try {
- result = new BufferedReader(new FileReader(PATH_BASE + fileName));
- while (true) {
- String line = result.readLine();
- if (line == null) {
- break;
- } else {
- list.add(line);
- }
- }
- result.close();
- } catch (FileNotFoundException e) {
- } catch (IOException e) {
- }
- return list;
- }
-
@BeforeClass
public static void setUp() throws Exception {
_oldConfigFileName = System.getProperty(GlobalConfig.CONFIG_FILE_PROPERTY);
@@ -99,11 +76,10 @@
}
}
- private static void suiteBuild(File f, Collection<Object[]> testArgs, String path) {
+ private static void suiteBuild(File f, Collection<Object[]> testArgs, String path) throws IOException {
+ BufferedReader br = null;
try {
- FileInputStream fstream = new FileInputStream(f);
- DataInputStream in = new DataInputStream(fstream);
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
+ br = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8"));
String strLine;
File file;
while ((strLine = br.readLine()) != null) {
@@ -119,14 +95,18 @@
testArgs.add(new Object[] { file, expectedFile, actualFile });
}
}
- in.close();
+
} catch (IOException e) {
e.printStackTrace();
+ } finally {
+ if (br != null) {
+ br.close();
+ }
}
}
@Parameters
- public static Collection<Object[]> tests() {
+ public static Collection<Object[]> tests() throws IOException {
Collection<Object[]> testArgs = new ArrayList<Object[]>();
suiteBuild(new File(QUERIES_FILE), testArgs, "");
return testArgs;
@@ -144,7 +124,7 @@
@Test
public void test() throws Exception {
- Reader query = new BufferedReader(new FileReader(queryFile));
+ Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8"));
AsterixJavaClient asterix = new AsterixJavaClient(AsterixHyracksIntegrationUtil.getHyracksClientConnection(),
query, ERR);
try {
@@ -160,8 +140,10 @@
query.close();
if (actualFile.exists()) {
- BufferedReader readerExpected = new BufferedReader(new FileReader(expectedFile));
- BufferedReader readerActual = new BufferedReader(new FileReader(actualFile));
+ BufferedReader readerExpected = new BufferedReader(new InputStreamReader(new FileInputStream(expectedFile),
+ "UTF-8"));
+ BufferedReader readerActual = new BufferedReader(new InputStreamReader(new FileInputStream(actualFile),
+ "UTF-8"));
String lineExpected, lineActual;
int num = 1;
try {
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTransactionsTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTransactionsTest.java
index 6081994..1645a96 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTransactionsTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTransactionsTest.java
@@ -3,11 +3,8 @@
import static org.junit.Assert.fail;
import java.io.BufferedReader;
-import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
@@ -55,32 +52,12 @@
return fname.substring(0, dot + 1) + EXTENSION_RESULT;
}
- public static ArrayList<String> readFile(String fileName) {
- ArrayList<String> list = new ArrayList<String>();
- BufferedReader result;
- try {
- result = new BufferedReader(new FileReader(PATH_BASE + fileName));
- while (true) {
- String line = result.readLine();
- if (line == null) {
- break;
- } else {
- list.add(line);
- }
- }
- result.close();
- } catch (FileNotFoundException e) {
- } catch (IOException e) {
- }
- return list;
- }
-
private static void executeQueryTuple(Object[] queryTuple, boolean expectFailure, boolean executeQuery) {
String queryFileName = (String) queryTuple[0];
String expectedFileName = (String) queryTuple[1];
String actualFileName = (String) queryTuple[2];
try {
- Reader query = new BufferedReader(new FileReader(queryFileName));
+ Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(queryFileName), "UTF-8"));
AsterixJavaClient asterix = new AsterixJavaClient(
AsterixHyracksIntegrationUtil.getHyracksClientConnection(), query, ERR);
LOGGER.info("Query is: " + queryFileName);
@@ -115,8 +92,10 @@
File actualFile = new File(actualFileName);
File expectedFile = new File(expectedFileName);
if (actualFile.exists()) {
- BufferedReader readerExpected = new BufferedReader(new FileReader(expectedFile));
- BufferedReader readerActual = new BufferedReader(new FileReader(actualFile));
+ BufferedReader readerExpected = new BufferedReader(new InputStreamReader(new FileInputStream(
+ expectedFile), "UTF-8"));
+ BufferedReader readerActual = new BufferedReader(new InputStreamReader(new FileInputStream(actualFile),
+ "UTF-8"));
String lineExpected, lineActual;
int num = 1;
try {
@@ -204,12 +183,11 @@
}
private static void prepareQuerySuite(String queryListPath, String queryPath, String expectedPath,
- String actualPath, Collection<Object[]> output) {
+ String actualPath, Collection<Object[]> output) throws IOException {
+ BufferedReader br = null;
try {
File queryListFile = new File(queryListPath);
- FileInputStream fstream = new FileInputStream(queryListFile);
- DataInputStream in = new DataInputStream(fstream);
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
+ br = new BufferedReader(new InputStreamReader(new FileInputStream(queryListFile), "UTF-8"));
String strLine;
String queryFileName;
File queryFile;
@@ -235,14 +213,17 @@
output.add(new Object[] { queryFileName, expectedFileName, actualFileName });
}
}
- in.close();
} catch (IOException e) {
e.printStackTrace();
+ } finally {
+ if (br != null) {
+ br.close();
+ }
}
}
@Parameters
- public static Collection<Object[]> tests() {
+ public static Collection<Object[]> tests() throws IOException {
Collection<Object[]> testArgs = new ArrayList<Object[]>();
prepareQuerySuite(QUERIES_FILE, TEST_QUERIES_PATH, null, null, testArgs);
return testArgs;
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
index 4c6e301..7e0ff86 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
@@ -2,7 +2,9 @@
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileReader;
+import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.ArrayList;
@@ -120,8 +122,7 @@
Assume.assumeTrue(!skipped);
LOGGER.severe("RUN TEST: \"" + queryFile.getPath() + "\"");
-
- Reader query = new BufferedReader(new FileReader(queryFile));
+ Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8"));
PrintWriter plan = new PrintWriter(actualFile);
AsterixJavaClient asterix = new AsterixJavaClient(
AsterixHyracksIntegrationUtil.getHyracksClientConnection(), query, plan);
@@ -135,8 +136,10 @@
plan.close();
query.close();
- BufferedReader readerExpected = new BufferedReader(new FileReader(expectedFile));
- BufferedReader readerActual = new BufferedReader(new FileReader(actualFile));
+ BufferedReader readerExpected = new BufferedReader(new InputStreamReader(new FileInputStream(expectedFile),
+ "UTF-8"));
+ BufferedReader readerActual = new BufferedReader(new InputStreamReader(new FileInputStream(actualFile),
+ "UTF-8"));
String lineExpected, lineActual;
int num = 1;
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RuntimeTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RuntimeTest.java
index 6d33836..b7877a3 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RuntimeTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RuntimeTest.java
@@ -2,9 +2,10 @@
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.FileReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
@@ -53,7 +54,7 @@
ArrayList<String> list = new ArrayList<String>();
BufferedReader result;
try {
- result = new BufferedReader(new FileReader(PATH_BASE + fileName));
+ result = new BufferedReader(new InputStreamReader(new FileInputStream(PATH_BASE + fileName), "UTF-8"));
while (true) {
String line = result.readLine();
if (line == null) {
@@ -86,7 +87,9 @@
lsn.deleteOnExit();
AsterixHyracksIntegrationUtil.init();
- HDFSCluster.getInstance().setup();
+
+ // TODO: Uncomment when hadoop version is upgraded and adapters are ported
+ //HDFSCluster.getInstance().setup();
}
@AfterClass
@@ -108,7 +111,8 @@
File lsn = new File("last_checkpoint_lsn");
lsn.deleteOnExit();
- HDFSCluster.getInstance().cleanup();
+ // TODO: Uncomment when hadoop version is upgraded and adapters are ported
+ //HDFSCluster.getInstance().cleanup();
}
private static void suiteBuild(File dir, Collection<Object[]> testArgs, String path) {
diff --git a/asterix-app/src/test/resources/runtimets/ignore.txt b/asterix-app/src/test/resources/runtimets/ignore.txt
index bfeb30a..0964e88 100644
--- a/asterix-app/src/test/resources/runtimets/ignore.txt
+++ b/asterix-app/src/test/resources/runtimets/ignore.txt
@@ -16,3 +16,5 @@
failure/q1_pricing_summary_report_failure.aql
open-closed
dml/insert-into-empty-dataset-with-index_02.aql
+dml/insert-into-empty-dataset-with-index_01.aql
+dml/load-from-hdfs.aql
diff --git a/asterix-app/src/test/resources/runtimets/only.txt b/asterix-app/src/test/resources/runtimets/only.txt
index e69de29..b399dbe 100644
--- a/asterix-app/src/test/resources/runtimets/only.txt
+++ b/asterix-app/src/test/resources/runtimets/only.txt
@@ -0,0 +1 @@
+dml/insert-into-empty-dataset-with-index_01.aql
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-01.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-01.aql
new file mode 100644
index 0000000..3319d90
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-01.aql
@@ -0,0 +1,21 @@
+/*
+ * Test case name : primitive-01.aql
+ * Description : Test primitive integer type int8 constructor function with boundary values
+ * Success : Yes
+ * Date : May 7th 2012
+ *
+ */
+
+write output to nc1:"rttest/constructor_primitive-01.adm";
+
+//Boundary value tests int8().
+//with MIN and MAX supported values.
+
+let $a:=int8("-127")
+let $b:=int8("127")
+let $c:=int8("0")
+let $d:=int8("1")
+let $e:=int8("-1")
+return {"$a":$a,"$b":$b,"$c":$c,"$d":$d,"$e":$e}
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-02.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-02.aql
new file mode 100644
index 0000000..3aa1a13
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-02.aql
@@ -0,0 +1,23 @@
+/*
+ * Test case name : primitive-02.aql
+ * Description : Test primitive integer type int16 constructor function with boundary values
+ * Success : Yes
+ * Date : May 7th 2012
+ *
+ */
+
+write output to nc1:"rttest/constructor_primitive-02.adm";
+
+//Boundary value tests int16().
+//with MIN and MAX supported values.
+
+let $a:=int16("-32767")
+let $b:=int16("32767")
+let $c:=int16("0")
+let $d:=int16("1")
+let $e:=int16("-1")
+let $f:=int16("16383")
+let $g:=int16("-16383")
+
+return {"$a":$a,"$b":$b,"$c":$c,"$d":$d,"$e":$e,"$f":$f,"$g":$g}
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-03.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-03.aql
new file mode 100644
index 0000000..f3df161
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-03.aql
@@ -0,0 +1,23 @@
+/*
+ * Test case name : primitive-03.aql
+ * Description : Test primitive integer type int32 constructor function with boundary values
+ * Success : Yes
+ * Date : May 7th 2012
+ *
+ */
+
+write output to nc1:"rttest/constructor_primitive-03.adm";
+
+//Boundary value tests int32().
+//with MIN and MAX supported values.
+
+let $a:=int32("-2147483647")
+let $b:=int32("2147483647")
+
+let $c:=int32("0")
+let $d:=int32("1")
+let $e:=int32("-1")
+let $f:=int32("1073741828")
+let $g:=int32("-1073741828")
+
+return {"$a":$a,"$b":$b,"$c":$c,"$d":$d,"$e":$e,"$f":$f,"$g":$g}
diff --git a/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-04.aql b/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-04.aql
new file mode 100644
index 0000000..a8e0b02
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/constructor/primitive-04.aql
@@ -0,0 +1,23 @@
+/*
+ * Test case name : primitive-04.aql
+ * Description : Test primitive integer type int64 constructor functions with boundary values
+ * Success : Yes
+ * Date : May 7th 2012
+ *
+ */
+
+write output to nc1:"rttest/constructor_primitive-04.adm";
+
+//Boundary value tests int64().
+//with MIN and MAX supported values.
+
+let $a:=int64("9222872036854775809")
+let $b:=int64("-9222872036854775809")
+
+let $c:=int64("0")
+let $d:=int64("1")
+let $e:=int64("-1")
+let $f:=int64("4611436018427387904")
+let $g:=int64("-4611436018427387904")
+
+return {"$a":$a,"$b":$b,"$c":$c,"$d":$d,"$e":$e,"$f":$f,"$g":$g}
diff --git a/asterix-app/src/test/resources/runtimets/results/constructor/primitive-01.adm b/asterix-app/src/test/resources/runtimets/results/constructor/primitive-01.adm
new file mode 100644
index 0000000..e4f0501
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/constructor/primitive-01.adm
@@ -0,0 +1 @@
+{ "$a": -127i8, "$b": 127i8, "$c": 0i8, "$d": 1i8, "$e": -1i8 }
diff --git a/asterix-app/src/test/resources/runtimets/results/constructor/primitive-02.adm b/asterix-app/src/test/resources/runtimets/results/constructor/primitive-02.adm
new file mode 100644
index 0000000..32b89e7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/constructor/primitive-02.adm
@@ -0,0 +1 @@
+{ "$a": -32767i16, "$b": 32767i16, "$c": 0i16, "$d": 1i16, "$e": -1i16, "$f": 16383i16, "$g": -16383i16 }
diff --git a/asterix-app/src/test/resources/runtimets/results/constructor/primitive-03.adm b/asterix-app/src/test/resources/runtimets/results/constructor/primitive-03.adm
new file mode 100644
index 0000000..f7774d0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/constructor/primitive-03.adm
@@ -0,0 +1 @@
+{ "$a": -2147483647, "$b": 2147483647, "$c": 0, "$d": 1, "$e": -1, "$f": 1073741828, "$g": -1073741828 }
diff --git a/asterix-app/src/test/resources/runtimets/results/constructor/primitive-04.adm b/asterix-app/src/test/resources/runtimets/results/constructor/primitive-04.adm
new file mode 100644
index 0000000..3453e4e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/constructor/primitive-04.adm
@@ -0,0 +1 @@
+{ "$a": 9222872036854775809i64, "$b": -9222872036854775809i64, "$c": 0i64, "$d": 1i64, "$e": -1i64, "$f": 4611436018427387904i64, "$g": -4611436018427387904i64 }