Package org.voltdb

Examples of org.voltdb.ClientResponseImpl


        try {
            PartitionSingleExecuteProcedureCallback cbmt =
                    new PartitionSingleExecuteProcedureCallback(metaData);
            if (!m_client.callProcedure(cbmt, m_insertProcedure, values)) {
                m_log.fatal("Failed to send CSV insert to VoltDB cluster.");
                ClientResponse response = new ClientResponseImpl(ClientResponseImpl.SERVER_UNAVAILABLE,
                        new VoltTable[0], "Failed to call procedure.", 0);
                m_errHandler.handleError(metaData, response, "Failed to call procedure.");
            }
        } catch (NoConnectionsException ex) {
            ClientResponse response = new ClientResponseImpl(ClientResponseImpl.SERVER_UNAVAILABLE,
                    new VoltTable[0], "Failed to call procedure.", 0);
            m_errHandler.handleError(metaData, response, "Failed to call procedure.");
        } catch (IOException ex) {
            ClientResponse response = new ClientResponseImpl(ClientResponseImpl.SERVER_UNAVAILABLE,
                    new VoltTable[0], "Failed to call procedure.", 0);
            m_errHandler.handleError(metaData, response, "Failed to call procedure.");
        } catch (Exception ex) {
            m_errHandler.handleError(metaData, null, ex.toString());
        }
View Full Code Here


        results = client.callProcedure("@AdHoc", "delete from R1IX").getResults();
    }

    public void testKeyCastingOverflow() throws NoConnectionsException, IOException, ProcCallException {
        Client client = getClient();
        ClientResponseImpl cr =
               (ClientResponseImpl) client.callProcedure("@AdHoc",
                                                         "select * from P1 where ID = 6000000000;", 0);
        assertEquals(cr.getStatus(), ClientResponse.SUCCESS);
    }
View Full Code Here

            } catch (RuntimeException e) {
                Writer result = new StringWriter();
                PrintWriter pw = new PrintWriter(result);
                e.printStackTrace(pw);
                response.setResults(
                        new ClientResponseImpl(ClientResponse.GRACEFUL_FAILURE,
                            new VoltTable[] {},
                                "Exception while deserializing procedure params, procedure="
                                + m_procName + "\n"
                                + result.toString()));
            }
            if (callerParams != null) {
                ClientResponseImpl cr = null;
                ProcedureRunner runner = siteConnection.getProcedureRunner(m_procName);
                if (runner == null) {
                    String error =
                        "Procedure " + m_procName + " is not present in the catalog. "  +
                        "This can happen if a catalog update removing the procedure occurred " +
                        "after the procedure was submitted " +
                        "but before the procedure was executed.";
                    RateLimitedLogger.tryLogForMessage(
                            System.currentTimeMillis(),
                            60, TimeUnit.SECONDS,
                            hostLog,
                            Level.WARN, error + " %s", "This log message is rate limited to once every 60 seconds.");
                    response.setResults(
                            new ClientResponseImpl(
                                ClientResponse.UNEXPECTED_FAILURE,
                                new VoltTable[]{},
                                error));
                    return response;
                }

                // Check partitioning of single-partition and n-partition transactions.
                if (runner.checkPartition(m_txnState, siteConnection.getCurrentHashinator())) {
                    runner.setupTransaction(m_txnState);
                    cr = runner.call(callerParams);

                    m_txnState.setHash(cr.getHash());
                    //Don't pay the cost of returning the result tables for a replicated write
                    //With reads don't apply the optimization just in case
//                    if (!task.shouldReturnResultTables() && !task.isReadOnly()) {
//                        cr.dropResultTable();
//                    }

                    response.setResults(cr);
                    // record the results of write transactions to the transaction state
                    // this may be used to verify the DR replica cluster gets the same value
                    // skip for multi-partition txns because only 1 of k+1 partitions will
                    //  have the real results
                    if ((!task.isReadOnly()) && task.isSinglePartition()) {
                        m_txnState.storeResults(cr);
                    }
                } else {
                    // mis-partitioned invocation, reject it and let the ClientInterface restart it
                    response.setMispartitioned(true, task.getStoredProcedureInvocation(),
                                               TheHashinator.getCurrentVersionedConfig());
                }
            }
        }
        catch (final ExpectedProcedureException e) {
            execLog.l7dlog( Level.TRACE, LogKeys.org_voltdb_ExecutionSite_ExpectedProcedureException.name(), e);
            response.setResults(
                    new ClientResponseImpl(
                        ClientResponse.GRACEFUL_FAILURE,
                        new VoltTable[]{},
                        e.toString()));
        }
        catch (final Exception e) {
View Full Code Here

        }
    }

    int offer(InitiateResponseMessage message)
    {
        ClientResponseImpl r = message.getClientResponseData();
        // get the hash of sql run
        long hash = 0;
        Integer sqlHash = r.getHash();
        if (sqlHash != null) {
            hash = sqlHash.intValue();
        }
        return checkCommon(hash, message.isRecovering(), r.getResults(), message);
    }
View Full Code Here

            new InitiateResponseMessage(txnState.m_initiationMsg);
        response.m_sourceHSId = m_initiator.getHSId();
        response.setRecovering(true);

        // add an empty dummy response
        response.setResults(new ClientResponseImpl(
                    ClientResponse.SUCCESS,
                    new VoltTable[0],
                    null));

        m_initiator.deliver(response);
View Full Code Here

TOP

Related Classes of org.voltdb.ClientResponseImpl

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.