summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
58e85a6)
Nodes can be downed by sbr(for example when Isolated, sbr makes the
decision to down the minority), so we need to make sure they can
come up automatically unless we have another mechanism in place
for bringing up downed nodes.
JIRA: CONTROLLER-2025
Change-Id: I23d3ca2cee471c51d0eadc6c426461aa6eef193d
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
import akka.actor.Address;
import akka.actor.Props;
import akka.actor.UntypedAbstractActor;
import akka.actor.Address;
import akka.actor.Props;
import akka.actor.UntypedAbstractActor;
+import akka.cluster.Cluster;
+import akka.cluster.ClusterEvent;
import akka.japi.Effect;
import akka.remote.AssociationErrorEvent;
import akka.remote.RemotingLifecycleEvent;
import akka.japi.Effect;
import akka.remote.AssociationErrorEvent;
import akka.remote.RemotingLifecycleEvent;
private final Effect callback;
private boolean quarantined;
private final Effect callback;
private boolean quarantined;
- private Set<Address> addressSet = new HashSet<>();
+ private final Set<Address> addressSet = new HashSet<>();
private int count = 0;
protected QuarantinedMonitorActor(final Effect callback) {
private int count = 0;
protected QuarantinedMonitorActor(final Effect callback) {
LOG.debug("Created QuarantinedMonitorActor");
getContext().system().eventStream().subscribe(getSelf(), RemotingLifecycleEvent.class);
LOG.debug("Created QuarantinedMonitorActor");
getContext().system().eventStream().subscribe(getSelf(), RemotingLifecycleEvent.class);
+ getContext().system().eventStream().subscribe(getSelf(), ClusterEvent.MemberDowned.class);
// execute the callback
callback.apply();
} else if (message instanceof AssociationErrorEvent) {
// execute the callback
callback.apply();
} else if (message instanceof AssociationErrorEvent) {
- String errorMessage = message.toString();
+ final String errorMessage = message.toString();
LOG.trace("errorMessage:{}", errorMessage);
if (errorMessage.contains("The remote system has a UID that has been quarantined")) {
LOG.trace("errorMessage:{}", errorMessage);
if (errorMessage.contains("The remote system has a UID that has been quarantined")) {
- Address address = ((AssociationErrorEvent) message).getRemoteAddress();
+ final Address address = ((AssociationErrorEvent) message).getRemoteAddress();
addressSet.add(address);
count++;
LOG.trace("address:{} addressSet: {} count:{}", address, addressSet, count);
addressSet.add(address);
count++;
LOG.trace("address:{} addressSet: {} count:{}", address, addressSet, count);
count = 0;
addressSet.clear();
}
count = 0;
addressSet.clear();
}
+ } else if (message instanceof ClusterEvent.MemberDowned) {
+ final ClusterEvent.MemberDowned event = (ClusterEvent.MemberDowned) message;
+ if (Cluster.get(getContext().system()).selfMember().equals(event.member())) {
+ LOG.warn("This member has been downed, restarting");
+
+ callback.apply();
+ }