Package org.voltdb.iv2

Examples of org.voltdb.iv2.RejoinProducer$TimerCallback


            m_partitionsToSitesAtStartupForExportInit = new ArrayList<Integer>();
            try {
                // IV2 mailbox stuff
                ClusterConfig clusterConfig = new ClusterConfig(topo);
                m_configuredReplicationFactor = clusterConfig.getReplicationFactor();
                m_cartographer = new Cartographer(m_messenger, m_configuredReplicationFactor,
                        m_catalogContext.cluster.getNetworkpartition());
                List<Integer> partitions = null;
                if (isRejoin) {
                    m_configuredNumberOfPartitions = m_cartographer.getPartitionCount();
                    partitions = m_cartographer.getIv2PartitionsToReplace(m_configuredReplicationFactor,
View Full Code Here


                                                List<Integer> m_partitionsToSitesAtStartupForExportInit)
    {
        List<Initiator> initiators = new ArrayList<Initiator>();
        for (Integer partition : partitions)
        {
            Initiator initiator = new SpInitiator(m_messenger, partition, getStatsAgent(),
                    m_snapshotCompletionMonitor, startAction);
            initiators.add(initiator);
            m_partitionsToSitesAtStartupForExportInit.add(partition);
        }
        return initiators;
View Full Code Here


            BalancePartitionsStatistics rebalanceStats = new BalancePartitionsStatistics();
            getStatsAgent().registerStatsSource(StatsSelector.REBALANCE, 0, rebalanceStats);

            KSafetyStats kSafetyStats = new KSafetyStats();
            getStatsAgent().registerStatsSource(StatsSelector.KSAFETY, 0, kSafetyStats);
            m_cpuStats = new CpuStats();
            getStatsAgent().registerStatsSource(StatsSelector.CPU,
                    0, m_cpuStats);
View Full Code Here

                            m_config.m_executionCoreBindings.poll());
                }

                // LeaderAppointer startup blocks if the initiators are not initialized.
                // So create the LeaderAppointer after the initiators.
                m_leaderAppointer = new LeaderAppointer(
                        m_messenger,
                        m_configuredNumberOfPartitions,
                        m_deployment.getCluster().getKfactor(),
                        m_catalogContext.cluster.getNetworkpartition(),
                        m_catalogContext.cluster.getFaultsnapshots().get("CLUSTER_PARTITION"),
View Full Code Here

                // to the RO MP site pool
                List<Long> localHSIds = new ArrayList<Long>();
                for (Initiator ii : m_iv2Initiators) {
                    localHSIds.add(ii.getInitiatorHSId());
                }
                m_MPI = new MpInitiator(m_messenger, localHSIds, getStatsAgent());
                m_iv2Initiators.add(m_MPI);

                // Make a list of HDIds to join
                Map<Integer, Long> partsToHSIdsToRejoin = new HashMap<Integer, Long>();
                for (Initiator init : m_iv2Initiators) {
View Full Code Here

        m_pendingTasks = new TransactionTaskQueue(m_tasks,getCurrentTxnId());
        m_snapMonitor = snapMonitor;
        m_durabilityListener = new DurabilityListener() {
            @Override
            public void onDurability(final ArrayList<Object> durableThings) {
                final SiteTaskerRunnable r = new SiteTasker.SiteTaskerRunnable() {
                    @Override
                    void run() {
                        synchronized (m_lock) {
                            for (Object o : durableThings) {
                                m_pendingTasks.offer((TransactionTask)o);

                                // Make sure all queued tasks for this MP txn are released
                                if (!((TransactionTask) o).getTransactionState().isSinglePartition()) {
                                    offerPendingMPTasks(((TransactionTask) o).getTxnId());
                                }
                            }
                        }
                    }
                };
                if (InitiatorMailbox.SCHEDULE_IN_SITE_THREAD) {
                    m_tasks.offer(r);
                } else {
                    r.run();
                }
            }
        };
        m_uniqueIdGenerator = new UniqueIdGenerator(partitionId, 0);
    }
View Full Code Here

         */
        if (m_snapshotPriority > 0) {
            final long now = System.currentTimeMillis();
            //Ask if the site is idle, and if it is queue the work immediately
            if (m_idlePredicate.idle(now)) {
                m_siteTaskerQueue.offer(new SnapshotTask());
                return;
            }

            //Cache the value locally, the dirty secret is that in edge cases multiple threads
            //will read/write briefly, but it isn't a big deal since the scheduling can be wrong
            //briefly. Caching it locally will make the logic here saner because it can't change
            //as execution progresses
            final long quietUntil = m_quietUntil;

                    /*
                     * If the current time is > than quietUntil then the quiet period is over
                     * and the snapshot work should be done immediately
                     *
                     * Otherwise it needs to be scheduled in the future and the next quiet period
                     * needs to be calculated
                     */
            if (now > quietUntil) {
                m_siteTaskerQueue.offer(new SnapshotTask());
                //Now push the quiet period further into the future,
                //generally no threads will be racing to do this
                //since the execution site only interacts with one snapshot data target at a time
                //except when it is switching tables. It doesn't really matter if it is wrong
                //it will just result in a little extra snapshot work being done close together
                m_quietUntil =
                        System.currentTimeMillis() +
                                (5 * m_snapshotPriority) + ((long)(m_random.nextDouble() * 15));
            } else {
                //Schedule it to happen after the quiet period has elapsed
                VoltDB.instance().schedulePriorityWork(
                        new Runnable() {
                            @Override
                            public void run()
                            {
                                m_siteTaskerQueue.offer(new SnapshotTask());
                            }
                        },
                        quietUntil - now,
                        0,
                        TimeUnit.MILLISECONDS);

                        /*
                         * This is the same calculation as above except the future is not based
                         * on the current time since the quiet period was already in the future
                         * and we need to move further past it since we just scheduled snapshot work
                         * at the end of the current quietUntil value
                         */
                m_quietUntil =
                        quietUntil +
                                (5 * m_snapshotPriority) + ((long)(m_random.nextDouble() * 15));
            }
        } else {
            m_siteTaskerQueue.offer(new SnapshotTask());
        }
    }
View Full Code Here

        VoltDB.instance().schedulePriorityWork(
                new Runnable() {
                    @Override
                    public void run()
                    {
                        m_siteTaskerQueue.offer(new SnapshotTask());
                    }
                },
                (m_quietUntil + (5 * m_snapshotPriority) - now),
                0,
                TimeUnit.MILLISECONDS);
View Full Code Here

                                                List<Integer> m_partitionsToSitesAtStartupForExportInit)
    {
        List<Initiator> initiators = new ArrayList<Initiator>();
        for (Integer partition : partitions)
        {
            Initiator initiator = new SpInitiator(m_messenger, partition, getStatsAgent(),
                    m_snapshotCompletionMonitor, startAction);
            initiators.add(initiator);
            m_partitionsToSitesAtStartupForExportInit.add(partition);
        }
        return initiators;
View Full Code Here

    }

    void verifyUACfromMasterToReplica() throws Exception
    {
        // uac from master?
        TxnEgo txnid = TxnEgo.makeZero(MpInitiator.MP_INIT_PID);
        Object[] params = new Object[2];
        params[0] = ClientUtils.fileToBytes(new File(m_pathToCatalog));
        params[1] = null;
        txnid = txnid.makeNext();
        // We're going to get odd responses for the sentinels, so catch and ignore the exceptions
        try {
            ((ClientImpl)m_client).callProcedure(txnid.getTxnId(), 0L, "@SendSentinel", 0);
        } catch (ProcCallException pce) {}
        try {
            ((ClientImpl)m_client).callProcedure(txnid.getTxnId(), 0L, "@SendSentinel", 1);
        } catch (ProcCallException pce) {}
        ClientResponse r = ((ClientImpl)m_client).callProcedure(txnid.getTxnId(), 0L,
                "@UpdateApplicationCatalog", params);
        assertEquals(ClientResponse.SUCCESS, r.getStatus());

        // adhoc queries still work
        verifyAdhocQuery();
        // undo our previous catalog update through the remote side so the promote test works
        params = new Object[2];
        params[0] = ClientUtils.fileToBytes(new File(m_pathToOtherCatalog));
        params[1] = null;
        txnid = txnid.makeNext();
        // We're going to get odd responses for the sentinels, so catch and ignore the exceptions
        try {
            ((ClientImpl)m_client).callProcedure(txnid.getTxnId(), 0L, "@SendSentinel", 0);
        } catch (ProcCallException pce) {}
        try {
            ((ClientImpl)m_client).callProcedure(txnid.getTxnId(), 0L, "@SendSentinel", 1);
        } catch (ProcCallException pce) {}
        r = ((ClientImpl)m_client).callProcedure(txnid.getTxnId(), 0L,
                "@UpdateApplicationCatalog", params);
        assertEquals(ClientResponse.SUCCESS, r.getStatus());
    }
View Full Code Here

TOP

Related Classes of org.voltdb.iv2.RejoinProducer$TimerCallback

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.