Package org.apache.solr.common.cloud
Class PerReplicaStatesOps
- java.lang.Object
-
- org.apache.solr.common.cloud.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PerReplicaStatesOps
addReplica(String replica, Replica.State state, boolean isLeader, PerReplicaStates rs)
static PerReplicaStatesOps
deleteReplica(String replica, PerReplicaStates rs)
Delete a replica entry from per-replica statesstatic PerReplicaStatesOps
downReplicas(List<String> replicas, PerReplicaStates rs)
Mark the given replicas as DOWNstatic PerReplicaStatesOps
flipLeader(Set<String> allReplicas, String next, PerReplicaStates rs)
Flip the leader replica to a new onestatic PerReplicaStatesOps
flipState(String replica, Replica.State newState, PerReplicaStates rs)
Change the state of a replicaList<PerReplicaStates.Operation>
get()
List<PerReplicaStates.Operation>
get(PerReplicaStates rs)
PerReplicaStates
getPerReplicaStates()
static PerReplicaStatesOps
modifyCollection(DocCollection coll, boolean enable, PerReplicaStates rs)
Switch a collection from/to perReplicaState=truevoid
persist(String znode, SolrZkClient zkClient)
This is a persist operation with retry if a write fails due to stale stateString
toString()
static PerReplicaStatesOps
touchChildren()
Just creates and deletes a dummy entry so that theStat.getCversion()
of state.json is updated
-
-
-
Method Detail
-
persist
public void persist(String znode, SolrZkClient zkClient) throws org.apache.zookeeper.KeeperException, InterruptedException
This is a persist operation with retry if a write fails due to stale state- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getPerReplicaStates
public PerReplicaStates getPerReplicaStates()
-
flipState
public static PerReplicaStatesOps flipState(String replica, Replica.State newState, PerReplicaStates rs)
Change the state of a replica- Parameters:
newState
- the new state
-
modifyCollection
public static PerReplicaStatesOps modifyCollection(DocCollection coll, boolean enable, PerReplicaStates rs)
Switch a collection from/to perReplicaState=true
-
flipLeader
public static PerReplicaStatesOps flipLeader(Set<String> allReplicas, String next, PerReplicaStates rs)
Flip the leader replica to a new one- Parameters:
allReplicas
- allReplicas of the shardnext
- next leader
-
deleteReplica
public static PerReplicaStatesOps deleteReplica(String replica, 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, Replica.State state, boolean isLeader, PerReplicaStates rs)
-
downReplicas
public static PerReplicaStatesOps downReplicas(List<String> replicas, PerReplicaStates rs)
Mark the given replicas as DOWN
-
touchChildren
public static PerReplicaStatesOps touchChildren()
Just creates and deletes a dummy entry so that theStat.getCversion()
of state.json is updated
-
get
public List<PerReplicaStates.Operation> get()
-
get
public List<PerReplicaStates.Operation> get(PerReplicaStates rs)
-
-