use of org.apache.asterix.common.replication.IRemoteRecoveryManager in project asterixdb by apache.
the class CompleteFailbackRequestMessage method handle.
@Override
public void handle(INcApplicationContext appContext) throws HyracksDataException, InterruptedException {
INCMessageBroker broker = (INCMessageBroker) appContext.getServiceContext().getMessageBroker();
HyracksDataException hde = null;
try {
IRemoteRecoveryManager remoteRecoeryManager = appContext.getRemoteRecoveryManager();
remoteRecoeryManager.completeFailbackProcess();
} catch (IOException | InterruptedException e) {
LOGGER.log(Level.SEVERE, "Failure during completion of failback process", e);
hde = HyracksDataException.create(e);
} finally {
CompleteFailbackResponseMessage reponse = new CompleteFailbackResponseMessage(planId, requestId, partitions);
try {
broker.sendMessageToCC(reponse);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failure sending message to CC", e);
hde = HyracksDataException.suppress(hde, e);
}
}
if (hde != null) {
throw hde;
}
}
use of org.apache.asterix.common.replication.IRemoteRecoveryManager in project asterixdb by apache.
the class TakeoverPartitionsRequestMessage method handle.
@Override
public void handle(INcApplicationContext appContext) throws HyracksDataException, InterruptedException {
INCMessageBroker broker = (INCMessageBroker) appContext.getServiceContext().getMessageBroker();
//if the NC is shutting down, it should ignore takeover partitions request
if (!appContext.isShuttingdown()) {
HyracksDataException hde = null;
try {
IRemoteRecoveryManager remoteRecoeryManager = appContext.getRemoteRecoveryManager();
remoteRecoeryManager.takeoverPartitons(partitions);
} catch (IOException | ACIDException e) {
LOGGER.log(Level.SEVERE, "Failure taking over partitions", e);
hde = HyracksDataException.suppress(hde, e);
} finally {
//send response after takeover is completed
TakeoverPartitionsResponseMessage reponse = new TakeoverPartitionsResponseMessage(requestId, appContext.getTransactionSubsystem().getId(), partitions);
try {
broker.sendMessageToCC(reponse);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failure taking over partitions", e);
hde = HyracksDataException.suppress(hde, e);
}
}
if (hde != null) {
throw hde;
}
}
}
Aggregations