use of org.voltdb.client.ProcCallException 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.client.ProcCallException in project voltdb by VoltDB.
the class TestLiveDDLSchemaSwitch method testReplicaWithAdhocDDL.
@Test
public void testReplicaWithAdhocDDL() throws Exception {
generateCatalogsAndDeployments(true);
// Fire up a cluster with no catalog
VoltDB.Configuration config = new VoltDB.Configuration();
config.m_pathToCatalog = m_pathToOtherCatalog;
config.m_pathToDeployment = m_pathToReplicaDeployment;
try {
startSystem(config);
// UAC with schema should fail
assertFalse(findTableInSystemCatalogResults("FOO"));
boolean threw = false;
try {
m_client.updateApplicationCatalog(new File(m_pathToCatalog), null);
} catch (ProcCallException pce) {
threw = true;
assertTrue(pce.getMessage().contains("Cluster is configured to use AdHoc DDL"));
}
assertTrue("@UAC should have failed", threw);
assertFalse(findTableInSystemCatalogResults("FOO"));
// deployment-only UAC should fail
threw = false;
try {
m_client.updateApplicationCatalog(null, new File(m_pathToOtherReplicaDeployment));
} catch (ProcCallException pce) {
threw = true;
}
assertFalse("@UAC should should succeed with just a deployment file", threw);
assertEquals(getHeartbeatTimeout(), 6);
// Adhoc DDL should be rejected
assertFalse(findTableInSystemCatalogResults("BAR"));
try {
m_client.callProcedure("@AdHoc", "create table BAR (ID integer, VAL varchar(50));");
} catch (ProcCallException pce) {
fail("@AdHoc should succeed on replica cluster");
}
assertTrue(findTableInSystemCatalogResults("BAR"));
// Adhoc DML updates should be rejected in the replica
threw = false;
try {
m_client.callProcedure("@AdHoc", "insert into BAR values (100, 'ABC');");
} catch (ProcCallException pce) {
threw = true;
System.out.println(pce.getMessage());
assertTrue(pce.getMessage().contains("Write procedure @AdHoc_RW_MP is not allowed in replica cluster"));
}
assertTrue("Adhoc DDL should have failed", threw);
// @UpdateClasses should be rejected
assertFalse(findClassInSystemCatalog("org.voltdb_testprocs.fullddlfeatures.testImportProc"));
threw = false;
try {
InMemoryJarfile jarfile = new InMemoryJarfile();
VoltCompiler comp = new VoltCompiler(false);
comp.addClassToJar(jarfile, org.voltdb_testprocs.fullddlfeatures.testImportProc.class);
m_client.callProcedure("@UpdateClasses", jarfile.getFullJarBytes(), null);
} catch (ProcCallException pce) {
threw = true;
assertTrue(pce.getMessage().contains("Write procedure @UpdateClasses is not allowed"));
}
assertFalse("@UpdateClasses should have worked", threw);
assertTrue(findClassInSystemCatalog("org.voltdb_testprocs.fullddlfeatures.testImportProc"));
// adhoc queries still work
ClientResponse result = m_client.callProcedure("@AdHoc", "select * from baz;");
assertEquals(ClientResponse.SUCCESS, result.getStatus());
// Promote, should behave like the original master test
m_client.callProcedure("@Promote");
verifyMasterWithAdhocDDL();
} finally {
teardownSystem();
}
}
use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class TestNTProcs method getStats.
// get the first stats table for any selector
final VoltTable getStats(Client client, String selector) {
ClientResponse response = null;
try {
response = client.callProcedure("@Statistics", selector);
} catch (IOException | ProcCallException e) {
fail();
}
assertEquals(ClientResponse.SUCCESS, response.getStatus());
return response.getResults()[0];
}
use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class RegressionSuite method tearDown.
/**
* JUnit special method called to shutdown the test. This instance will
* stop the VoltDB server using the VoltServerConfig instance provided.
*/
@Override
public void tearDown() throws Exception {
if (m_completeShutdown) {
m_config.shutDown();
} else {
Catalog currentCataog = getCurrentCatalog();
if (currentCataog != null) {
CatalogDiffEngine diff = new CatalogDiffEngine(m_config.getInitialCatalog(), currentCataog);
// We will ignore this case.
if (diff.commands().split("\n").length > 1) {
fail("Catalog changed in test " + getName() + " while the regression suite optimization is on: \n" + diff.getDescriptionOfChanges(false));
}
}
Client client = getClient();
VoltTable tableList = client.callProcedure("@SystemCatalog", "TABLES").getResults()[0];
ArrayList<String> tableNames = new ArrayList<>(tableList.getRowCount());
int tableNameColIdx = tableList.getColumnIndex("TABLE_NAME");
int tableTypeColIdx = tableList.getColumnIndex("TABLE_TYPE");
while (tableList.advanceRow()) {
String tableType = tableList.getString(tableTypeColIdx);
if (!tableType.equalsIgnoreCase("EXPORT")) {
tableNames.add(tableList.getString(tableNameColIdx));
}
}
for (String tableName : tableNames) {
try {
client.callProcedure("@AdHoc", "DELETE FROM " + tableName);
} catch (ProcCallException pce) {
if (!pce.getMessage().contains("Illegal to modify a materialized view.")) {
fail("Hit an exception when cleaning up tables between tests: " + pce.getMessage());
}
}
}
client.drain();
}
for (final Client c : m_clients) {
c.close();
}
synchronized (m_clientChannels) {
for (final SocketChannel sc : m_clientChannels) {
try {
ConnectionUtil.closeConnection(sc);
} catch (final IOException e) {
e.printStackTrace();
}
}
m_clientChannels.clear();
}
m_clients.clear();
}
use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class TestFixedSQLSuite method subTestTicket310.
private void subTestTicket310() throws IOException, ProcCallException {
Client client = getClient();
String sql = "INSERT INTO R1_DECIMAL VALUES (26, 307473.174514, 289429.605067, 9.71903320295135486617e-01)";
client.callProcedure("@AdHoc", sql);
boolean caught = false;
// Fake the test out.
if (isHSQL()) {
caught = true;
}
try {
sql = "SELECT * FROM R1_DECIMAL WHERE " + "(R1_DECIMAL.CASH <= 999999999999999999999999999999.0622493314185)" + " AND (R1_DECIMAL.ID > R1_DECIMAL.CASH)";
client.callProcedure("@AdHoc", sql);
} catch (ProcCallException e) {
caught = true;
}
assertTrue(caught);
truncateTable(client, "R1_DECIMAL");
}
Aggregations