use of org.apache.asterix.common.replication.ReplicaEvent in project asterixdb by apache.
the class ReplicationManager method reportFailedReplica.
/**
* Suspends replications and sends a remote replica failure event to ReplicasEventsMonitor.
*
* @param replicaId
* the failed replica id.
*/
public void reportFailedReplica(String replicaId) {
Replica replica = replicas.get(replicaId);
if (replica == null) {
return;
}
if (replica.getState() == ReplicaState.DEAD) {
return;
}
//need to stop processing any new logs or jobs
terminateJobsReplication.set(true);
ReplicaEvent event = new ReplicaEvent(replica, ClusterEventType.NODE_FAILURE);
reportReplicaEvent(event);
}
use of org.apache.asterix.common.replication.ReplicaEvent in project asterixdb by apache.
the class ReplicationManager method sendShutdownNotifiction.
/**
* Sends a shutdown event to remote replicas notifying them
* no more logs/files will be sent from this local replica.
*
* @throws IOException
*/
private void sendShutdownNotifiction() throws IOException {
Node node = new Node();
node.setId(nodeId);
node.setClusterIp(NetworkingUtil.getHostAddress(hostIPAddressFirstOctet));
Replica replica = new Replica(node);
ReplicaEvent event = new ReplicaEvent(replica, ClusterEventType.NODE_SHUTTING_DOWN);
ByteBuffer buffer = ReplicationProtocol.writeReplicaEventRequest(event);
Map<String, SocketChannel> replicaSockets = getActiveRemoteReplicasSockets();
sendRequest(replicaSockets, buffer);
closeReplicaSockets(replicaSockets);
}
use of org.apache.asterix.common.replication.ReplicaEvent in project asterixdb by apache.
the class ReplicaEventMessage method handle.
@Override
public void handle(INcApplicationContext appContext) throws HyracksDataException, InterruptedException {
Node node = new Node();
node.setId(nodeId);
node.setClusterIp(nodeIPAddress);
Replica replica = new Replica(node);
appContext.getReplicationManager().reportReplicaEvent(new ReplicaEvent(replica, event));
}
Aggregations