Search in sources :

Example 1 with StartupTaskResponseMessage

use of org.apache.asterix.app.replication.message.StartupTaskResponseMessage in project asterixdb by apache.

the class MetadataNodeFaultToleranceStrategy method process.

private synchronized void process(StartupTaskRequestMessage msg) throws HyracksDataException {
    final String nodeId = msg.getNodeId();
    final SystemState state = msg.getState();
    final boolean isParticipant = replicationStrategy.isParticipant(nodeId);
    List<INCLifecycleTask> tasks;
    if (!isParticipant) {
        tasks = buildNonParticipantStartupSequence(nodeId, state);
    } else {
        tasks = buildParticipantStartupSequence(nodeId, state);
    }
    StartupTaskResponseMessage response = new StartupTaskResponseMessage(nodeId, tasks);
    try {
        messageBroker.sendApplicationMessageToNC(response, msg.getNodeId());
    } catch (Exception e) {
        throw HyracksDataException.create(e);
    }
}
Also used : SystemState(org.apache.asterix.common.transactions.IRecoveryManager.SystemState) StartupTaskResponseMessage(org.apache.asterix.app.replication.message.StartupTaskResponseMessage) INCLifecycleTask(org.apache.asterix.common.api.INCLifecycleTask) RuntimeDataException(org.apache.asterix.common.exceptions.RuntimeDataException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 2 with StartupTaskResponseMessage

use of org.apache.asterix.app.replication.message.StartupTaskResponseMessage in project asterixdb by apache.

the class NoFaultToleranceStrategy method process.

private void process(StartupTaskRequestMessage msg) throws HyracksDataException {
    final String nodeId = msg.getNodeId();
    List<INCLifecycleTask> tasks = buildNCStartupSequence(msg.getNodeId(), msg.getState());
    StartupTaskResponseMessage response = new StartupTaskResponseMessage(nodeId, tasks);
    try {
        messageBroker.sendApplicationMessageToNC(response, msg.getNodeId());
    } catch (Exception e) {
        throw HyracksDataException.create(e);
    }
}
Also used : StartupTaskResponseMessage(org.apache.asterix.app.replication.message.StartupTaskResponseMessage) INCLifecycleTask(org.apache.asterix.common.api.INCLifecycleTask) RuntimeDataException(org.apache.asterix.common.exceptions.RuntimeDataException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 3 with StartupTaskResponseMessage

use of org.apache.asterix.app.replication.message.StartupTaskResponseMessage in project asterixdb by apache.

the class AutoFaultToleranceStrategy method process.

private synchronized void process(StartupTaskRequestMessage msg) throws HyracksDataException {
    final String nodeId = msg.getNodeId();
    final SystemState state = msg.getState();
    List<INCLifecycleTask> tasks;
    if (state == SystemState.BOOTSTRAPPING || state == SystemState.HEALTHY) {
        tasks = buildStartupSequence(nodeId);
    } else {
        // failed node returned. Need to start failback process
        tasks = buildFailbackStartupSequence();
    }
    StartupTaskResponseMessage response = new StartupTaskResponseMessage(nodeId, tasks);
    try {
        messageBroker.sendApplicationMessageToNC(response, msg.getNodeId());
    } catch (Exception e) {
        throw HyracksDataException.create(e);
    }
}
Also used : SystemState(org.apache.asterix.common.transactions.IRecoveryManager.SystemState) StartupTaskResponseMessage(org.apache.asterix.app.replication.message.StartupTaskResponseMessage) INCLifecycleTask(org.apache.asterix.common.api.INCLifecycleTask) RuntimeDataException(org.apache.asterix.common.exceptions.RuntimeDataException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Aggregations

StartupTaskResponseMessage (org.apache.asterix.app.replication.message.StartupTaskResponseMessage)3 INCLifecycleTask (org.apache.asterix.common.api.INCLifecycleTask)3 RuntimeDataException (org.apache.asterix.common.exceptions.RuntimeDataException)3 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)3 SystemState (org.apache.asterix.common.transactions.IRecoveryManager.SystemState)2