Package org.voltdb.messaging

Examples of org.voltdb.messaging.InitiateResponseMessage


        boolean dr = ((message instanceof TransactionInfoBaseMessage &&
                ((TransactionInfoBaseMessage)message).isForDR()));

        if (dr) {
            sequenceWithTxnId = ((TransactionInfoBaseMessage)message).getOriginalTxnId();
            InitiateResponseMessage dupe = m_replaySequencer.dedupe(sequenceWithTxnId,
                    (TransactionInfoBaseMessage) message);
            if (dupe != null) {
                canDeliver = false;
                // Duplicate initiate task message, send response
                m_mailbox.send(dupe.getInitiatorHSId(), dupe);
            }
            else {
                m_replaySequencer.updateLastSeenTxnId(sequenceWithTxnId,
                        (TransactionInfoBaseMessage) message);
                canDeliver = true;
View Full Code Here


    public static void logInitiatorRxMsg(VoltMessage msg, long localHSId)
    {
        if (IV2_TRACE_ENABLED) {
            if (msg instanceof InitiateResponseMessage) {
                InitiateResponseMessage iresp = (InitiateResponseMessage)msg;
                String logmsg = "rxInitRsp %s from %s ciHandle %s txnId %s spHandle %s status %s";
                iv2log.trace(String.format(logmsg, CoreUtils.hsIdToString(localHSId),
                            CoreUtils.hsIdToString(iresp.m_sourceHSId),
                            ClientInterfaceHandleManager.handleToString(iresp.getClientInterfaceHandle()),
                            txnIdToString(iresp.getTxnId()),
                            txnIdToString(iresp.getSpHandle()),
                            respStatusToString(iresp.getClientResponseData().getStatus())));
            }
            else if (msg instanceof FragmentResponseMessage) {
                FragmentResponseMessage fresp = (FragmentResponseMessage)msg;
                String logmsg = "rxFragRsp %s from %s txnId %s spHandle %s status %s";
                iv2log.trace(String.format(logmsg, CoreUtils.hsIdToString(localHSId),
View Full Code Here

            final VoltMessage task)
    {
        final InitiateTaskMessage itask = (InitiateTaskMessage)task;
        final ProcedureRunner runner = m_loadedProcedures.procs.get(itask.getStoredProcedureName());

        final InitiateResponseMessage response = new InitiateResponseMessage(itask);

        // feasible to receive a transaction initiated with an earlier catalog.
        if (runner == null) {
            response.setResults(
                new ClientResponseImpl(ClientResponse.GRACEFUL_FAILURE,
                                       new VoltTable[] {},
                                       "Procedure does not exist: " + itask.getStoredProcedureName()));
        }
        else {
            try {
                Object[] callerParams = null;
                /*
                 * Parameters are lazily deserialized. We may not find out until now
                 * that the parameter set is corrupt
                 */
                try {
                    callerParams = itask.getParameters();
                } 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="
                                    + itask.getStoredProcedureName() + "\n"
                                    + result.toString()));
                }
                if (callerParams != null) {
                    ClientResponseImpl cr = null;

                    // call the proc
                    runner.setupTransaction(txnState);
                    cr = runner.call(itask.getParameters());
                    txnState.setHash(cr.getHash());
                    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 ((!itask.isReadOnly()) && itask.isSinglePartition()) {
                        txnState.storeResults(cr);
                    }
                }
            }
            catch (final ExpectedProcedureException e) {
                log.l7dlog( Level.TRACE, LogKeys.org_voltdb_ExecutionSite_ExpectedProcedureException.name(), e);
                response.setResults(
                                    new ClientResponseImpl(
                                                           ClientResponse.GRACEFUL_FAILURE,
                                                           new VoltTable[]{},
                                                           e.toString()));
            }
View Full Code Here

    /** Mostly copy-paste of old ExecutionSite.processInitiateTask() */
    protected InitiateResponseMessage processInitiateTask(Iv2InitiateTaskMessage task,
            SiteProcedureConnection siteConnection)
    {
        final InitiateResponseMessage response = new InitiateResponseMessage(task);

        try {
            Object[] callerParams = null;
            /*
             * Parameters are lazily deserialized. We may not find out until now
             * that the parameter set is corrupt
             */
            try {
                callerParams = task.getParameters();
            } 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()));
        }
View Full Code Here

            @Override
            public void deliver(final VoltMessage message) {
                if (message instanceof InitiateResponseMessage) {
                    final CatalogContext catalogContext = m_catalogContext.get();
                    // forward response; copy is annoying. want slice of response.
                    InitiateResponseMessage response = (InitiateResponseMessage)message;
                    StoredProcedureInvocation invocation = response.getInvocation();
                    Iv2Trace.logFinishTransaction(response, m_mailbox.getHSId());
                    ClientInterfaceHandleManager cihm = m_cihm.get(response.getClientConnectionId());
                    Procedure procedure = null;

                    if (invocation != null) {
                        procedure = catalogContext.procedures.get(invocation.getProcName());
                        if (procedure == null) {
View Full Code Here

            m_txnState.setBeginUndoToken(siteConnection.getLatestUndoToken());
        }

        // cast up here .. ugly.
        SpTransactionState txnState = (SpTransactionState)m_txnState;
        final InitiateResponseMessage response = processInitiateTask(txnState.m_initiationMsg, siteConnection);
        if (!response.shouldCommit()) {
            m_txnState.setNeedsRollback();
        }
        completeInitiateTask(siteConnection);
        response.m_sourceHSId = m_initiator.getHSId();
        m_initiator.deliver(response);
View Full Code Here

        if (!m_txnState.isReadOnly()) {
            taskLog.logTask(m_txnState.getNotice());
        }

        SpTransactionState txnState = (SpTransactionState)m_txnState;
        final InitiateResponseMessage response =
            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

            m_txnState.setBeginUndoToken(siteConnection.getLatestUndoToken());
        }

        // cast up here .. ugly.
        SpTransactionState txnState = (SpTransactionState)m_txnState;
        final InitiateResponseMessage response = processInitiateTask(txnState.m_initiationMsg, siteConnection);
        if (!response.shouldCommit()) {
            m_txnState.setNeedsRollback();
        }
        if (!m_txnState.isReadOnly()) {
            assert(siteConnection.getLatestUndoToken() != Site.kInvalidUndoToken) :
                "[SP][RW] transaction found invalid latest undo token state in Iv2ExecutionSite.";
View Full Code Here

TOP

Related Classes of org.voltdb.messaging.InitiateResponseMessage

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.