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
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classPerReplicaStatesOps.PrsZkNodeNotFoundException
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PerReplicaStatesOpsaddReplica(String replica, org.apache.solr.common.cloud.Replica.State state, boolean isLeader, org.apache.solr.common.cloud.PerReplicaStates rs)static PerReplicaStatesOpsdeleteReplica(String replica, org.apache.solr.common.cloud.PerReplicaStates rs)Delete a replica entry from per-replica statesstatic PerReplicaStatesOpsdisable(org.apache.solr.common.cloud.PerReplicaStates rs)Switch a collection /to perReplicaState=falsestatic PerReplicaStatesOpsdownReplicas(List<String> replicas, org.apache.solr.common.cloud.PerReplicaStates rs)Mark the given replicas as DOWNstatic PerReplicaStatesOpsenable(org.apache.solr.common.cloud.DocCollection coll, org.apache.solr.common.cloud.PerReplicaStates rs)Switch a collection /to perReplicaState=truestatic org.apache.solr.common.cloud.PerReplicaStatesfetch(String path, SolrZkClient zkClient, org.apache.solr.common.cloud.PerReplicaStates current)Fetch the latestPerReplicaStates.static PerReplicaStatesOpsflipLeader(Set<String> allReplicas, String next, org.apache.solr.common.cloud.PerReplicaStates rs)Flip the leader replica to a new onestatic PerReplicaStatesOpsflipState(String replica, org.apache.solr.common.cloud.Replica.State newState, org.apache.solr.common.cloud.PerReplicaStates rs)Change the state of a replicaList<org.apache.solr.common.cloud.PerReplicaStates.Operation>get()List<org.apache.solr.common.cloud.PerReplicaStates.Operation>get(org.apache.solr.common.cloud.PerReplicaStates rs)org.apache.solr.common.cloud.PerReplicaStatesgetPerReplicaStates()static org.apache.solr.common.cloud.DocCollection.PrsSuppliergetZkClientPrsSupplier(SolrZkClient zkClient, String collectionPath)voidpersist(String znode, SolrZkClient zkClient)This is a persist operation with retry if a write fails due to stale stateStringtoString()
 
- 
- 
- 
Method Detail- 
fetchpublic static org.apache.solr.common.cloud.PerReplicaStates fetch(String path, SolrZkClient zkClient, org.apache.solr.common.cloud.PerReplicaStates current) Fetch the latestPerReplicaStates. It fetches data after checking theStat.getCversion()of state.json. If this is not modified, the same object is returned
 - 
getZkClientPrsSupplierpublic static org.apache.solr.common.cloud.DocCollection.PrsSupplier getZkClientPrsSupplier(SolrZkClient zkClient, String collectionPath) 
 - 
persistpublic 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
 
 - 
getPerReplicaStatespublic org.apache.solr.common.cloud.PerReplicaStates getPerReplicaStates() 
 - 
flipStatepublic 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
 
 - 
enablepublic static PerReplicaStatesOps enable(org.apache.solr.common.cloud.DocCollection coll, org.apache.solr.common.cloud.PerReplicaStates rs) Switch a collection /to perReplicaState=true
 - 
disablepublic static PerReplicaStatesOps disable(org.apache.solr.common.cloud.PerReplicaStates rs) Switch a collection /to perReplicaState=false
 - 
flipLeaderpublic 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
 
 - 
deleteReplicapublic 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
 
 - 
addReplicapublic static PerReplicaStatesOps addReplica(String replica, org.apache.solr.common.cloud.Replica.State state, boolean isLeader, org.apache.solr.common.cloud.PerReplicaStates rs) 
 - 
downReplicaspublic static PerReplicaStatesOps downReplicas(List<String> replicas, org.apache.solr.common.cloud.PerReplicaStates rs) Mark the given replicas as DOWN
 - 
getpublic List<org.apache.solr.common.cloud.PerReplicaStates.Operation> get() 
 - 
getpublic List<org.apache.solr.common.cloud.PerReplicaStates.Operation> get(org.apache.solr.common.cloud.PerReplicaStates rs) 
 
- 
 
-