use of org.apache.asterix.app.replication.message.TakeoverMetadataNodeRequestMessage in project asterixdb by apache.
the class AutoFaultToleranceStrategy method requestMetadataNodeTakeover.
private synchronized void requestMetadataNodeTakeover() {
//need a new node to takeover metadata node
ICcApplicationContext appCtx = (ICcApplicationContext) serviceCtx.getApplicationContext();
ClusterPartition metadataPartiton = appCtx.getMetadataProperties().getMetadataPartition();
//request the metadataPartition node to register itself as the metadata node
TakeoverMetadataNodeRequestMessage takeoverRequest = new TakeoverMetadataNodeRequestMessage();
try {
messageBroker.sendApplicationMessageToNC(takeoverRequest, metadataPartiton.getActiveNodeId());
// Since the metadata node will be changed, we need to rebind the proxy object
MetadataManager.INSTANCE.rebindMetadataNode();
} catch (Exception e) {
/*
* if we fail to send the request, it means the NC we tried to send the request to
* has failed. When the failure notification arrives, a new NC will be assigned to
* the metadata partition and a new metadata node takeover request will be sent to it.
*/
LOGGER.log(Level.WARNING, "Failed to send metadata node takeover request to: " + metadataPartiton.getActiveNodeId(), e);
}
}
Aggregations