Package org.apache.drill.exec.coord.zk
Class ZKClusterCoordinator
java.lang.Object
org.apache.drill.exec.coord.ClusterCoordinator
org.apache.drill.exec.coord.zk.ZKClusterCoordinator
- All Implemented Interfaces:
AutoCloseable
Manages cluster coordination utilizing zookeeper. *
-
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
(DrillConfig config, String connect) ZKClusterCoordinator
(DrillConfig config, String connect, boolean createNamespace, org.apache.curator.framework.api.ACLProvider aclProvider) ZKClusterCoordinator
(DrillConfig config, org.apache.curator.framework.api.ACLProvider aclProvider) -
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) Update drillbit endpoint state.Methods inherited from class org.apache.drill.exec.coord.ClusterCoordinator
addDrillbitStatusListener, drillbitRegistered, drillbitUnregistered, isDrillbitInState, removeDrillbitStatusListener
-
Constructor Details
-
ZKClusterCoordinator
- Throws:
Exception
-
ZKClusterCoordinator
public ZKClusterCoordinator(DrillConfig config, org.apache.curator.framework.api.ACLProvider aclProvider) throws Exception - Throws:
Exception
-
ZKClusterCoordinator
public ZKClusterCoordinator(DrillConfig config, String connect, boolean createNamespace, org.apache.curator.framework.api.ACLProvider aclProvider) throws Exception - Throws:
Exception
-
-
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
-
update
public ClusterCoordinator.RegistrationHandle update(ClusterCoordinator.RegistrationHandle handle, CoordinationProtos.DrillbitEndpoint.State state) Update drillbit endpoint state. Drillbit advertises its state in Zookeeper when a shutdown request of drillbit is triggered. State information is used during planning and initial client connection phases.- Specified by:
update
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.
-
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
-
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()
-