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, org.apache.solr.common.cloud.Replica.State state, boolean isLeader, org.apache.solr.common.cloud.PerReplicaStates rs)
static PerReplicaStatesOps
deleteReplica(String replica, org.apache.solr.common.cloud.PerReplicaStates rs)
Delete a replica entry from per-replica statesstatic PerReplicaStatesOps
disable(org.apache.solr.common.cloud.PerReplicaStates rs)
Switch a collection /to perReplicaState=falsestatic PerReplicaStatesOps
downReplicas(List<String> replicas, org.apache.solr.common.cloud.PerReplicaStates rs)
Mark the given replicas as DOWNstatic PerReplicaStatesOps
enable(org.apache.solr.common.cloud.DocCollection coll, org.apache.solr.common.cloud.PerReplicaStates rs)
Switch a collection /to perReplicaState=truestatic PerReplicaStatesOps
flipLeader(Set<String> allReplicas, String next, org.apache.solr.common.cloud.PerReplicaStates rs)
Flip the leader replica to a new onestatic PerReplicaStatesOps
flipState(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.PerReplicaStates
getPerReplicaStates()
void
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 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 shardnext
- 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 theStat.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)
-
-