Class UnreachableClusterPolicy

java.lang.Object
org.openspaces.core.multicluster.internal.health.UnreachableClusterPolicy

public final class UnreachableClusterPolicy extends Object
What to do about a cluster that cannot be reached - the one place the rule lives.

Before this existed the answer was the same everywhere: a failed mutation wrote a cluster off on the spot, a failed read went into the sliding window, and either way an unhealthy cluster was stripped from the read rotation and the priority list. That is right for WRITE_SYNC, where a cluster that missed a write is genuinely behind the others, and wrong for every other mode, where the cluster has missed nothing and dropping it is a decision only the application can make.

Which mode decides

Read mode and write mode are independent and both always set, so "the mode" is not a single value - it depends on what noticed the failure. A mutation is judged by the write mode, because the write mode is what determined how many clusters that mutation was supposed to reach. A read, and a ping that reaches no further than a read would, are judged by the read mode.

The rules

Unreachable-cluster handling
DetectorModeClusterMarkListPromote
MUTATIONWRITE_ONCEactiveUNHEALTHYkeepyes
MUTATIONWRITE_ONCEotherSUSPECTkeepno
MUTATIONWRITE_SYNCanyUNHEALTHYunregister-
READ/PINGREAD_ACTIVEactiveUNHEALTHYkeepyes
READ/PINGREAD_ACTIVEotherSUSPECTkeepno
READ/PINGREAD_ROUND_ROBINanySUSPECTkeepno

"active" in the table means the cluster holds a role the detector cares about. A mutation is only about the active (write) role. A read or ping counts either role: the active cluster, or the cluster pinned to serve READ_ACTIVE reads when reads and writes are split - and promote then moves whichever roles that cluster held, each independently of the other.

WRITE_SYNC needs no promote flag: unregistering hands the active role to the next cluster in failover order and reports the change, so asking for a promotion as well would move it twice.

ClusterHealth.State.SUSPECT here means "start the sliding window", not "stop at suspect". A cluster that keeps failing still crosses failureThreshold and becomes ClusterHealth.State.UNHEALTHY, which is what stops traffic reaching it - it just never leaves the lists on the way.

  • Method Details

    • decide

      public static UnreachableClusterPolicy.Decision decide(MultiClusterConfig config, UnreachableClusterPolicy.Detector detector, boolean isActive)
      Decides how to handle a cluster that could not be reached.
      Parameters:
      config - the configuration in force, for the read and write modes
      detector - what noticed the failure
      isActive - whether the unreachable cluster currently holds a role the detector depends on: the active (write) role for a mutation; for a read or ping, the active role or the pinned read-active role, since either one being dead leaves READ_ACTIVE traffic or writes with nowhere to go