use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.
the class TestAdhocCompilerException method testEng7653UnexpectedException.
@Test
public void testEng7653UnexpectedException() throws Exception {
// Enables special DDL string triggering artificial exception in AsyncCompilerAgent.
System.setProperty("asynccompilerdebug", "true");
String pathToCatalog = Configuration.getPathToCatalogForTest("adhocddl.jar");
String pathToDeployment = Configuration.getPathToCatalogForTest("adhocddl.xml");
VoltProjectBuilder builder = new VoltProjectBuilder();
builder.setUseDDLSchema(true);
boolean success = builder.compile(pathToCatalog, 1, 1, 0);
assertTrue("Schema compilation failed", success);
MiscUtils.copyFile(builder.getPathToDeployment(), pathToDeployment);
VoltDB.Configuration config = new VoltDB.Configuration();
config.m_pathToCatalog = pathToCatalog;
config.m_pathToDeployment = pathToDeployment;
// Trigger an exception inside AsyncCompilerAgent
try {
startSystem(config);
boolean threw = false;
try {
// Ten seconds should be long enough to detect a hang.
String toxicDDL = AdHocNTBase.DEBUG_EXCEPTION_DDL + ";";
((ClientImpl) m_client).callProcedureWithClientTimeout(BatchTimeoutOverrideType.NO_TIMEOUT, "@AdHoc", 10, TimeUnit.SECONDS, toxicDDL);
} catch (ProcCallException pce) {
String message = pce.getLocalizedMessage();
if (message.startsWith("No response received in the allotted time")) {
// Check that a network thread didn't die.
tryOldClientWithValidDDL();
tryNewClientWithValidDDL();
fail("Timeout, server was probably hung. " + message);
}
assertTrue(String.format("Unexpected exception message: %s...", message), message.contains(AdHocNTBase.DEBUG_EXCEPTION_DDL));
threw = true;
}
assertTrue("Expected exception", threw);
} finally {
teardownSystem();
}
}
use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.
the class TestAdhocCreateDropIndex method createSchema.
private void createSchema(VoltDB.Configuration config, String ddl, final int sitesPerHost, final int hostCount, final int replication) throws Exception {
VoltProjectBuilder builder = new VoltProjectBuilder();
builder.addLiteralSchema(ddl);
builder.setUseDDLSchema(true);
config.m_pathToCatalog = Configuration.getPathToCatalogForTest("adhocddl.jar");
boolean success = builder.compile(config.m_pathToCatalog, sitesPerHost, hostCount, replication);
assertTrue("Schema compilation failed", success);
config.m_pathToDeployment = Configuration.getPathToCatalogForTest("adhocddl.xml");
MiscUtils.copyFile(builder.getPathToDeployment(), config.m_pathToDeployment);
}
use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.
the class TestLiveDDLSchemaSwitch method generateCatalogsAndDeployments.
void generateCatalogsAndDeployments(boolean useLiveDDL) throws Exception {
m_pathToCatalog = Configuration.getPathToCatalogForTest("adhocddl.jar");
m_pathToDeployment = Configuration.getPathToCatalogForTest("adhocddl.xml");
m_pathToReplicaDeployment = Configuration.getPathToCatalogForTest("replicaadhocddl.xml");
m_pathToOtherCatalog = Configuration.getPathToCatalogForTest("newadhocddl.jar");
m_pathToOtherDeployment = Configuration.getPathToCatalogForTest("newadhocddl.xml");
m_pathToOtherReplicaDeployment = Configuration.getPathToCatalogForTest("newreplicaadhocddl.xml");
VoltProjectBuilder builder = new VoltProjectBuilder();
builder.addLiteralSchema("create table FOO (" + "ID integer not null," + "VAL bigint, " + "constraint PK_TREE primary key (ID)" + ");\n" + "create table FOO_R (" + "ID integer not null," + "VAL bigint, " + "constraint PK_TREE_R primary key (ID)" + ");\n");
builder.addPartitionInfo("FOO", "ID");
builder.setUseDDLSchema(useLiveDDL);
// fake DR connection so that replica can start
builder.setDRMasterHost("localhost");
boolean success = builder.compile(m_pathToCatalog, 2, 1, 0);
assertTrue("Schema compilation failed", success);
MiscUtils.copyFile(builder.getPathToDeployment(), m_pathToDeployment);
builder.setDrReplica();
success = builder.compile(m_pathToCatalog, 2, 1, 0);
assertTrue("Schema compilation failed", success);
MiscUtils.copyFile(builder.getPathToDeployment(), m_pathToReplicaDeployment);
// get an alternate deployment file
builder = new VoltProjectBuilder();
builder.addLiteralSchema("create table BAZ (" + "ID integer not null," + "VAL bigint, " + "constraint PK_TREE primary key (ID)" + ");\n" + "create table FOO_R (" + "ID integer not null," + "VAL bigint, " + "constraint PK_TREE_R primary key (ID)" + ");\n");
builder.addPartitionInfo("BAZ", "ID");
builder.setUseDDLSchema(useLiveDDL);
builder.setDRMasterHost("localhost");
builder.setDeadHostTimeout(6);
success = builder.compile(m_pathToOtherCatalog, 2, 1, 0);
assertTrue("2nd schema compilation failed", success);
MiscUtils.copyFile(builder.getPathToDeployment(), m_pathToOtherDeployment);
builder.setDrReplica();
success = builder.compile(m_pathToOtherCatalog, 2, 1, 0);
assertTrue("2nd schema compilation failed", success);
MiscUtils.copyFile(builder.getPathToDeployment(), m_pathToOtherReplicaDeployment);
}
use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.
the class TestNTProcs method testRunEverywhereNTRoundTripCluster.
public void testRunEverywhereNTRoundTripCluster() throws Exception {
VoltProjectBuilder pb = new VoltProjectBuilder();
pb.addLiteralSchema(SCHEMA);
LocalCluster cluster = new LocalCluster("compileNT.jar", 4, 3, 1, BackendTarget.NATIVE_EE_JNI);
boolean success = cluster.compile(pb);
assertTrue(success);
cluster.startUp();
Client client = ClientFactory.createClient();
client.createConnection(cluster.getListenerAddress(0));
ClientResponseImpl response;
response = (ClientResponseImpl) client.callProcedure("TestNTProcs$RunEverywhereNTProc");
assertEquals(ClientResponse.SUCCESS, response.getStatus());
System.out.println("Client got trivial response");
System.out.println(response.toJSONString());
// CHECK STATS
VoltTable statsT = getStats(client, "PROCEDURE");
assertTrue(VoltTableUtil.tableContainsString(statsT, "RunEverywhereNTProc", true));
assertTrue(VoltTableUtil.tableContainsString(statsT, "TrivialNTProcPriority", true));
Map<String, Long> stats = aggregateProcRow(client, RunEverywhereNTProc.class.getName());
assertEquals(1, stats.get("INVOCATIONS").longValue());
stats = aggregateProcRow(client, TrivialNTProcPriority.class.getName());
assertEquals(3, stats.get("INVOCATIONS").longValue());
client.close();
cluster.shutDown();
}
use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.
the class TestNTProcs method compile.
private void compile() throws Exception {
VoltProjectBuilder pb = new VoltProjectBuilder();
pb.addLiteralSchema(SCHEMA);
assertTrue(pb.compile(Configuration.getPathToCatalogForTest("compileNT.jar")));
MiscUtils.copyFile(pb.getPathToDeployment(), Configuration.getPathToCatalogForTest("compileNT.xml"));
}
Aggregations