Search in sources :

Example 1 with TaskLog

use of org.voltdb.rejoin.TaskLog in project voltdb by VoltDB.

the class BaseInitiator method configureCommon.

protected void configureCommon(BackendTarget backend, CatalogContext catalogContext, String serializedCatalog, CatalogSpecificPlanner csp, int numberOfPartitions, StartAction startAction, StatsAgent agent, MemoryStats memStats, CommandLog cl, String coreBindIds, boolean hasMPDRGateway) throws KeeperException, ExecutionException, InterruptedException {
    int snapshotPriority = 6;
    if (catalogContext.cluster.getDeployment().get("deployment") != null) {
        snapshotPriority = catalogContext.cluster.getDeployment().get("deployment").getSystemsettings().get("systemsettings").getSnapshotpriority();
    }
    // demote rejoin to create for initiators that aren't rejoinable.
    if (startAction.doesJoin() && !isRejoinable()) {
        startAction = StartAction.CREATE;
    }
    TaskLog taskLog = null;
    if (m_initiatorMailbox.getJoinProducer() != null) {
        taskLog = m_initiatorMailbox.getJoinProducer().constructTaskLog(VoltDB.instance().getVoltDBRootPath());
    }
    m_executionSite = new Site(m_scheduler.getQueue(), m_initiatorMailbox.getHSId(), backend, catalogContext, serializedCatalog, m_partitionId, numberOfPartitions, startAction, snapshotPriority, m_initiatorMailbox, agent, memStats, coreBindIds, taskLog, hasMPDRGateway);
    LoadedProcedureSet procSet = new LoadedProcedureSet(m_executionSite);
    procSet.loadProcedures(catalogContext, csp);
    m_executionSite.setLoadedProcedures(procSet);
    m_scheduler.setProcedureSet(procSet);
    m_scheduler.setCommandLog(cl);
    m_siteThread = new Thread(m_executionSite);
    m_siteThread.setDaemon(false);
    m_siteThread.start();
}
Also used : TaskLog(org.voltdb.rejoin.TaskLog) LoadedProcedureSet(org.voltdb.LoadedProcedureSet)

Example 2 with TaskLog

use of org.voltdb.rejoin.TaskLog in project voltdb by VoltDB.

the class JoinProducerBase method initializeTaskLog.

// Load the pro task log
protected static TaskLog initializeTaskLog(String voltroot, int pid) {
    // Construct task log and start logging task messages
    File overflowDir = new File(voltroot, "join_overflow");
    Class<?> taskLogKlass = MiscUtils.loadProClass("org.voltdb.rejoin.TaskLogImpl", "Join", false);
    if (taskLogKlass != null) {
        Constructor<?> taskLogConstructor;
        try {
            taskLogConstructor = taskLogKlass.getConstructor(int.class, File.class);
            return (TaskLog) taskLogConstructor.newInstance(pid, overflowDir);
        } catch (InvocationTargetException e) {
            VoltDB.crashLocalVoltDB("Unable to construct join task log", true, e.getCause());
        } catch (Exception e) {
            VoltDB.crashLocalVoltDB("Unable to construct join task log", true, e);
        }
    }
    return null;
}
Also used : TaskLog(org.voltdb.rejoin.TaskLog) File(java.io.File) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 3 with TaskLog

use of org.voltdb.rejoin.TaskLog in project voltdb by VoltDB.

the class RejoinProducer method doFinishingTask.

private void doFinishingTask(final SiteProcedureConnection siteConnection) {
    /*
         * Don't notify the rejoin coordinator yet. The stream snapshot may
         * have not finished on all nodes, let the snapshot completion
         * monitor tell the rejoin coordinator.
         *
         * This used to block on the completion interest, but this raced
         * with fragments from the MPI that needed dummy responses. If the fragments
         * came after the EOF then they wouldn't receive dummy responses
         * and then the MPI wouldn't invoke SnapshotSaveAPI.logParticipatingHostCount
         */
    final SiteTasker finishingTask = new SiteTasker() {

        @Override
        public void run(SiteProcedureConnection siteConnection) {
            throw new RuntimeException("Unexpected execution of run method in rejoin producer.");
        }

        @Override
        public void runForRejoin(SiteProcedureConnection siteConnection, TaskLog rejoinTaskLog) throws IOException {
            if (!m_snapshotCompletionMonitor.isDone()) {
                m_taskQueue.offer(this);
                return;
            }
            SnapshotCompletionEvent event = null;
            Map<String, Map<Integer, Pair<Long, Long>>> exportSequenceNumbers = null;
            Map<Integer, Long> drSequenceNumbers = null;
            Map<Integer, Map<Integer, Map<Integer, DRConsumerDrIdTracker>>> allConsumerSiteTrackers = null;
            long clusterCreateTime = -1;
            try {
                event = m_snapshotCompletionMonitor.get();
                if (!m_schemaHasNoTables) {
                    REJOINLOG.debug(m_whoami + "waiting on snapshot completion monitor.");
                    exportSequenceNumbers = event.exportSequenceNumbers;
                    m_completionAction.setSnapshotTxnId(event.multipartTxnId);
                    drSequenceNumbers = event.drSequenceNumbers;
                    allConsumerSiteTrackers = event.drMixedClusterSizeConsumerState;
                    clusterCreateTime = event.clusterCreateTime;
                    // Tells EE which DR version going to use
                    siteConnection.setDRProtocolVersion(event.drVersion);
                }
                REJOINLOG.debug(m_whoami + " monitor completed. Sending SNAPSHOT_FINISHED " + "and handing off to site.");
                RejoinMessage snap_complete = new RejoinMessage(m_mailbox.getHSId(), Type.SNAPSHOT_FINISHED);
                m_mailbox.send(m_coordinatorHsId, snap_complete);
            } catch (InterruptedException crashme) {
                VoltDB.crashLocalVoltDB("Interrupted awaiting snapshot completion.", true, crashme);
            } catch (ExecutionException e) {
                VoltDB.crashLocalVoltDB("Unexpected exception awaiting snapshot completion.", true, e);
            }
            if (exportSequenceNumbers == null) {
                // Send empty sequence number map if the schema is empty (no tables).
                exportSequenceNumbers = new HashMap<String, Map<Integer, Pair<Long, Long>>>();
            }
            setJoinComplete(siteConnection, exportSequenceNumbers, drSequenceNumbers, allConsumerSiteTrackers, m_schemaHasNoTables == false, /* requireExistingSequenceNumbers */
            clusterCreateTime);
        }
    };
    try {
        finishingTask.runForRejoin(siteConnection, null);
    } catch (IOException e) {
        VoltDB.crashLocalVoltDB("Unexpected IOException in rejoin", true, e);
    }
}
Also used : RejoinMessage(org.voltdb.messaging.RejoinMessage) TaskLog(org.voltdb.rejoin.TaskLog) SnapshotCompletionEvent(org.voltdb.SnapshotCompletionInterest.SnapshotCompletionEvent) IOException(java.io.IOException) SiteProcedureConnection(org.voltdb.SiteProcedureConnection) DRConsumerDrIdTracker(org.voltdb.DRConsumerDrIdTracker) ExecutionException(java.util.concurrent.ExecutionException) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

TaskLog (org.voltdb.rejoin.TaskLog)3 File (java.io.File)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ExecutionException (java.util.concurrent.ExecutionException)1 DRConsumerDrIdTracker (org.voltdb.DRConsumerDrIdTracker)1 LoadedProcedureSet (org.voltdb.LoadedProcedureSet)1 SiteProcedureConnection (org.voltdb.SiteProcedureConnection)1 SnapshotCompletionEvent (org.voltdb.SnapshotCompletionInterest.SnapshotCompletionEvent)1 RejoinMessage (org.voltdb.messaging.RejoinMessage)1