private void handleBorrowTaskMessage(BorrowTaskMessage message) {
        // borrows do not advance the sp handle. The handle would
        // move backwards anyway once the next message is received
        // from the SP leader.
        long newSpHandle = getMaxScheduledTxnSpHandle();
        Iv2Trace.logFragmentTaskMessage(message.getFragmentTaskMessage(),
                m_mailbox.getHSId(), newSpHandle, true);
        final VoltTrace.TraceEventBatch traceLog = VoltTrace.log(VoltTrace.Category.SPI);
        if (traceLog != null) {
            traceLog.add(() -> VoltTrace.beginAsync("recvfragment",
                                                    MiscUtils.hsIdPairTxnIdToString(m_mailbox.getHSId(), m_mailbox.getHSId(), newSpHandle, 0),
                                                    "txnId", TxnEgo.txnIdToString(message.getTxnId()),
                                                    "partition", m_partitionId,
                                                    "hsId", CoreUtils.hsIdToString(m_mailbox.getHSId())));
        }

        TransactionState txn = m_outstandingTxns.get(message.getTxnId());

        if (txn == null) {
            // If the borrow is the first fragment for a transaction, run it as
            // a single partition fragment; Must not  engage/pause this
            // site on a MP transaction before the SP instructs to do so.
            // Do not track the borrow task as outstanding - it completes
            // immediately and is not a valid transaction state for
            // full MP participation (it claims everything can run as SP).
            txn = new BorrowTransactionState(newSpHandle, message);
        }

        // BorrowTask is a read only task embedded in a MP transaction
        // and its response (FragmentResponseMessage) should not be buffered
        if (message.getFragmentTaskMessage().isSysProcTask()) {
            final SysprocBorrowedTask task =
                new SysprocBorrowedTask(m_mailbox, (ParticipantTransactionState)txn,
                                        m_pendingTasks, message.getFragmentTaskMessage(),
                                        message.getInputDepMap());
            task.setResponseNotBufferable();
            m_pendingTasks.offer(task);
        }
        else {
            final BorrowedTask task =
                new BorrowedTask(m_mailbox, (ParticipantTransactionState)txn,
                        m_pendingTasks, message.getFragmentTaskMessage(),
                        message.getInputDepMap());
            task.setResponseNotBufferable();
            m_pendingTasks.offer(task);
        }
    }
private void handleBorrowTaskMessage ( BorrowTaskMessage message ) { long newSpHandle = getMaxScheduledTxnSpHandle ( ) ; Iv2Trace . logFragmentTaskMessage ( message . getFragmentTaskMessage ( ) , m_mailbox . getHSId ( ) , newSpHandle , true ) ; final VoltTrace . TraceEventBatch traceLog = VoltTrace . log ( VoltTrace . Category . SPI ) ; if ( traceLog != null ) { traceLog . add ( ( ) -> VoltTrace . beginAsync ( "recvfragment" , MiscUtils . hsIdPairTxnIdToString ( m_mailbox . getHSId ( ) , m_mailbox . getHSId ( ) , newSpHandle , 0 ) , "txnId" , TxnEgo . txnIdToString ( message . getTxnId ( ) ) , "partition" , m_partitionId , "hsId" , CoreUtils . hsIdToString ( m_mailbox . getHSId ( ) ) ) ) ; } TransactionState txn = m_outstandingTxns . get ( message . getTxnId ( ) ) ; if ( txn == null ) { txn = new BorrowTransactionState ( newSpHandle , message ) ; } if ( message . getFragmentTaskMessage ( ) . isSysProcTask ( ) ) { final SysprocBorrowedTask task = new SysprocBorrowedTask ( m_mailbox , ( ParticipantTransactionState ) txn , m_pendingTasks , message . getFragmentTaskMessage ( ) , message . getInputDepMap ( ) ) ; task . setResponseNotBufferable ( ) ; m_pendingTasks . offer ( task ) ; } else { final BorrowedTask task = new BorrowedTask ( m_mailbox , ( ParticipantTransactionState ) txn , m_pendingTasks , message . getFragmentTaskMessage ( ) , message . getInputDepMap ( ) ) ; task . setResponseNotBufferable ( ) ; m_pendingTasks . offer ( task ) ; } }
to perform replicated reads or aggregation fragment work.