org.apache.solr.common.cloud
Class ZkStateReader

java.lang.Object
  extended by org.apache.solr.common.cloud.ZkStateReader

public class ZkStateReader
extends Object


Field Summary
static String ACTIVE
           
static String ALIASES
           
static String BASE_URL_PROP
           
static String CLUSTER_PROPS
           
static String CLUSTER_STATE
           
static String COLLECTION_PROP
           
static String COLLECTIONS_ZKNODE
           
static String CONFIGNAME_PROP
           
static String CONFIGS_ZKNODE
           
static String CORE_NAME_PROP
           
static String CORE_NODE_NAME_PROP
           
static String DOWN
           
static String LEADER_ELECT_ZKNODE
           
static String LEADER_PROP
           
static String LIVE_NODES_ZKNODE
           
static String NODE_NAME_PROP
           
static String NUM_SHARDS_PROP
           
static String RECOVERING
           
static String RECOVERY_FAILED
           
static String REPLICA_PROP
           
static String ROLES
           
static String ROLES_PROP
           
static String SHARD_ID_PROP
           
static String SHARD_LEADERS_ZKNODE
           
static String SHARD_PARENT_PROP
           
static String SHARD_RANGE_PROP
           
static String SHARD_STATE_PROP
           
static String STATE_PROP
           
static String SYNC
           
 
Constructor Summary
ZkStateReader(SolrZkClient zkClient)
           
ZkStateReader(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout)
           
 
Method Summary
 void close()
           
 void createClusterStateWatchersAndUpdate()
           
static Object fromJSON(byte[] utf8)
           
 Aliases getAliases()
           
 Set<String> getAllCollections()
           
 String getBaseUrlForNodeName(String nodeName)
          Returns the baseURL corrisponding to a given node's nodeName -- NOTE: does not (currently) imply that the nodeName (or resulting baseURL) exists in the cluster.
 Map getClusterProps()
           
 ClusterState getClusterState()
           
 Replica getLeaderRetry(String collection, String shard)
          Get shard leader properties, with retry if none exist.
 Replica getLeaderRetry(String collection, String shard, int timeout)
          Get shard leader properties, with retry if none exist.
 String getLeaderUrl(String collection, String shard, int timeout)
           
 List<ZkCoreNodeProps> getReplicaProps(String collection, String shardId, String thisCoreNodeName, String coreName)
           
 List<ZkCoreNodeProps> getReplicaProps(String collection, String shardId, String thisCoreNodeName, String coreName, String mustMatchStateFilter)
           
 List<ZkCoreNodeProps> getReplicaProps(String collection, String shardId, String thisCoreNodeName, String coreName, String mustMatchStateFilter, String mustNotMatchStateFilter)
           
static String getShardLeadersPath(String collection, String shardId)
          Get path where shard leader properties live in zookeeper.
 Object getUpdateLock()
           
 SolrZkClient getZkClient()
           
 String readConfigName(String collection)
          Returns config set name for collection.
static byte[] toJSON(Object o)
           
static byte[] toUTF8(org.noggit.CharArr out)
           
 void updateAliases()
           
 void updateClusterState(boolean immediate)
           
 void updateLiveNodes()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_URL_PROP

public static final String BASE_URL_PROP
See Also:
Constant Field Values

NODE_NAME_PROP

public static final String NODE_NAME_PROP
See Also:
Constant Field Values

CORE_NODE_NAME_PROP

public static final String CORE_NODE_NAME_PROP
See Also:
Constant Field Values

ROLES_PROP

public static final String ROLES_PROP
See Also:
Constant Field Values

STATE_PROP

public static final String STATE_PROP
See Also:
Constant Field Values

CORE_NAME_PROP

public static final String CORE_NAME_PROP
See Also:
Constant Field Values

COLLECTION_PROP

public static final String COLLECTION_PROP
See Also:
Constant Field Values

SHARD_ID_PROP

public static final String SHARD_ID_PROP
See Also:
Constant Field Values

REPLICA_PROP

public static final String REPLICA_PROP
See Also:
Constant Field Values

SHARD_RANGE_PROP

public static final String SHARD_RANGE_PROP
See Also:
Constant Field Values

SHARD_STATE_PROP

public static final String SHARD_STATE_PROP
See Also:
Constant Field Values

SHARD_PARENT_PROP

public static final String SHARD_PARENT_PROP
See Also:
Constant Field Values

NUM_SHARDS_PROP

public static final String NUM_SHARDS_PROP
See Also:
Constant Field Values

LEADER_PROP

public static final String LEADER_PROP
See Also:
Constant Field Values

COLLECTIONS_ZKNODE

public static final String COLLECTIONS_ZKNODE
See Also:
Constant Field Values

LIVE_NODES_ZKNODE

public static final String LIVE_NODES_ZKNODE
See Also:
Constant Field Values

ALIASES

public static final String ALIASES
See Also:
Constant Field Values

CLUSTER_STATE

public static final String CLUSTER_STATE
See Also:
Constant Field Values

CLUSTER_PROPS

public static final String CLUSTER_PROPS
See Also:
Constant Field Values

ROLES

public static final String ROLES
See Also:
Constant Field Values

RECOVERING

public static final String RECOVERING
See Also:
Constant Field Values

RECOVERY_FAILED

public static final String RECOVERY_FAILED
See Also:
Constant Field Values

ACTIVE

public static final String ACTIVE
See Also:
Constant Field Values

DOWN

public static final String DOWN
See Also:
Constant Field Values

SYNC

public static final String SYNC
See Also:
Constant Field Values

CONFIGS_ZKNODE

public static final String CONFIGS_ZKNODE
See Also:
Constant Field Values

CONFIGNAME_PROP

public static final String CONFIGNAME_PROP
See Also:
Constant Field Values

LEADER_ELECT_ZKNODE

public static final String LEADER_ELECT_ZKNODE
See Also:
Constant Field Values

SHARD_LEADERS_ZKNODE

public static final String SHARD_LEADERS_ZKNODE
See Also:
Constant Field Values
Constructor Detail

ZkStateReader

public ZkStateReader(SolrZkClient zkClient)

ZkStateReader

public ZkStateReader(String zkServerAddress,
                     int zkClientTimeout,
                     int zkClientConnectTimeout)
              throws InterruptedException,
                     TimeoutException,
                     IOException
Throws:
InterruptedException
TimeoutException
IOException
Method Detail

toJSON

public static byte[] toJSON(Object o)

toUTF8

public static byte[] toUTF8(org.noggit.CharArr out)

fromJSON

public static Object fromJSON(byte[] utf8)

readConfigName

public String readConfigName(String collection)
                      throws org.apache.zookeeper.KeeperException,
                             InterruptedException
Returns config set name for collection.

Parameters:
collection - to return config set name for
Throws:
org.apache.zookeeper.KeeperException
InterruptedException

updateClusterState

public void updateClusterState(boolean immediate)
                        throws org.apache.zookeeper.KeeperException,
                               InterruptedException
Throws:
org.apache.zookeeper.KeeperException
InterruptedException

updateLiveNodes

public void updateLiveNodes()
                     throws org.apache.zookeeper.KeeperException,
                            InterruptedException
Throws:
org.apache.zookeeper.KeeperException
InterruptedException

getAliases

public Aliases getAliases()

createClusterStateWatchersAndUpdate

public void createClusterStateWatchersAndUpdate()
                                         throws org.apache.zookeeper.KeeperException,
                                                InterruptedException
Throws:
org.apache.zookeeper.KeeperException
InterruptedException

getClusterState

public ClusterState getClusterState()
Returns:
information about the cluster from ZooKeeper

getUpdateLock

public Object getUpdateLock()

close

public void close()

getLeaderUrl

public String getLeaderUrl(String collection,
                           String shard,
                           int timeout)
                    throws InterruptedException,
                           org.apache.zookeeper.KeeperException
Throws:
InterruptedException
org.apache.zookeeper.KeeperException

getLeaderRetry

public Replica getLeaderRetry(String collection,
                              String shard)
                       throws InterruptedException
Get shard leader properties, with retry if none exist.

Throws:
InterruptedException

getLeaderRetry

public Replica getLeaderRetry(String collection,
                              String shard,
                              int timeout)
                       throws InterruptedException
Get shard leader properties, with retry if none exist.

Throws:
InterruptedException

getShardLeadersPath

public static String getShardLeadersPath(String collection,
                                         String shardId)
Get path where shard leader properties live in zookeeper.


getReplicaProps

public List<ZkCoreNodeProps> getReplicaProps(String collection,
                                             String shardId,
                                             String thisCoreNodeName,
                                             String coreName)

getReplicaProps

public List<ZkCoreNodeProps> getReplicaProps(String collection,
                                             String shardId,
                                             String thisCoreNodeName,
                                             String coreName,
                                             String mustMatchStateFilter)

getReplicaProps

public List<ZkCoreNodeProps> getReplicaProps(String collection,
                                             String shardId,
                                             String thisCoreNodeName,
                                             String coreName,
                                             String mustMatchStateFilter,
                                             String mustNotMatchStateFilter)

getZkClient

public SolrZkClient getZkClient()

getAllCollections

public Set<String> getAllCollections()

updateAliases

public void updateAliases()
                   throws org.apache.zookeeper.KeeperException,
                          InterruptedException
Throws:
org.apache.zookeeper.KeeperException
InterruptedException

getClusterProps

public Map getClusterProps()

getBaseUrlForNodeName

public String getBaseUrlForNodeName(String nodeName)
Returns the baseURL corrisponding to a given node's nodeName -- NOTE: does not (currently) imply that the nodeName (or resulting baseURL) exists in the cluster.

WARNING: This API is experimental and might change in incompatible ways in the next release.


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.