Package org.voltdb.messaging

Examples of org.voltdb.messaging.FragmentTaskMessage$FragmentData


        // store resume dependencies in the MpTestPlan for later.
        plan.depsToResume = depsToResumeList;

        // generate remote task with output IDs, fill in lists appropriately
        plan.remoteWork = new FragmentTaskMessage(Long.MIN_VALUE, // try not to care?
                                                  Long.MIN_VALUE, // try not to care?
                                                  Long.MIN_VALUE, // try not to care?
                                                  1234l, // magic, change if it matters
                                                  readOnly,
                                                  false, false)// IV2 doesn't use final task (yet)

        for (int i = 0; i < distributedOutputDepIds.size(); i++) {
            plan.remoteWork.addFragment(VoltSystemProcedure.fragIdToHash(Long.MIN_VALUE),
                    distributedOutputDepIds.get(i), createDummyParameterSet());
        }
        System.out.println("REMOTE TASK: " + plan.remoteWork.toString());

        if (!single_frag) {
            // generate a remote fragment response for each remote message
            for (int i = 0; i < remoteHSIds.length; i++) {
                FragmentResponseMessage resp =
                    new FragmentResponseMessage(plan.remoteWork, remoteHSIds[i]);
                if (rollback && i == (remoteHSIds.length - 1)) {
                    resp.setStatus(FragmentResponseMessage.UNEXPECTED_ERROR,
                                   new EEException(1234));
                }
                else {
                    resp.setStatus(FragmentResponseMessage.SUCCESS, null);
                    for (int j = 0; j < distributedOutputDepIds.size(); j++) {
                        resp.addDependency(distributedOutputDepIds.get(j),
                                           new VoltTable(new VoltTable.ColumnInfo("BOGO",
                                                                                  VoltType.BIGINT)));
                    }
                }
                System.out.println("RESPONSE: " + resp);
                plan.generatedResponses.add(resp);
            }
        }

        // generate local task with new output IDs, use above outputs as inputs, if any
        plan.localWork = new FragmentTaskMessage(Long.MIN_VALUE, // try not to care
                Long.MIN_VALUE,
                Long.MIN_VALUE,
                1234l,
                readOnly,
                false,
View Full Code Here


        Iv2InitiateTaskMessage taskmsg =
            new Iv2InitiateTaskMessage(0, 0, truncPt, 101L, System.currentTimeMillis(),
                                       true, false, new StoredProcedureInvocation(), 0, 0, false);
        assertEquals(truncPt, taskmsg.getTruncationHandle());

        FragmentTaskMessage localFrag = mock(FragmentTaskMessage.class);
        FragmentTaskMessage remoteFrag = mock(FragmentTaskMessage.class);
        when(remoteFrag.getFragmentCount()).thenReturn(1);

        buddyHSId = 0;
        Mailbox mailbox = mock(Mailbox.class);

        MpTransactionState dut =
View Full Code Here

            /*
             * The only real data is the fragment id, output dep id,
             * and parameters. Transactions ids, readonly-ness, and finality-ness
             * are unused.
             */
            FragmentTaskMessage ftm =
                    FragmentTaskMessage.createWithOneFragment(
                            0,
                            m.getHSId(),
                            0,
                            0,
                            false,
                            fragIdToHash(pf.fragmentId),
                            pf.outputDepId,
                            pf.parameters,
                            false,
                            m_runner.getTxnState().isForReplay());
            m.send(pf.siteId, ftm);
        }

        /*
         * Track the received dependencies. Stored as a list because executePlanFragment for
         * the aggregator plan fragment expects the tables as a list in the dependency map,
         * but sysproc fragments only every have a single output dependency.
         */
        Map<Integer, List<VoltTable>> receivedDependencyIds = new HashMap<Integer, List<VoltTable>>();

        /*
         * This loop will wait for all the responses to the fragment that was sent out,
         * 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 =
                        m_runner.executeSysProcPlanFragment(
                                m_runner.getTxnState(),
                                null,
                                hashToFragId(ftm.getPlanHash(0)),
                                ftm.getParameterSetForFragment(0));
                FragmentResponseMessage frm = new FragmentResponseMessage(ftm, m.getHSId());
                frm.addDependency(dp.depId, dp.dependency);
                m.send(ftm.getCoordinatorHSId(), frm);

                if (!m_unexpectedDependencies.isEmpty()) {
                    for (Integer dependencyId : dependencyIds) {
                        if (m_unexpectedDependencies.containsKey(dependencyId)) {
                            receivedDependencyIds.put(dependencyId, m_unexpectedDependencies.remove(dependencyId));
View Full Code Here

            // run this on
            if (pf.multipartition) {
                assert ((pf.outputDepId & DtxnConstants.MULTIPARTITION_DEPENDENCY) == DtxnConstants.MULTIPARTITION_DEPENDENCY);
            }

            FragmentTaskMessage task = FragmentTaskMessage.createWithOneFragment(
                    txnState.initiatorHSId,
                    m_site.getCorrespondingSiteId(),
                    txnState.txnId,
                    txnState.uniqueId,
                    txnState.isReadOnly(),
                    fragIdToHash(pf.fragmentId),
                    pf.outputDepId,
                    pf.parameters,
                    false,
                    txnState.isForReplay());
            if (pf.inputDepIds != null) {
                for (int depId : pf.inputDepIds) {
                    task.addInputDepId(0, depId);
                }
            }
            task.setFragmentTaskType(FragmentTaskMessage.SYS_PROC_PER_SITE);
            if (pf.suppressDuplicates) {
                task.setFragmentTaskType(FragmentTaskMessage.SYS_PROC_PER_PARTITION);
            }

            if (pf.multipartition) {
                // create a workunit for every execution site
                txnState.createAllParticipatingFragmentWork(task);
View Full Code Here

           m_depsToResume = new int[batchSize];
           m_depsForLocalTask = new int[batchSize];
           m_results = new VoltTable[batchSize];

           // the data and message for locally processed fragments
           m_localTask = new FragmentTaskMessage(m_txnState.initiatorHSId,
                                                 siteId,
                                                 m_txnState.txnId,
                                                 m_txnState.uniqueId,
                                                 m_txnState.isReadOnly(),
                                                 false,
                                                 txnState.isForReplay());
           m_localTask.setProcedureName(procedureName);

           // the data and message for all sites in the transaction
           m_distributedTask = new FragmentTaskMessage(m_txnState.initiatorHSId,
                                                       siteId,
                                                       m_txnState.txnId,
                                                       m_txnState.uniqueId,
                                                       m_txnState.isReadOnly(),
                                                       finalTask,
View Full Code Here

        return truncInitMsg(Long.MIN_VALUE, 0);
    }

    VoltMessage truncFragMsg(long truncPt, long mpTxnId)
    {
        FragmentTaskMessage msg = mock(FragmentTaskMessage.class);
        when(msg.getTxnId()).thenReturn(mpTxnId);
        when(msg.getTruncationHandle()).thenReturn(truncPt);
        return msg;
    }
View Full Code Here

        return task;
    }

    private FragmentTaskMessage createFrag(long txnId, boolean readOnly, long destHSId)
    {
        FragmentTaskMessage frag =
            new FragmentTaskMessage(destHSId, // don't care
                                    destHSId, // don't care
                                    txnId,
                                    System.currentTimeMillis(),
                                    readOnly,
                                    false,
                                    false);
        frag.setSpHandle(TxnEgo.makeZero(0).getTxnId());
        return frag;
    }
View Full Code Here

    {
        long txnid = TxnEgo.makeZero(0).getTxnId();
        long primary_hsid = 1111l;

        createObjs();
        FragmentTaskMessage sptask = createFrag(txnid, 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());
        FragmentResponseMessage resp = new FragmentResponseMessage(sptask, 0l);
View Full Code Here

        long primary_hsid = 1111l;

        createObjs();
        dut.setLeaderState(true);
        dut.updateReplicas(new ArrayList<Long>(), null);
        FragmentTaskMessage sptask = createFrag(txnid, 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());
        FragmentResponseMessage resp = new FragmentResponseMessage(sptask, 0l);
View Full Code Here

        createObjs();
        dut.setLeaderState(true);
        List<Long> replicas = new ArrayList<Long>();
        replicas.add(2l);
        dut.updateReplicas(replicas, null);
        FragmentTaskMessage sptask = createFrag(txnid, false, primary_hsid);
        dut.deliver(sptask);
        // verify no response sent yet
        verify(mbox, times(0)).send(anyLong(), (VoltMessage)anyObject());
        ArgumentCaptor<FragmentTaskMessage> replmsg = ArgumentCaptor.forClass(FragmentTaskMessage.class);
        verify(mbox, times(1)).send(eq(new long[] {2}), replmsg.capture());
View Full Code Here

TOP

Related Classes of org.voltdb.messaging.FragmentTaskMessage$FragmentData

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.