Search in sources :

Example 26 with StoredProcedureInvocation

use of org.voltdb.StoredProcedureInvocation in project voltdb by VoltDB.

the class ReplaySequencer method dedupe.

/**
     * Dedupe initiate task messages. Check if the initiate task message is seen before.
     *
     * @param inUniqueId The uniqueId of the message
     * @param in The initiate task message
     * @return A client response to return if it's a duplicate, otherwise null.
     */
public InitiateResponseMessage dedupe(long inUniqueId, TransactionInfoBaseMessage in) {
    if (in instanceof Iv2InitiateTaskMessage) {
        final Iv2InitiateTaskMessage init = (Iv2InitiateTaskMessage) in;
        final StoredProcedureInvocation invocation = init.getStoredProcedureInvocation();
        final String procName = invocation.getProcName();
        /*
             * Ning - @LoadSinglepartTable and @LoadMultipartTable always have the same txnId
             * which is the txnId of the snapshot.
             */
        if (!(procName.equalsIgnoreCase("@LoadSinglepartitionTable") || procName.equalsIgnoreCase("@LoadMultipartitionTable")) && inUniqueId <= m_lastSeenUniqueId) {
            // already sequenced
            final InitiateResponseMessage resp = new InitiateResponseMessage(init);
            resp.setResults(new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE, new VoltTable[0], ClientResponseImpl.IGNORED_TRANSACTION));
            return resp;
        }
    }
    return null;
}
Also used : StoredProcedureInvocation(org.voltdb.StoredProcedureInvocation) Iv2InitiateTaskMessage(org.voltdb.messaging.Iv2InitiateTaskMessage) InitiateResponseMessage(org.voltdb.messaging.InitiateResponseMessage) ClientResponseImpl(org.voltdb.ClientResponseImpl) VoltTable(org.voltdb.VoltTable)

Example 27 with StoredProcedureInvocation

use of org.voltdb.StoredProcedureInvocation in project voltdb by VoltDB.

the class RandomMsgGenerator method makeIv2InitiateTaskMsg.

private Iv2InitiateTaskMessage makeIv2InitiateTaskMsg(boolean readOnly, boolean binaryLog, boolean isMp) {
    StoredProcedureInvocation spi = mock(StoredProcedureInvocation.class);
    ParameterSet ps = mock(ParameterSet.class);
    when(spi.getParams()).thenReturn(ps);
    if (binaryLog) {
        when(ps.toArray()).thenReturn(new Object[] { null, 0l, 0l, Long.MIN_VALUE, Long.MIN_VALUE, null });
        if (!isMp) {
            when(spi.getProcName()).thenReturn("@ApplyBinaryLogSP");
        } else {
            when(spi.getProcName()).thenReturn("@ApplyBinaryLogMP");
        }
    } else {
        when(ps.toArray()).thenReturn(new Object[] { null, 0l, 0l, Long.MIN_VALUE, null });
        when(spi.getProcName()).thenReturn("dummy");
    }
    Iv2InitiateTaskMessage msg = new Iv2InitiateTaskMessage(0l, 0l, 0l, Long.MIN_VALUE, 0l, readOnly, !isMp, spi, 0l, 0l, false);
    return msg;
}
Also used : ParameterSet(org.voltdb.ParameterSet) StoredProcedureInvocation(org.voltdb.StoredProcedureInvocation) Iv2InitiateTaskMessage(org.voltdb.messaging.Iv2InitiateTaskMessage)

Example 28 with StoredProcedureInvocation

use of org.voltdb.StoredProcedureInvocation in project voltdb by VoltDB.

the class TestProcedureInvocation method testRoundTrip.

/** Mimic the de/ser path from client to client interface */
public void testRoundTrip() throws Exception {
    assertEquals(10, pi.getHandle());
    ByteBuffer buf = ByteBuffer.allocate(pi.getSerializedSize());
    try {
        pi.flattenToBuffer(buf);
    } catch (IOException e) {
        e.printStackTrace();
        fail();
    }
    buf.flip();
    StoredProcedureInvocation spi = new StoredProcedureInvocation();
    try {
        spi.initFromBuffer(buf);
    } catch (IOException e) {
        e.printStackTrace();
        fail();
    }
    verifySpi(spi);
}
Also used : StoredProcedureInvocation(org.voltdb.StoredProcedureInvocation) IOException(java.io.IOException) ByteBuffer(java.nio.ByteBuffer)

Aggregations

StoredProcedureInvocation (org.voltdb.StoredProcedureInvocation)28 Iv2InitiateTaskMessage (org.voltdb.messaging.Iv2InitiateTaskMessage)13 Test (org.junit.Test)8 Mailbox (org.voltcore.messaging.Mailbox)7 SiteProcedureConnection (org.voltdb.SiteProcedureConnection)6 FragmentResponseMessage (org.voltdb.messaging.FragmentResponseMessage)6 ArrayList (java.util.ArrayList)4 List (java.util.List)4 ClientResponseImpl (org.voltdb.ClientResponseImpl)4 VoltTable (org.voltdb.VoltTable)4 ByteBuffer (java.nio.ByteBuffer)3 IOException (java.io.IOException)2 ParameterSet (org.voltdb.ParameterSet)2 EEException (org.voltdb.exceptions.EEException)2 FragmentTaskMessage (org.voltdb.messaging.FragmentTaskMessage)2 BorrowTaskMessage (org.voltdb.messaging.BorrowTaskMessage)1 InitiateResponseMessage (org.voltdb.messaging.InitiateResponseMessage)1