public class CloudUtil extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_TIMEOUT |
Constructor and Description |
---|
CloudUtil() |
Modifier and Type | Method and Description |
---|---|
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.
|
static CollectionStatePredicate |
clusterShape(int expectedShards,
int expectedReplicas)
Return a
CollectionStatePredicate that returns true if a collection has the expected
number of active shards and replicas |
static CollectionStatePredicate |
clusterShape(int expectedShards,
int expectedReplicas,
boolean withInactive,
boolean requireLeaders)
Return a
CollectionStatePredicate that returns true if a collection has the expected
number of shards and replicas. |
static Map<String,byte[]> |
getTrustedKeys(SolrZkClient zk,
String dir)
Read the list of public keys from ZK
|
static boolean |
replicaExists(ClusterState clusterState,
String collection,
String shard,
String coreNodeName) |
static String |
unifiedResourcePath(SolrResourceLoader loader)
Returns a displayable unified path to the given resource.
|
static long |
waitForState(SolrCloudManager cloudManager,
String collection,
long wait,
TimeUnit unit,
CollectionStatePredicate predicate)
Wait for a particular collection state to appear.
|
static long |
waitForState(SolrCloudManager cloudManager,
String message,
String collection,
CollectionStatePredicate predicate)
Wait for a particular collection state to appear.
|
public static final int DEFAULT_TIMEOUT
public static void checkSharedFSFailoverReplaced(CoreContainer cc, CoreDescriptor desc)
public static boolean replicaExists(ClusterState clusterState, String collection, String shard, String coreNodeName)
public static String unifiedResourcePath(SolrResourceLoader loader)
Note: Do not use this to generate a valid file path, but for debug printing etc
loader
- Resource loader instancepublic static Map<String,byte[]> getTrustedKeys(SolrZkClient zk, String dir)
public static long waitForState(SolrCloudManager cloudManager, String message, String collection, CollectionStatePredicate predicate)
DEFAULT_TIMEOUT
cloudManager
- current instance of SolrCloudManager
message
- a message to report on failurecollection
- the collection to watchpredicate
- a predicate to match against the collection statepublic static long waitForState(SolrCloudManager cloudManager, String collection, long wait, TimeUnit unit, CollectionStatePredicate predicate) throws InterruptedException, TimeoutException, IOException
DEFAULT_TIMEOUT
cloudManager
- current instance of SolrCloudManager
collection
- the collection to watchwait
- timeout valueunit
- timeout unitpredicate
- a predicate to match against the collection stateInterruptedException
TimeoutException
IOException
public static CollectionStatePredicate clusterShape(int expectedShards, int expectedReplicas)
CollectionStatePredicate
that returns true if a collection has the expected
number of active shards and replicasexpectedShards
- expected number of active shardsexpectedReplicas
- expected number of active replicaspublic static CollectionStatePredicate clusterShape(int expectedShards, int expectedReplicas, boolean withInactive, boolean requireLeaders)
CollectionStatePredicate
that 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.
SimCloudManager
follows this behavior.
expectedShards
- expected number of shardsexpectedReplicas
- expected number of active replicas per shardwithInactive
- if true then count also inactive shardsrequireLeaders
- if true then require that each shard has a leaderCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.