use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class TestSystemCatalogSuite method testInvalidSelector.
public void testInvalidSelector() throws IOException {
Client client = getClient();
try {
client.callProcedure("@SystemCatalog", "NONSENSE");
} catch (ProcCallException pce) {
assertTrue(pce.getMessage().contains("Invalid @SystemCatalog selector"));
return;
}
fail("Invalid selector should have resulted in a ProcCallException but didn't");
}
use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class DeletesClient method performSnapshot.
public static void performSnapshot(Client client) {
checkSnapshotComplete(client);
if (m_snapshotInProgress) {
System.out.println("Snapshot still in progress, bailing");
return;
}
try {
VoltTable[] results = client.callProcedure("@SnapshotDelete", new String[] { m_snapshotDir }, new String[] { m_snapshotId }).getResults();
} catch (NoConnectionsException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (ProcCallException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// m_totalRows should be accurate at this point
m_snapshotSizes.add(m_totalRows);
System.out.println("Performing Snapshot with total rows: " + m_totalRows);
try {
if (m_blockingSnapshots) {
ClientResponse response = client.callProcedure("@SnapshotSave", m_snapshotDir, m_snapshotId, 1);
if (response.getStatus() != ClientResponse.SUCCESS) {
System.out.println("failed snapshot");
System.out.println(response.getStatusString());
}
} else {
client.callProcedure(new ProcedureCallback() {
@Override
public void clientCallback(ClientResponse response) {
if (response.getStatus() != ClientResponse.SUCCESS) {
System.out.println("failed snapshot");
System.out.println(response.getStatusString());
}
}
}, "@SnapshotSave", m_snapshotDir, m_snapshotId, 0);
}
} catch (NoConnectionsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ProcCallException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class ClientMoverEL method main.
public static void main(String[] args) {
long numMoves = (long) Long.valueOf(args[0]);
String serverList = args[1];
long clientDurationSeconds = (long) Long.valueOf(args[2]);
long loopPauseSeconds = (long) Long.valueOf(args[3]);
m_logger.info(String.format("Executing %,d moves per transaction", numMoves));
m_logger.info(String.format("Running for %,d second(s)", clientDurationSeconds));
int num_partitions = 0;
long playerId;
long gameId;
long socialId;
long clientId;
long visitTime;
int intCounter;
long longCounter;
final org.voltdb.client.Client voltclient = ClientFactory.createClient();
String[] voltServers = serverList.split(",");
for (String thisServer : voltServers) {
try {
thisServer = thisServer.trim();
m_logger.info(String.format("Connecting to server: %s", thisServer));
voltclient.createConnection(thisServer, "program", "none");
} catch (IOException e) {
m_logger.error(e.toString());
System.exit(-1);
}
}
java.util.Random rand = new java.util.Random(0);
long startTime = System.currentTimeMillis();
long endTime = startTime + (1000l * clientDurationSeconds);
long currentTime = startTime;
// get the # of partitions in my cluster
try {
VoltTable[] vtPartitionInfo = voltclient.callProcedure("@Statistics", "partitioncount", 0l).getResults();
num_partitions = (int) vtPartitionInfo[0].fetchRow(0).getLong(0);
m_logger.info("System is running with " + num_partitions + " partition(s).");
} catch (ProcCallException e) {
m_logger.error("ProcCallException:");
m_logger.error(e.toString());
} catch (IOException e) {
m_logger.error("IOException:");
m_logger.error(e.toString());
System.exit(-1);
}
boolean foundRows = true;
boolean foundFullRowset = false;
while (endTime > currentTime) {
// do a single archive at each partition
foundRows = false;
foundFullRowset = false;
long callTimeMillis = System.currentTimeMillis();
try {
for (longCounter = 0; longCounter < num_partitions; longCounter++) {
try {
long callTimeBegin = System.currentTimeMillis();
VoltTable[] vtArchiveVisits = voltclient.callProcedure("ArchiveVisitsEL", longCounter, numMoves, callTimeMillis).getResults();
long callTimeEnd = System.currentTimeMillis();
int rowCount = (int) vtArchiveVisits[0].fetchRow(0).getLong(1);
if (rowCount > 0) {
// write out the rows
foundRows = true;
if (rowCount == numMoves) {
foundFullRowset = true;
}
}
String currentDate = new Date().toString();
m_logger.info(String.format("[%s] Ran archive on partition %d : archived %,d row(s) in %,d milliseconds", currentDate, longCounter, rowCount, (callTimeEnd - callTimeBegin)));
} catch (ProcCallException e) {
m_logger.error("ProcCallException:");
m_logger.error(e.toString());
} catch (NoConnectionsException e) {
m_logger.error("IOException:");
m_logger.error(e.toString());
System.exit(-1);
}
}
if (!foundRows) {
// no rows found
m_logger.info("No rows found for this run.");
// pause for 5 seconds
m_logger.info(String.format("Pausing for %d seconds...", loopPauseSeconds));
long pauseCurrentMillis = System.currentTimeMillis();
long pauseEndMillis = pauseCurrentMillis + (loopPauseSeconds * 1000l);
while (pauseCurrentMillis < pauseEndMillis) {
pauseCurrentMillis = System.currentTimeMillis();
}
} else if (!foundFullRowset) {
// none of the rowsets were full (amount requested)
// pause for given number seconds
m_logger.info(String.format("No full rowsets found, pausing for %d seconds...", loopPauseSeconds));
long pauseCurrentMillis = System.currentTimeMillis();
long pauseEndMillis = pauseCurrentMillis + (loopPauseSeconds * 1000l);
while (pauseCurrentMillis < pauseEndMillis) {
pauseCurrentMillis = System.currentTimeMillis();
}
}
} catch (IOException e) {
m_logger.error(e.toString());
System.exit(-1);
}
currentTime = System.currentTimeMillis();
}
try {
voltclient.drain();
} catch (InterruptedException e) {
m_logger.error(e.toString());
System.exit(-1);
} catch (NoConnectionsException e) {
m_logger.error(e.toString());
System.exit(-1);
}
try {
voltclient.close();
} catch (Exception e) {
m_logger.error(e.toString());
System.exit(-1);
}
}
use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class DeletesClient method collectStats.
static void collectStats(Client client) {
try {
ClientResponse resp = client.callProcedure("@Statistics", "management", 0);
parseStats(resp);
} catch (NoConnectionsException e) {
System.err.println("Lost connection to database, terminating");
System.exit(-1);
} catch (IOException e) {
e.printStackTrace();
} catch (ProcCallException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class MatchChecks method doAdHoc.
static ClientResponse doAdHoc(Client client, String query) {
/* a very similar method is used in txnid2::txnidutils, try to keep them in sync */
Boolean sleep = false;
Boolean noConnections = false;
Boolean timedOutOnce = false;
while (true) {
try {
ClientResponse cr = client.callProcedure("@AdHoc", query);
if (cr.getStatus() == ClientResponse.SUCCESS) {
return cr;
} else {
log.debug(cr.getStatusString());
log.error("unexpected response");
System.exit(-1);
}
} catch (NoConnectionsException e) {
noConnections = true;
} catch (IOException e) {
log.error("IOException", e);
System.exit(-1);
} catch (ProcCallException e) {
ClientResponse cr = e.getClientResponse();
String ss = cr.getStatusString();
log.debug(ss);
if (!timedOutOnce && ss.matches("(?s).*No response received in the allotted time.*")) /* allow a generic timeout but only once so that we don't risk masking error conditions */
{
//false;
timedOutOnce = false;
sleep = true;
} else if (/*cr.getStatus() == ClientResponse.USER_ABORT &&*/
(ss.matches("(?s).*AdHoc transaction -?[0-9]+ wasn.t planned against the current catalog version.*") || ss.matches(".*Connection to database host \\(.*\\) was lost before a response was received.*") || ss.matches(".*Transaction dropped due to change in mastership. It is possible the transaction was committed.*") || ss.matches("(?s).*Transaction being restarted due to fault recovery or shutdown.*") || ss.matches("(?s).*Invalid catalog update. Catalog or deployment change was planned against one version of the cluster configuration but that version was no longer live.*"))) {
} else if (ss.matches(".*Server is currently unavailable; try again later.*") || ss.matches(".*Server is paused.*") || ss.matches("(?s).*Server is shutting down.*")) {
sleep = true;
} else {
log.error("Unexpected ProcCallException", e);
System.exit(-1);
}
}
if (sleep | noConnections) {
try {
Thread.sleep(3000);
} catch (Exception f) {
}
sleep = false;
if (noConnections)
while (client.getConnectedHostList().size() == 0) ;
noConnections = false;
}
}
}
Aggregations