Examples of VoltMessage


Examples of org.voltcore.messaging.VoltMessage

     */
    @Override
    protected VoltMessage instantiate_local(byte messageType)
    {
        // instantiate a new message instance according to the id
        VoltMessage message = null;

        switch (messageType) {
        case INITIATE_TASK_ID:
            message = new InitiateTaskMessage();
            break;
View Full Code Here

Examples of org.voltcore.messaging.VoltMessage

         * but will also respond to incoming fragment tasks by executing them.
         */
        while (true) {
            //Lightly spinning makes debugging easier by allowing inspection
            //of stuff on the stack
            VoltMessage vm = m.recvBlocking(1000);
            if (vm == null) continue;

            if (vm instanceof FragmentTaskMessage) {
                FragmentTaskMessage ftm = (FragmentTaskMessage)vm;
                DependencyPair dp =
View Full Code Here

Examples of org.voltcore.messaging.VoltMessage

        msg.flattenToBuffer(buf1);
        buf1.flip();

        VoltDbMessageFactory vdbmf = new VoltDbMessageFactory();

        VoltMessage msg2 = vdbmf.createMessageFromBuffer(buf1, -1);
        ByteBuffer buf2 = ByteBuffer.allocate(msg2.getSerializedSize());
        msg2.flattenToBuffer(buf2);
        buf1.rewind();
        buf2.rewind();

        assertEquals(buf1.remaining(), buf2.remaining());
        assertTrue(buf1.compareTo(buf2) == 0);
View Full Code Here

Examples of org.voltcore.messaging.VoltMessage

    public void testOfferFragmentTaskMessage()
    {
        RepairLog rl = new RepairLog();

        // trunc(trunc point, txnId).
        VoltMessage m1 = truncFragMsg(0L, 1L);
        rl.deliver(m1);
        assertEquals(2, rl.contents(1L, false).size());

        VoltMessage m2 = truncFragMsg(0L, 2L);
        rl.deliver(m2);
        assertEquals(3, rl.contents(1L, false).size());

        // only the first message for a transaction is logged.
        VoltMessage m2b = truncFragMsg(0L, 2L);
        rl.deliver(m2b);
        assertEquals(3, rl.contents(1L, false).size());

        // trim m1. add m3
        VoltMessage m3 = truncFragMsg(1L, 3L);
        rl.deliver(m3);
        assertEquals(3, rl.contents(1L, false).size());
        assertEquals(m2, rl.contents(1L, false).get(1).getPayload());
        assertEquals(2L, rl.contents(1L, false).get(1).getTxnId());
        assertEquals(m3, rl.contents(1L, false).get(2).getPayload());
View Full Code Here

Examples of org.voltcore.messaging.VoltMessage

    public void testOfferCompleteMessage()
    {
        RepairLog rl = new RepairLog();

        // trunc(trunc point, txnId).
        VoltMessage m1 = truncCompleteMsg(0L, 1L);
        rl.deliver(m1);
        assertEquals(2, rl.contents(1L, false).size());

        VoltMessage m2 = truncCompleteMsg(0L, 2L);
        rl.deliver(m2);
        assertEquals(3, rl.contents(1L, false).size());

        // trim m1. add m3
        VoltMessage m3 = truncCompleteMsg(1L, 3L);
        rl.deliver(m3);
        assertEquals(3, rl.contents(1L, false).size());
        assertEquals(m2, rl.contents(1L, false).get(1).getPayload());
        assertEquals(2L, rl.contents(1L, false).get(1).getTxnId());
        assertEquals(m3, rl.contents(1L, false).get(2).getPayload());
View Full Code Here

Examples of org.voltcore.messaging.VoltMessage

    @Test
    public void testTruncationAfterPromotion()
    {
        RepairLog rl = new RepairLog();
        VoltMessage m1 = truncInitMsg(0L, 1L);
        rl.deliver(m1);
        VoltMessage m2 = truncInitMsg(0L, 2L);
        rl.deliver(m2);
        assertEquals(3, rl.contents(1L, false).size());
        rl.setLeaderState(true);
        assertEquals(1, rl.contents(1L, false).size());
    }
View Full Code Here

Examples of org.voltcore.messaging.VoltMessage

        // First, add and truncate SP transactions with no MPs
        dut.deliver(truncInitMsg(Long.MIN_VALUE, 0));
        long start = System.currentTimeMillis();
        for (int i = 0; i < 100000; i++)
        {
            VoltMessage msg = truncInitMsg(i, i + 1);
            dut.deliver(msg);
        }
        long end = System.currentTimeMillis();
        long duration1 = end - start;
        System.out.println("Time to deliver 100,000 SPs: " + duration1);

        // Now, add 40000 MP messages and then see how long it takes to do the SPs
        dut = new RepairLog();
        dut.deliver(truncInitMsg(Long.MIN_VALUE, 0));
        for (int i = 0; i < 40000; i++) {
            dut.deliver(truncCompleteMsg(Long.MIN_VALUE, i));
        }
        start = System.currentTimeMillis();
        for (int i = 0; i < 100000; i++)
        {
            VoltMessage msg = truncInitMsg(i, i + 1);
            dut.deliver(msg);
        }
        end = System.currentTimeMillis();
        long duration2 = end - start;
        System.out.println("Time to deliver 100,000 SPs: " + duration2);
View Full Code Here

Examples of org.voltcore.messaging.VoltMessage

        long lastReportTime = 0;
        boolean haveEnough = false;
        int [] forwardStallCount = new int[] {FORWARD_STALL_COUNT};

        do {
            VoltMessage m = m_mailbox.recvBlocking(receiveSubjects, 5);

            /*
             * If fault resolution takes longer then 10 seconds start logging
             */
            final long now = System.currentTimeMillis();
            if (now - blockedOnReceiveStart > 10000) {
                if (now - lastReportTime > 60000) {
                    lastReportTime = System.currentTimeMillis();
                    haveNecessaryFaultInfo(m_seeker.getSurvivors(), true);
                }
            }

            if (m == null) {
                // Send a heartbeat to keep the dead host timeout active.  Needed because IV2 doesn't
                // generate its own heartbeats to keep this running.
                m_meshAide.sendHeartbeats(m_seeker.getSurvivors());

            } else if (m.getSubject() == Subject.SITE_FAILURE_UPDATE.getId()) {

                SiteFailureMessage sfm = (SiteFailureMessage)m;

                if !m_seeker.getSurvivors().contains(m.m_sourceHSId)
                    || m_failedSites.contains(m.m_sourceHSId)
                    || m_failedSites.containsAll(sfm.getFailedSites())) continue;

                updateFailedSitesLedger(hsIds, sfm);

                m_seeker.add(sfm);
                addForwardCandidate(new SiteFailureForwardMessage(sfm));

                m_recoveryLog.info("Agreement, Received " + sfm);

            } else if (m.getSubject() == Subject.SITE_FAILURE_FORWARD.getId()) {

                SiteFailureForwardMessage fsfm = (SiteFailureForwardMessage)m;

                addForwardCandidate(fsfm);

                if (   !hsIds.contains(fsfm.m_sourceHSId)
                    || m_seeker.getSurvivors().contains(fsfm.m_reportingHSId)
                    || m_failedSites.contains(fsfm.m_reportingHSId)
                    || m_failedSites.containsAll(fsfm.getFailedSites())) continue;

                m_seeker.add(fsfm);

                m_recoveryLog.info("Agreement, Received forward " + fsfm);

                forwardStallCount[0] = FORWARD_STALL_COUNT;

            } else if (m.getSubject() == Subject.FAILURE.getId()) {
                /*
                 * If the fault distributor reports a new fault, ignore it if it is known , otherwise
                 * re-deliver the message to ourself and then abort so that the process can restart.
                 */
                FaultMessage fm = (FaultMessage)m;
View Full Code Here

Examples of org.voltcore.messaging.VoltMessage

                                -1);
                    m_mailbox.send( sourceHSId, recoveryMessage);
                }
            }

            VoltMessage message = m_mailbox.recvBlocking(5);
            if (message != null) {
                processMessage(message);
            }

            final long now = System.currentTimeMillis();
View Full Code Here

Examples of org.voltcore.messaging.VoltMessage

            if (m_recovering) {
                recoveryRunLoop();
            }
            long lastHeartbeatTime = System.currentTimeMillis();
            while (m_shouldContinue) {
                VoltMessage message = m_mailbox.recvBlocking(5);
                if (message != null) {
                    processMessage(message);
                }

                final long now = System.currentTimeMillis();
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.