本文整理汇总了Java中org.voltdb.VoltProcedure.VoltAbortException类的典型用法代码示例。如果您正苦于以下问题:Java VoltAbortException类的具体用法?Java VoltAbortException怎么用?Java VoltAbortException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VoltAbortException类属于org.voltdb.VoltProcedure包,在下文中一共展示了VoltAbortException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadTable
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
/**
* Load a VoltTable directly into the EE at this partition.
* <B>NOTE:</B> This should only be invoked by a system stored procedure.
* @param txn_id
* @param clusterName
* @param databaseName
* @param tableName
* @param data
* @param allowELT
* @throws VoltAbortException
*/
public void loadTable(AbstractTransaction ts, String clusterName, String databaseName, String tableName, VoltTable data, int allowELT) throws VoltAbortException {
Table table = this.catalogContext.database.getTables().getIgnoreCase(tableName);
if (table == null) {
throw new VoltAbortException("Table '" + tableName + "' does not exist in database " + clusterName + "." + databaseName);
}
if (data == null || data.getRowCount() == 0) {
return;
}
if (debug.val)
LOG.debug(String.format("Loading %d row(s) into %s [txnId=%d]",
data.getRowCount(), table.getName(), ts.getTransactionId()));
ts.markExecutedWork(this.partitionId);
this.ee.loadTable(table.getRelativeIndex(), data,
ts.getTransactionId(),
this.lastCommittedTxnId.longValue(),
ts.getLastUndoToken(this.partitionId),
allowELT != 0);
}
示例2: loadTable
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
@Override
public byte[] loadTable(long txnId, long spHandle, String clusterName, String databaseName,
String tableName, VoltTable data,
boolean returnUniqueViolations, boolean shouldDRStream, boolean undo) throws VoltAbortException
{
Cluster cluster = m_context.cluster;
if (cluster == null) {
throw new VoltAbortException("cluster '" + clusterName + "' does not exist");
}
Database db = cluster.getDatabases().get(databaseName);
if (db == null) {
throw new VoltAbortException("database '" + databaseName + "' does not exist in cluster " + clusterName);
}
Table table = db.getTables().getIgnoreCase(tableName);
if (table == null) {
throw new VoltAbortException("table '" + tableName + "' does not exist in database " + clusterName + "." + databaseName);
}
return loadTable(txnId, spHandle, table.getRelativeIndex(), data, returnUniqueViolations, shouldDRStream, undo);
}
示例3: voltLoadTable
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
public byte[] voltLoadTable(String clusterName, String databaseName,
String tableName, VoltTable data, boolean returnUniqueViolations, boolean shouldDRStream)
throws VoltAbortException
{
if (data == null || data.getRowCount() == 0) {
return null;
}
try {
return m_site.loadTable(m_txnState.txnId, m_txnState.m_spHandle,
clusterName, databaseName,
tableName, data, returnUniqueViolations, shouldDRStream, false);
}
catch (EEException e) {
throw new VoltAbortException("Failed to load table: " + tableName);
}
}
示例4: run
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
public VoltTable[] run(long p, byte shouldRollback) {
voltQueueSQL(truncate);
voltQueueSQL(count);
voltQueueSQL(scancount);
VoltTable[] results = voltExecuteSQL(true);
VoltTable data = results[1];
VoltTableRow row = data.fetchRow(0);
long optCount = row.getLong(0);
if (optCount != 0) {
throw new VoltAbortException("after truncate (opt) count not zero");
}
data = results[2];
row = data.fetchRow(0);
long scanCount = row.getLong(0);
if (scanCount != 0) {
throw new VoltAbortException("after truncate (scan) count not zero");
}
if (shouldRollback != 0) {
throw new VoltAbortException("EXPECTED ROLLBACK");
}
return results;
}
示例5: run
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
public VoltTable[] run(byte cid) {
voltQueueSQL(d_getCount, cid);
VoltTable[] results = voltExecuteSQL(false);
VoltTable dim = results[0];
long rowCount = dim.getRowCount();
if (rowCount != 1) {
throw new VoltAbortException(getClass().getName() +
" invalid row count " + rowCount + " for count query" +
" on dimension table for cid " + cid);
}
VoltTableRow row = dim.fetchRow(0);
long c = row.getLong(0);
switch ((int)c) {
case 0:
voltQueueSQL(d_Insert, cid, cid);
results = voltExecuteSQL(true);
case 1:
return new VoltTable[] {};
default:
throw new VoltAbortException(getClass().getName() +
" invalid count " + c + " of dimension rows" +
" for cid " + cid);
}
}
示例6: loadTable
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
@Override
public byte[] loadTable(long txnId, long spHandle, String clusterName, String databaseName,
String tableName, VoltTable data, boolean returnUniqueViolations, boolean shouldDRStream,
boolean undo) throws VoltAbortException
{
throw new RuntimeException("RO MP Site doesn't do this, shouldn't be here.");
}
示例7: fail
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
static void fail(String procedureName, SQLStmt stmt, int batchIndex,
String errMsg) throws VoltAbortException {
String fullMsg = "Expectation failing in procedure: " + procedureName + "\n";
fullMsg += " Running SQL: " + stmt.getText() + "\n";
fullMsg += " Error message: " + errMsg;
throw new VoltAbortException(fullMsg);
}
示例8: loadTable
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
/**
* loadTable method used by user-facing voltLoadTable() call in ProcedureRunner
*/
public byte[] loadTable(
long txnId,
long spHandle,
String clusterName,
String databaseName,
String tableName,
VoltTable data,
boolean returnUniqueViolations,
boolean shouldDRStream,
boolean undo)
throws VoltAbortException;
示例9: run
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
public VoltTable[] run(long p, byte shouldRollback) {
voltQueueSQL(max);
VoltTable[] results = voltExecuteSQL(true);
if (results[0].getRowCount() != 1) {
throw new VoltAbortException("rowcount for max is not one");
}
if (shouldRollback != 0) {
throw new VoltAbortException("EXPECTED ROLLBACK");
}
return results;
}
示例10: getCleanParams
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
private final ParameterSet getCleanParams(SQLStmt stmt, Object... inArgs) {
final int numParamTypes = stmt.statementParamJavaTypes.length;
final byte stmtParamTypes[] = stmt.statementParamJavaTypes;
final Object[] args = new Object[numParamTypes];
if (inArgs.length != numParamTypes) {
throw new VoltAbortException(
"Number of arguments provided was " + inArgs.length +
" where " + numParamTypes + " was expected for statement " + stmt.getText());
}
for (int ii = 0; ii < numParamTypes; ii++) {
// this handles non-null values
if (inArgs[ii] != null) {
args[ii] = inArgs[ii];
continue;
}
// this handles null values
VoltType type = VoltType.get(stmtParamTypes[ii]);
if (type == VoltType.TINYINT) {
args[ii] = Byte.MIN_VALUE;
} else if (type == VoltType.SMALLINT) {
args[ii] = Short.MIN_VALUE;
} else if (type == VoltType.INTEGER) {
args[ii] = Integer.MIN_VALUE;
} else if (type == VoltType.BIGINT) {
args[ii] = Long.MIN_VALUE;
} else if (type == VoltType.FLOAT) {
args[ii] = VoltType.NULL_FLOAT;
} else if (type == VoltType.TIMESTAMP) {
args[ii] = new TimestampType(Long.MIN_VALUE);
} else if (type == VoltType.STRING) {
args[ii] = VoltType.NULL_STRING_OR_VARBINARY;
} else if (type == VoltType.VARBINARY) {
args[ii] = VoltType.NULL_STRING_OR_VARBINARY;
} else if (type == VoltType.DECIMAL) {
args[ii] = VoltType.NULL_DECIMAL;
} else {
throw new VoltAbortException("Unknown type " + type +
" can not be converted to NULL representation for arg " + ii +
" for SQL stmt: " + stmt.getText());
}
}
return ParameterSet.fromArrayNoCopy(args);
}
示例11: check
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
static void check(String procedureName, SQLStmt stmt, int batchIndex,
Expectation expectation, VoltTable table) throws VoltAbortException {
if (expectation == null)
return;
assert(table != null);
int rowCount = table.getRowCount();
switch (expectation.m_type) {
case EXPECT_EMPTY:
if (rowCount != 0) {
fail(procedureName, stmt, batchIndex,
String.format("Expected zero row, but got %d", rowCount));
}
return;
case EXPECT_ONE_ROW:
if (rowCount != 1) {
fail(procedureName, stmt, batchIndex,
String.format("Expected one row, but got %d", rowCount));
}
return;
case EXPECT_ZERO_OR_ONE_ROW:
if (rowCount > 1) {
fail(procedureName, stmt, batchIndex,
String.format("Expected zero or one rows, but got %d", rowCount));
}
return;
case EXPECT_NON_EMPTY:
if (rowCount == 0) {
fail(procedureName, stmt, batchIndex,
String.format("Expected one or more rows, but got %d", rowCount));
}
return;
case EXPECT_SCALAR:
if (checkScalar(table) == false) {
fail(procedureName, stmt, batchIndex, "Expected scalar value");
}
return;
case EXPECT_SCALAR_LONG:
if (checkScalarLong(table) == false) {
fail(procedureName, stmt, batchIndex, "Expected scalar long value");
}
return;
case EXPECT_SCALAR_MATCH:
if (checkScalarLong(table) == false) {
fail(procedureName, stmt, batchIndex, "Expected scalar long value");
}
if (table.asScalarLong() != expectation.m_scalar) {
fail(procedureName, stmt, batchIndex,
String.format("Expected scalar %d, but got %d", expectation.m_scalar, table.asScalarLong()));
}
return;
}
}
示例12: runOne
import org.voltdb.VoltProcedure.VoltAbortException; //导入依赖的package包/类
void runOne() throws Exception {
// 1/10th of txns roll back
byte shouldRollback = (byte) (m_random.nextInt(10) == 0 ? 1 : 0);
try {
String procName = null;
int expectedTables = 4;
switch (m_type) {
case PARTITIONED_SP:
procName = "UpdatePartitionedSP";
break;
case PARTITIONED_MP:
procName = "UpdatePartitionedMP";
expectedTables = 5;
break;
case REPLICATED:
procName = "UpdateReplicatedMP";
expectedTables = 5;
break;
case HYBRID:
procName = "UpdateBothMP";
expectedTables = 5;
break;
case ADHOC_MP:
procName = "UpdateReplicatedMPInProcAdHoc";
expectedTables = 5;
break;
}
byte[] payload = m_processor.generateForStore().getStoreValue();
ClientResponse response;
try {
response = m_client.callProcedure(procName,
m_cid,
m_nextRid,
payload,
shouldRollback);
} catch (Exception e) {
if (shouldRollback == 0) {
log.warn("ClientThread threw after " + m_txnsRun.get() +
" calls while calling procedure: " + procName +
" with args: cid: " + m_cid + ", nextRid: " + m_nextRid +
", payload: " + payload +
", shouldRollback: " + shouldRollback);
}
throw e;
}
// fake a proc call exception if we think one should be thrown
if (response.getStatus() != ClientResponse.SUCCESS) {
throw new UserProcCallException(response);
}
VoltTable[] results = response.getResults();
m_txnsRun.incrementAndGet();
if (results.length != expectedTables) {
hardStop(String.format(
"Client cid %d procedure %s returned %d results instead of %d",
m_cid, procName, results.length, expectedTables), response);
}
VoltTable data = results[3];
try {
UpdateBaseProc.validateCIDData(data, "ClientThread:" + m_cid);
}
catch (VoltAbortException vae) {
log.error("validateCIDData failed on: " + procName + ", shouldRollback: " +
shouldRollback + " data: " + data);
throw vae;
}
}
finally {
// ensure rid is incremented (if not rolled back intentionally)
if (shouldRollback == 0) {
m_nextRid++;
}
}
}