Examples of Iv2InitiateTaskMessage


Examples of org.voltdb.messaging.Iv2InitiateTaskMessage

    public void testReplicaInitiateTaskResponseShortCircuitRead() throws Exception
    {
        long txnid = TxnEgo.makeZero(0).getTxnId();

        createObjs();
        Iv2InitiateTaskMessage sptask = createMsg(txnid, true, true, dut_hsid);
        sptask.setSpHandle(txnid);
        dut.deliver(sptask);
        // verify no response sent yet
        verify(mbox, times(0)).send(anyLong(), (VoltMessage)anyObject());
        verify(mbox, times(0)).send(new long[] {anyLong()}, (VoltMessage)anyObject());
        InitiateResponseMessage resp = new InitiateResponseMessage(sptask);
View Full Code Here

Examples of org.voltdb.messaging.Iv2InitiateTaskMessage

        long primary_hsid = 1111l;

        createObjs();
        dut.setLeaderState(true);
        dut.updateReplicas(new ArrayList<Long>(), null);
        Iv2InitiateTaskMessage sptask = createMsg(txnid, true, true, primary_hsid);
        dut.deliver(sptask);
        // verify no response sent yet
        verify(mbox, times(0)).send(anyLong(), (VoltMessage)anyObject());
        verify(mbox, times(0)).send(new long[] {anyLong()}, (VoltMessage)anyObject());
        InitiateResponseMessage resp = new InitiateResponseMessage(sptask);
View Full Code Here

Examples of org.voltdb.messaging.Iv2InitiateTaskMessage

        createObjs();
        dut.setLeaderState(true);
        List<Long> replicas = new ArrayList<Long>();
        replicas.add(2l);
        dut.updateReplicas(replicas, null);
        Iv2InitiateTaskMessage sptask = createMsg(txnid, false, true, primary_hsid);
        dut.deliver(sptask);
        verify(mbox, times(0)).send(anyLong(), (VoltMessage)anyObject());
        // Capture the InitiateTaskMessage that gets sent to the replica so we can test it,
        // use it for response construction, etc.
        ArgumentCaptor<Iv2InitiateTaskMessage> replmsg = ArgumentCaptor.forClass(Iv2InitiateTaskMessage.class);
View Full Code Here

Examples of org.voltdb.messaging.Iv2InitiateTaskMessage

        return makeIv2InitTask(unused, "Proc");
    }

    TransactionInfoBaseMessage makeIv2InitTask(long unused, String procName)
    {
        Iv2InitiateTaskMessage m = mock(Iv2InitiateTaskMessage.class);
        StoredProcedureInvocation invocation = mock(StoredProcedureInvocation.class);
        when(invocation.getProcName()).thenReturn(procName);
        when(m.getStoredProcedureInvocation()).thenReturn(invocation);
        when(m.isForReplay()).thenReturn(true);
        return m;
    }
View Full Code Here

Examples of org.voltdb.messaging.Iv2InitiateTaskMessage

        doReturn(VoltSystemProcedure.fragIdToHash(id)).when(msg).getPlanHash(anyInt());
        return msg;
    }

    private static Iv2InitiateTaskMessage makeInit(String procName)    {
        Iv2InitiateTaskMessage msg = mock(Iv2InitiateTaskMessage.class);
        doReturn(procName).when(msg).getStoredProcedureName();
        return msg;
    }
View Full Code Here

Examples of org.voltdb.messaging.Iv2InitiateTaskMessage

            ArgumentCaptor.forClass(Long.class);
        ArgumentCaptor<Iv2InitiateTaskMessage> messageCaptor =
            ArgumentCaptor.forClass(Iv2InitiateTaskMessage.class);
        verify(m_messenger).send(destinationCaptor.capture(), messageCaptor.capture());

        Iv2InitiateTaskMessage message = messageCaptor.getValue();
        assertEquals(isReadonly, message.isReadOnly()); // readonly
        assertEquals(isSinglePart, message.isSinglePartition()); // single-part
        assertEquals(procName, message.getStoredProcedureName());
        if (isSinglePart) {
            int expected = TheHashinator.getPartitionForParameter(VoltType.typeFromObject(partitionParam).getValue(),
                                                                  partitionParam);
            assertEquals(new Long(m_cartographer.getHSIdForMaster(expected)), destinationCaptor.getValue());
        } else {
View Full Code Here

Examples of org.voltdb.messaging.Iv2InitiateTaskMessage

        ArgumentCaptor<Long> destinationCaptor =
                ArgumentCaptor.forClass(Long.class);
        ArgumentCaptor<Iv2InitiateTaskMessage> messageCaptor =
                ArgumentCaptor.forClass(Iv2InitiateTaskMessage.class);
        verify(m_messenger).send(destinationCaptor.capture(), messageCaptor.capture());
        Iv2InitiateTaskMessage message = messageCaptor.getValue();

        assertTrue(message.isReadOnly())// readonly
        assertTrue(message.isSinglePartition()); // single-part
        assertEquals("@AdHoc_RO_SP", message.getStoredProcedureName());

        // SP AdHoc should have partitioning parameter serialized in the parameter set
        Object partitionParam = message.getStoredProcedureInvocation().getParameterAtIndex(0);
        assertTrue(partitionParam instanceof byte[]);
        VoltType type = VoltType.get((Byte) message.getStoredProcedureInvocation().getParameterAtIndex(1));
        assertTrue(type.isInteger());
        byte[] serializedData = (byte[]) message.getStoredProcedureInvocation().getParameterAtIndex(2);
        ByteBuffer buf = ByteBuffer.wrap(serializedData);
        Object[] parameters = AdHocPlannedStmtBatch.userParamsFromBuffer(buf);
        assertEquals(1, parameters.length);
        assertEquals(3, parameters[0]);
        AdHocPlannedStatement[] statements = AdHocPlannedStmtBatch.planArrayFromBuffer(buf);
View Full Code Here

Examples of org.voltdb.messaging.Iv2InitiateTaskMessage

        ArgumentCaptor<Long> destinationCaptor =
                ArgumentCaptor.forClass(Long.class);
        ArgumentCaptor<Iv2InitiateTaskMessage> messageCaptor =
                ArgumentCaptor.forClass(Iv2InitiateTaskMessage.class);
        verify(m_messenger).send(destinationCaptor.capture(), messageCaptor.capture());
        Iv2InitiateTaskMessage message = messageCaptor.getValue();

        //assertFalse(boolValues.get(0)); // is admin
        assertTrue(message.isReadOnly())// readonly
        assertFalse(message.isSinglePartition()); // single-part
        //assertFalse(boolValues.get(3)); // every site
        assertEquals("@AdHoc_RO_MP", message.getStoredProcedureName());

        byte[] serializedData = (byte[]) message.getStoredProcedureInvocation().getParameterAtIndex(0);
        ByteBuffer buf = ByteBuffer.wrap(serializedData);
        Object[] parameters = AdHocPlannedStmtBatch.userParamsFromBuffer(buf);
        assertEquals(0, parameters.length);
        AdHocPlannedStatement[] statements = AdHocPlannedStmtBatch.planArrayFromBuffer(buf);
        assertEquals(1, statements.length);
View Full Code Here

Examples of org.voltdb.messaging.Iv2InitiateTaskMessage

        ArgumentCaptor<Long> destinationCaptor =
                ArgumentCaptor.forClass(Long.class);
        ArgumentCaptor<Iv2InitiateTaskMessage> messageCaptor =
                ArgumentCaptor.forClass(Iv2InitiateTaskMessage.class);
        verify(m_messenger).send(destinationCaptor.capture(), messageCaptor.capture());
        Iv2InitiateTaskMessage message = messageCaptor.getValue();
        //assertFalse(boolValues.get(0)); // is admin
        assertFalse(message.isReadOnly()); // readonly
        assertFalse(message.isSinglePartition()); // single-part
        //assertFalse(boolValues.get(3)); // every site
        assertEquals("@UpdateApplicationCatalog", message.getStoredProcedureName());
        assertEquals("diff", message.getStoredProcedureInvocation().getParameterAtIndex(0));
        assertTrue(Arrays.equals("blah".getBytes(), (byte[]) message.getStoredProcedureInvocation().getParameterAtIndex(2)));
        assertEquals(3, message.getStoredProcedureInvocation().getParameterAtIndex(3));
        assertEquals("blah", message.getStoredProcedureInvocation().getParameterAtIndex(4));
        assertEquals(ProcedureInvocationType.REPLICATED, message.getStoredProcedureInvocation().getType());
        assertEquals(12345678l, message.getStoredProcedureInvocation().getOriginalTxnId());
        assertEquals(87654321l, message.getStoredProcedureInvocation().getOriginalUniqueId());
    }
View Full Code Here

Examples of org.voltdb.messaging.Iv2InitiateTaskMessage

                                          false);
        Pair<Long, byte[]> hashinatorConfig = TheHashinator.getCurrentVersionedConfig();
        long newHashinatorVersion = hashinatorConfig.getFirst() + 1;

        ByteBuffer msg = createMsg("hello", 1);
        Iv2InitiateTaskMessage initMsg = readAndCheck(msg, "hello", 1, true, true);
        assertEquals(1, initMsg.getStoredProcedureInvocation().getParameterAtIndex(0));

        // fake a restart response
        InitiateResponseMessage respMsg = new InitiateResponseMessage(initMsg);
        respMsg.setMispartitioned(true, initMsg.getStoredProcedureInvocation(),
                                  Pair.of(newHashinatorVersion, hashinatorConfig.getSecond()));

        // reset the message so that we can check for restart later
        reset(m_messenger);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.