Enum Replica.State

  • All Implemented Interfaces:
    Serializable, Comparable<Replica.State>
    Enclosing class:
    Replica

    public static enum Replica.State
    extends Enum<Replica.State>
    The replica's state. In general, if the node the replica is hosted on is not under /live_nodes in ZK, the replica's state should be discarded.
    • Enum Constant Detail

      • ACTIVE

        public static final Replica.State ACTIVE
        The replica is ready to receive updates and queries.

        NOTE: when the node the replica is hosted on crashes, the replica's state may remain ACTIVE in ZK. To determine if the replica is truly active, you must also verify that its node is under /live_nodes in ZK (or use ClusterState.liveNodesContain(String)).

      • DOWN

        public static final Replica.State DOWN
        The first state before RECOVERING. A node in this state should be actively trying to move to RECOVERING.

        NOTE: a replica's state may appear DOWN in ZK also when the node it's hosted on gracefully shuts down. This is a best effort though, and should not be relied on.

      • RECOVERING

        public static final Replica.State RECOVERING
        The node is recovering from the leader. This might involve peer-sync, full replication or finding out things are already in sync.
      • RECOVERY_FAILED

        public static final Replica.State RECOVERY_FAILED
        Recovery attempts have not worked, something is not right.

        NOTE: This state doesn't matter if the node is not part of /live_nodes in ZK; in that case the node is not part of the cluster and it's state should be discarded.

    • Method Detail

      • values

        public static Replica.State[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Replica.State c : Replica.State.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Replica.State valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getState

        public static Replica.State getState​(String stateStr)
        Converts the state string to a State instance.