Class PerReplicaStatesOps


  • public class PerReplicaStatesOps
    extends Object
    This is a helper class that encapsulates various operations performed on the per-replica states Do not directly manipulate the per replica states as it can become difficult to debug them
    • Method Detail

      • getPerReplicaStates

        public org.apache.solr.common.cloud.PerReplicaStates getPerReplicaStates()
      • flipState

        public static PerReplicaStatesOps flipState​(String replica,
                                                    org.apache.solr.common.cloud.Replica.State newState,
                                                    org.apache.solr.common.cloud.PerReplicaStates rs)
        Change the state of a replica
        Parameters:
        newState - the new state
      • enable

        public static PerReplicaStatesOps enable​(org.apache.solr.common.cloud.DocCollection coll,
                                                 org.apache.solr.common.cloud.PerReplicaStates rs)
        Switch a collection /to perReplicaState=true
      • disable

        public static PerReplicaStatesOps disable​(org.apache.solr.common.cloud.PerReplicaStates rs)
        Switch a collection /to perReplicaState=false
      • flipLeader

        public static PerReplicaStatesOps flipLeader​(Set<String> allReplicas,
                                                     String next,
                                                     org.apache.solr.common.cloud.PerReplicaStates rs)
        Flip the leader replica to a new one
        Parameters:
        allReplicas - allReplicas of the shard
        next - next leader
      • deleteReplica

        public static PerReplicaStatesOps deleteReplica​(String replica,
                                                        org.apache.solr.common.cloud.PerReplicaStates rs)
        Delete a replica entry from per-replica states
        Parameters:
        replica - name of the replica to be deleted
      • addReplica

        public static PerReplicaStatesOps addReplica​(String replica,
                                                     org.apache.solr.common.cloud.Replica.State state,
                                                     boolean isLeader,
                                                     org.apache.solr.common.cloud.PerReplicaStates rs)
      • downReplicas

        public static PerReplicaStatesOps downReplicas​(List<String> replicas,
                                                       org.apache.solr.common.cloud.PerReplicaStates rs)
        Mark the given replicas as DOWN
      • touchChildren

        public static PerReplicaStatesOps touchChildren()
        Just creates and deletes a dummy entry so that the Stat.getCversion() of state.json is updated
      • get

        public List<org.apache.solr.common.cloud.PerReplicaStates.Operation> get()
      • get

        public List<org.apache.solr.common.cloud.PerReplicaStates.Operation> get​(org.apache.solr.common.cloud.PerReplicaStates rs)