ARTEMIS-1154 isolated backup fails over
Even if there is no address/url configured for the NetworkHealthCheck an isolated backup will still fail-over potentially causing split-brain.
This commit is contained in:
parent
80e4c09435
commit
5cb5c8a6dc
|
@ -298,25 +298,27 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if no checks were done or if one address/url responds; false if all addresses/urls fail
|
||||
*/
|
||||
public boolean check() {
|
||||
boolean isEmpty = true;
|
||||
if (isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (InetAddress address : addresses) {
|
||||
isEmpty = false;
|
||||
if (check(address)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (URL url : urls) {
|
||||
isEmpty = false;
|
||||
if (check(url)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// This should return true if no checks were done, on this case it's empty
|
||||
// This is tested by {@link NetworkHe
|
||||
return isEmpty;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean check(InetAddress address) {
|
||||
|
@ -397,4 +399,8 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return addresses.isEmpty() && urls.isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class SharedNothingBackupQuorum implements Quorum, SessionFailureListener
|
|||
signal = BACKUP_ACTIVATION.FAIL_OVER;
|
||||
}
|
||||
|
||||
if (networkHealthCheck != null && networkHealthCheck.check()) {
|
||||
if (networkHealthCheck != null && !networkHealthCheck.isEmpty() && networkHealthCheck.check()) {
|
||||
// live is assumed to be down, backup fails-over
|
||||
signal = BACKUP_ACTIVATION.FAIL_OVER;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue