Package org.apache.drill.yarn.zk
Class ZKClusterCoordinator
java.lang.Object
org.apache.drill.exec.coord.ClusterCoordinator
org.apache.drill.yarn.zk.ZKClusterCoordinator
- All Implemented Interfaces:
AutoCloseable
Manages cluster coordination utilizing zookeeper.
This is a clone of the Drill class org.apache.drill.exec.coord.zk.ZKClusterCoordinator with a number of modifications:
- Removed dependency on the Drill config system. That system uses Google's Guava library version 18, which conflicts with the earlier versions used by YARN and Hadoop, which resulted in runtime undefined method exceptions.
- Instead of getting config information out of the Drill config, the parameters are instead passed directly.
- Adds support for the drillbits registered event which was neither needed nor implemented by Drill.
- Use the YARN logging system instead of Drill's.
This class should be replaced by the Drill version if/when the Guava conflicts can be resolved (and when registered Drillbit notifications are added to the Drill version.)
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.drill.exec.coord.ClusterCoordinator
ClusterCoordinator.RegistrationHandle
-
Field Summary
Fields inherited from class org.apache.drill.exec.coord.ClusterCoordinator
listeners
-
Constructor Summary
ConstructorDescriptionZKClusterCoordinator
(String connect, String zkRoot, String clusterId, int retryCount, int retryDelayMs, int connectTimeoutMs) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Get a collection of available Drillbit endpoints, Thread-safe.org.apache.curator.framework.CuratorFramework
Get a collection of ONLINE drillbit endpoints by excluding the drillbits that are in QUIESCENT state (drillbits that are shutting down).<V> TransientStore<V>
getOrCreateTransientStore
(TransientStoreConfig<V> config) Returns astore
instance with the givenconfiguration
.getSemaphore
(String name, int maximumLeases) protected org.apache.curator.x.discovery.ServiceDiscovery<CoordinationProtos.DrillbitEndpoint>
protected org.apache.curator.x.discovery.ServiceInstance<CoordinationProtos.DrillbitEndpoint>
void
start
(long millisToWait) Start the cluster coordinator.void
update
(ClusterCoordinator.RegistrationHandle handle, CoordinationProtos.DrillbitEndpoint.State state) Methods inherited from class org.apache.drill.exec.coord.ClusterCoordinator
addDrillbitStatusListener, drillbitRegistered, drillbitUnregistered, isDrillbitInState, removeDrillbitStatusListener
-
Field Details
-
logger
protected static final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
ZKClusterCoordinator
public ZKClusterCoordinator(String connect, String zkRoot, String clusterId, int retryCount, int retryDelayMs, int connectTimeoutMs) throws IOException - Throws:
IOException
-
-
Method Details
-
getCurator
public org.apache.curator.framework.CuratorFramework getCurator() -
start
Description copied from class:ClusterCoordinator
Start the cluster coordinator. Millis to wait is- Specified by:
start
in classClusterCoordinator
- Parameters:
millisToWait
- The maximum time to wait before throwing an exception if the cluster coordination service has not successfully started. Use 0 to wait indefinitely.- Throws:
Exception
- in case when unable to start coordinator
-
close
- Throws:
Exception
-
register
- Specified by:
register
in classClusterCoordinator
-
unregister
- Specified by:
unregister
in classClusterCoordinator
-
getAvailableEndpoints
Description copied from class:ClusterCoordinator
Get a collection of available Drillbit endpoints, Thread-safe. Could be slightly out of date depending on refresh policy.- Specified by:
getAvailableEndpoints
in classClusterCoordinator
- Returns:
- A collection of available endpoints.
-
getSemaphore
- Specified by:
getSemaphore
in classClusterCoordinator
-
getOrCreateTransientStore
Description copied from class:ClusterCoordinator
Returns astore
instance with the givenconfiguration
. Note that implementor might cache the instance so new instance creation is not guaranteed.- Specified by:
getOrCreateTransientStore
in classClusterCoordinator
- Type Parameters:
V
- value type for this store- Parameters:
config
- store configuration
-
newServiceInstance
protected org.apache.curator.x.discovery.ServiceInstance<CoordinationProtos.DrillbitEndpoint> newServiceInstance(CoordinationProtos.DrillbitEndpoint endpoint) throws Exception - Throws:
Exception
-
newDiscovery
protected org.apache.curator.x.discovery.ServiceDiscovery<CoordinationProtos.DrillbitEndpoint> newDiscovery() -
getOnlineEndPoints
Description copied from class:ClusterCoordinator
Get a collection of ONLINE drillbit endpoints by excluding the drillbits that are in QUIESCENT state (drillbits that are shutting down). Primarily used by the planner to plan queries only on ONLINE drillbits and used by the client during initial connection phase to connect to a drillbit (foreman)- Specified by:
getOnlineEndPoints
in classClusterCoordinator
- Returns:
- A collection of ONLINE endpoints
-
update
public ClusterCoordinator.RegistrationHandle update(ClusterCoordinator.RegistrationHandle handle, CoordinationProtos.DrillbitEndpoint.State state) - Specified by:
update
in classClusterCoordinator
-