Search in sources :

Example 11 with VoltAbortException

use of org.voltdb.VoltProcedure.VoltAbortException in project voltdb by VoltDB.

the class Site method loadTable.

@Override
public byte[] loadTable(long txnId, long spHandle, long uniqueId, 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, uniqueId, table.getRelativeIndex(), data, returnUniqueViolations, shouldDRStream, undo);
}
Also used : VoltTable(org.voltdb.VoltTable) Table(org.voltdb.catalog.Table) Database(org.voltdb.catalog.Database) Cluster(org.voltdb.catalog.Cluster) VoltAbortException(org.voltdb.VoltProcedure.VoltAbortException)

Example 12 with VoltAbortException

use of org.voltdb.VoltProcedure.VoltAbortException in project voltdb by VoltDB.

the class TRURTruncateTable method run.

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;
}
Also used : VoltTable(org.voltdb.VoltTable) VoltTableRow(org.voltdb.VoltTableRow) VoltAbortException(org.voltdb.VoltProcedure.VoltAbortException)

Aggregations

VoltAbortException (org.voltdb.VoltProcedure.VoltAbortException)12 VoltTable (org.voltdb.VoltTable)8 VoltTableRow (org.voltdb.VoltTableRow)5 ClientResponse (org.voltdb.client.ClientResponse)3 SerializableException (org.voltdb.exceptions.SerializableException)3 IOException (java.io.IOException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ExecutionException (java.util.concurrent.ExecutionException)2 NoConnectionsException (org.voltdb.client.NoConnectionsException)2 ProcCallException (org.voltdb.client.ProcCallException)2 EEException (org.voltdb.exceptions.EEException)2 SpecifiedException (org.voltdb.exceptions.SpecifiedException)2 File (java.io.File)1 InterruptedIOException (java.io.InterruptedIOException)1 Method (java.lang.reflect.Method)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Set (java.util.Set)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ExecutorService (java.util.concurrent.ExecutorService)1