Package org.apache.solr.cloud
Class CloudUtil
- java.lang.Object
- 
- org.apache.solr.cloud.CloudUtil
 
- 
 public class CloudUtil extends Object 
- 
- 
Field SummaryFields Modifier and Type Field Description static intDEFAULT_TIMEOUT
 - 
Constructor SummaryConstructors Constructor Description CloudUtil()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckSharedFSFailoverReplaced(CoreContainer cc, CoreDescriptor desc)See if coreNodeName has been taken over by another baseUrl and unload core + throw exception if it has been.static org.apache.solr.common.cloud.CollectionStatePredicateclusterShape(int expectedShards, int expectedReplicas)Return aCollectionStatePredicatethat returns true if a collection has the expected number of active shards and replicasstatic org.apache.solr.common.cloud.CollectionStatePredicateclusterShape(int expectedShards, int expectedReplicas, boolean withInactive, boolean requireLeaders)Return aCollectionStatePredicatethat returns true if a collection has the expected number of shards and replicas.static Map<String,byte[]>getTrustedKeys(org.apache.solr.common.cloud.SolrZkClient zk, String dir)Read the list of public keys from ZKstatic booleanreplicaExists(org.apache.solr.common.cloud.ClusterState clusterState, String collection, String shard, String coreNodeName)static StringunifiedResourcePath(SolrResourceLoader loader)Returns a displayable unified path to the given resource.static longwaitForState(org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager, String collection, long wait, TimeUnit unit, org.apache.solr.common.cloud.CollectionStatePredicate predicate)Wait for a particular collection state to appear.static longwaitForState(org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager, String message, String collection, org.apache.solr.common.cloud.CollectionStatePredicate predicate)Wait for a particular collection state to appear.
 
- 
- 
- 
Field Detail- 
DEFAULT_TIMEOUTpublic static final int DEFAULT_TIMEOUT - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
checkSharedFSFailoverReplacedpublic static void checkSharedFSFailoverReplaced(CoreContainer cc, CoreDescriptor desc) See if coreNodeName has been taken over by another baseUrl and unload core + throw exception if it has been.
 - 
replicaExistspublic static boolean replicaExists(org.apache.solr.common.cloud.ClusterState clusterState, String collection, String shard, String coreNodeName)
 - 
unifiedResourcePathpublic static String unifiedResourcePath(SolrResourceLoader loader) Returns a displayable unified path to the given resource. For non-solrCloud that will be the same as getConfigDir, but for Cloud it will be getConfigSetZkPath ending in a /Note: Do not use this to generate a valid file path, but for debug printing etc - Parameters:
- loader- Resource loader instance
- Returns:
- a String of path to resource
 
 - 
getTrustedKeyspublic static Map<String,byte[]> getTrustedKeys(org.apache.solr.common.cloud.SolrZkClient zk, String dir) Read the list of public keys from ZK
 - 
waitForStatepublic static long waitForState(org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager, String message, String collection, org.apache.solr.common.cloud.CollectionStatePredicate predicate)Wait for a particular collection state to appear.This is a convenience method using the DEFAULT_TIMEOUT- Parameters:
- cloudManager- current instance of- SolrCloudManager
- message- a message to report on failure
- collection- the collection to watch
- predicate- a predicate to match against the collection state
 
 - 
waitForStatepublic static long waitForState(org.apache.solr.client.solrj.cloud.SolrCloudManager cloudManager, String collection, long wait, TimeUnit unit, org.apache.solr.common.cloud.CollectionStatePredicate predicate) throws InterruptedException, TimeoutException, IOExceptionWait for a particular collection state to appear.This is a convenience method using the DEFAULT_TIMEOUT- Parameters:
- cloudManager- current instance of- SolrCloudManager
- collection- the collection to watch
- wait- timeout value
- unit- timeout unit
- predicate- a predicate to match against the collection state
- Throws:
- InterruptedException
- TimeoutException
- IOException
 
 - 
clusterShapepublic static org.apache.solr.common.cloud.CollectionStatePredicate clusterShape(int expectedShards, int expectedReplicas)Return aCollectionStatePredicatethat returns true if a collection has the expected number of active shards and replicas- Parameters:
- expectedShards- expected number of active shards
- expectedReplicas- expected number of active replicas
 
 - 
clusterShapepublic static org.apache.solr.common.cloud.CollectionStatePredicate clusterShape(int expectedShards, int expectedReplicas, boolean withInactive, boolean requireLeaders)Return aCollectionStatePredicatethat returns true if a collection has the expected number of shards and replicas.Note: for shards marked as inactive the current Solr behavior is that replicas remain active. - Parameters:
- expectedShards- expected number of shards
- expectedReplicas- expected number of active replicas per shard
- withInactive- if true then count also inactive shards
- requireLeaders- if true then require that each shard has a leader
 
 
- 
 
-