Class ClusterStateUtil

java.lang.Object
org.apache.solr.common.cloud.ClusterStateUtil

public class ClusterStateUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    getLiveAndActiveReplicaCount(org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection)
     
    static Stream<org.apache.solr.common.cloud.Replica>
    replicasOfActiveSlicesStream(org.apache.solr.common.cloud.DocCollection collectionState)
     
    static String
    toDebugAllStatesString(org.apache.solr.common.cloud.ClusterState clusterState)
    Produces a String of all the collection states for debugging.
    static boolean
    waitFor(org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, long timeout, TimeUnit timeUnit, org.apache.solr.common.cloud.CollectionStatePredicate predicate)
    Calls ZkStateReader.waitForState(String, long, TimeUnit, CollectionStatePredicate) but has an alternative implementation if collection is null, in which the predicate must match *all* collections.
    static boolean
    waitForAllActiveAndLiveReplicas(org.apache.solr.common.cloud.ZkStateReader zkStateReader, int timeoutInMs)
    Wait to see *all* cores live and active.
    static boolean
    waitForAllActiveAndLiveReplicas(org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, int timeoutInMs)
    Wait to see *all* cores live and active.
    static boolean
    waitForAllReplicasNotLive(org.apache.solr.common.cloud.ZkStateReader zkStateReader, int timeoutInMs)
     
    static boolean
    waitForAllReplicasNotLive(org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, int timeoutInMs)
     
    static boolean
    waitForLiveAndActiveReplicaCount(org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, int replicaCount, int timeoutInMs)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ClusterStateUtil

      public ClusterStateUtil()
  • Method Details

    • waitForAllActiveAndLiveReplicas

      public static boolean waitForAllActiveAndLiveReplicas(org.apache.solr.common.cloud.ZkStateReader zkStateReader, int timeoutInMs)
      Wait to see *all* cores live and active.
      Parameters:
      zkStateReader - to use for ClusterState
      timeoutInMs - how long to wait before giving up
      Returns:
      false if timed out
    • waitForAllActiveAndLiveReplicas

      public static boolean waitForAllActiveAndLiveReplicas(org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, int timeoutInMs)
      Wait to see *all* cores live and active.
      Parameters:
      zkStateReader - to use for ClusterState
      collection - to look at
      timeoutInMs - how long to wait before giving up
      Returns:
      false if timed out
    • waitForAllReplicasNotLive

      public static boolean waitForAllReplicasNotLive(org.apache.solr.common.cloud.ZkStateReader zkStateReader, int timeoutInMs)
    • waitForAllReplicasNotLive

      public static boolean waitForAllReplicasNotLive(org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, int timeoutInMs)
    • getLiveAndActiveReplicaCount

      public static int getLiveAndActiveReplicaCount(org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection)
    • replicasOfActiveSlicesStream

      public static Stream<org.apache.solr.common.cloud.Replica> replicasOfActiveSlicesStream(org.apache.solr.common.cloud.DocCollection collectionState)
    • waitForLiveAndActiveReplicaCount

      public static boolean waitForLiveAndActiveReplicaCount(org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, int replicaCount, int timeoutInMs)
    • waitFor

      public static boolean waitFor(org.apache.solr.common.cloud.ZkStateReader zkStateReader, String collection, long timeout, TimeUnit timeUnit, org.apache.solr.common.cloud.CollectionStatePredicate predicate)
      Calls ZkStateReader.waitForState(String, long, TimeUnit, CollectionStatePredicate) but has an alternative implementation if collection is null, in which the predicate must match *all* collections. Returns whether the predicate matches or not in the allotted time; does *NOT* throw TimeoutException.
    • toDebugAllStatesString

      public static String toDebugAllStatesString(org.apache.solr.common.cloud.ClusterState clusterState)
      Produces a String of all the collection states for debugging. ZK may be consulted.