Package org.voltdb.exceptions

Examples of org.voltdb.exceptions.SpecifiedException


           status = ClientResponse.TXN_RESTART;
           msg.append("TRANSACTION RESTART\n");
       }
       // SpecifiedException means the dev wants control over status and message
       else if (e.getClass() == SpecifiedException.class) {
           SpecifiedException se = (SpecifiedException) e;
           status = se.getStatus();
           expected_failure = true;
           hideStackTrace = true;
       }
       else {
           msg.append("UNEXPECTED FAILURE:\n");
View Full Code Here


            Table table = tables.get(tableName);
            if (table == null) {
                String msg = String.format("@UpdateApplicationCatalog was checking to see if table %s was empty, " +
                                           "presumably as part of a schema change, and it failed to find the table " +
                                           "in the current catalog context.", tableName);
                throw new SpecifiedException(ClientResponse.UNEXPECTED_FAILURE, msg);
            }
            tableIds[i++] = table.getRelativeIndex();
        }

        // get the table stats for these tables from the EE
        final VoltTable[] s1 =
                context.getSiteProcedureConnection().getStats(StatsSelector.TABLE,
                                                              tableIds,
                                                              false,
                                                              getTransactionTime().getTime());
        if ((s1 == null) || (s1.length == 0)) {
            String tableNames = StringUtils.join(tablesThatMustBeEmpty, ", ");
            String msg = String.format("@UpdateApplicationCatalog was checking to see if tables (%s) were empty ," +
                                       "presumably as part of a schema change, but failed to get the row counts " +
                                       "from the native storage engine.", tableNames);
            throw new SpecifiedException(ClientResponse.UNEXPECTED_FAILURE, msg);
        }
        VoltTable stats = s1[0];
        SortedSet<String> nonEmptyTables = new TreeSet<String>();

        // find all empty tables
        while (stats.advanceRow()) {
            long tupleCount = stats.getLong("TUPLE_COUNT");
            String tableName = stats.getString("TABLE_NAME");
            if (tupleCount > 0) {
                nonEmptyTables.add(tableName);
            }
        }

        // return an error containing the names of all non-empty tables
        // via the propagated reasons why each needs to be empty
        if (!nonEmptyTables.isEmpty()) {
            String msg = "Unable to make requested schema change:\n";
            for (i = 0; i < tablesThatMustBeEmpty.length; ++i) {
                if (nonEmptyTables.contains(tablesThatMustBeEmpty[i])) {
                    msg += reasonsForEmptyTables[i] + "\n";
                }
            }
            throw new SpecifiedException(ClientResponse.GRACEFUL_FAILURE, msg);
        }
    }
View Full Code Here

TOP

Related Classes of org.voltdb.exceptions.SpecifiedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.