Search in sources :

Example 1 with StartReplicationServiceTask

use of org.apache.asterix.app.nc.task.StartReplicationServiceTask in project asterixdb by apache.

the class MetadataNodeFaultToleranceStrategy method buildParticipantStartupSequence.

private List<INCLifecycleTask> buildParticipantStartupSequence(String nodeId, SystemState state) {
    final List<INCLifecycleTask> tasks = new ArrayList<>();
    switch(state) {
        case PERMANENT_DATA_LOSS:
            // If the metadata node (or replica) failed and lost its data
            // => Metadata Remote Recovery from standby replica
            tasks.add(getMetadataPartitionRecoveryPlan());
            // Checkpoint after remote recovery to move node to HEALTHY state
            tasks.add(new CheckpointTask());
            break;
        case CORRUPTED:
            // If the metadata node (or replica) failed and started again without losing data => Local Recovery
            LocalRecoveryTask rt = new LocalRecoveryTask(Arrays.asList(clusterManager.getNodePartitions(nodeId)).stream().map(ClusterPartition::getPartitionId).collect(Collectors.toSet()));
            tasks.add(rt);
            break;
        case BOOTSTRAPPING:
        case HEALTHY:
        case RECOVERING:
            break;
        default:
            break;
    }
    tasks.add(new StartReplicationServiceTask());
    final boolean isMetadataNode = nodeId.equals(metadataNodeId);
    if (isMetadataNode) {
        tasks.add(new MetadataBootstrapTask());
    }
    tasks.add(new ExternalLibrarySetupTask(isMetadataNode));
    tasks.add(new ReportMaxResourceIdTask());
    tasks.add(new CheckpointTask());
    tasks.add(new StartLifecycleComponentsTask());
    if (isMetadataNode) {
        tasks.add(new BindMetadataNodeTask(true));
    }
    return tasks;
}
Also used : LocalRecoveryTask(org.apache.asterix.app.nc.task.LocalRecoveryTask) ExternalLibrarySetupTask(org.apache.asterix.app.nc.task.ExternalLibrarySetupTask) ArrayList(java.util.ArrayList) MetadataBootstrapTask(org.apache.asterix.app.nc.task.MetadataBootstrapTask) CheckpointTask(org.apache.asterix.app.nc.task.CheckpointTask) ReportMaxResourceIdTask(org.apache.asterix.app.nc.task.ReportMaxResourceIdTask) StartLifecycleComponentsTask(org.apache.asterix.app.nc.task.StartLifecycleComponentsTask) BindMetadataNodeTask(org.apache.asterix.app.nc.task.BindMetadataNodeTask) StartReplicationServiceTask(org.apache.asterix.app.nc.task.StartReplicationServiceTask) INCLifecycleTask(org.apache.asterix.common.api.INCLifecycleTask) ClusterPartition(org.apache.asterix.common.cluster.ClusterPartition)

Example 2 with StartReplicationServiceTask

use of org.apache.asterix.app.nc.task.StartReplicationServiceTask in project asterixdb by apache.

the class AutoFaultToleranceStrategy method buildStartupSequence.

private List<INCLifecycleTask> buildStartupSequence(String nodeId) {
    final List<INCLifecycleTask> tasks = new ArrayList<>();
    tasks.add(new StartReplicationServiceTask());
    final boolean isMetadataNode = nodeId.equals(currentMetadataNode);
    if (isMetadataNode) {
        tasks.add(new MetadataBootstrapTask());
    }
    tasks.add(new ExternalLibrarySetupTask(isMetadataNode));
    tasks.add(new ReportMaxResourceIdTask());
    tasks.add(new CheckpointTask());
    tasks.add(new StartLifecycleComponentsTask());
    if (isMetadataNode) {
        tasks.add(new BindMetadataNodeTask(true));
    }
    return tasks;
}
Also used : ReportMaxResourceIdTask(org.apache.asterix.app.nc.task.ReportMaxResourceIdTask) StartLifecycleComponentsTask(org.apache.asterix.app.nc.task.StartLifecycleComponentsTask) ExternalLibrarySetupTask(org.apache.asterix.app.nc.task.ExternalLibrarySetupTask) BindMetadataNodeTask(org.apache.asterix.app.nc.task.BindMetadataNodeTask) StartReplicationServiceTask(org.apache.asterix.app.nc.task.StartReplicationServiceTask) ArrayList(java.util.ArrayList) INCLifecycleTask(org.apache.asterix.common.api.INCLifecycleTask) MetadataBootstrapTask(org.apache.asterix.app.nc.task.MetadataBootstrapTask) CheckpointTask(org.apache.asterix.app.nc.task.CheckpointTask)

Aggregations

ArrayList (java.util.ArrayList)2 BindMetadataNodeTask (org.apache.asterix.app.nc.task.BindMetadataNodeTask)2 CheckpointTask (org.apache.asterix.app.nc.task.CheckpointTask)2 ExternalLibrarySetupTask (org.apache.asterix.app.nc.task.ExternalLibrarySetupTask)2 MetadataBootstrapTask (org.apache.asterix.app.nc.task.MetadataBootstrapTask)2 ReportMaxResourceIdTask (org.apache.asterix.app.nc.task.ReportMaxResourceIdTask)2 StartLifecycleComponentsTask (org.apache.asterix.app.nc.task.StartLifecycleComponentsTask)2 StartReplicationServiceTask (org.apache.asterix.app.nc.task.StartReplicationServiceTask)2 INCLifecycleTask (org.apache.asterix.common.api.INCLifecycleTask)2 LocalRecoveryTask (org.apache.asterix.app.nc.task.LocalRecoveryTask)1 ClusterPartition (org.apache.asterix.common.cluster.ClusterPartition)1