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
ConstructorsConstructorDescriptionZKClusterCoordinator(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 TypeMethodDescriptionvoidclose()Get a collection of available Drillbit endpoints, Thread-safe.org.apache.curator.framework.CuratorFrameworkGet 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 astoreinstance 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> voidstart(long millisToWait) Start the cluster coordinator.voidupdate(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:ClusterCoordinatorStart the cluster coordinator. Millis to wait is- Specified by:
startin 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:
registerin classClusterCoordinator
-
unregister
- Specified by:
unregisterin 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:
updatein classClusterCoordinator
-
getAvailableEndpoints
Description copied from class:ClusterCoordinatorGet a collection of available Drillbit endpoints, Thread-safe. Could be slightly out of date depending on refresh policy.- Specified by:
getAvailableEndpointsin classClusterCoordinator- Returns:
- A collection of available endpoints.
-
getOnlineEndPoints
Description copied from class:ClusterCoordinatorGet 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:
getOnlineEndPointsin classClusterCoordinator- Returns:
- A collection of ONLINE endpoints
-
getSemaphore
- Specified by:
getSemaphorein classClusterCoordinator
-
getOrCreateTransientStore
Description copied from class:ClusterCoordinatorReturns astoreinstance with the givenconfiguration. Note that implementor might cache the instance so new instance creation is not guaranteed.- Specified by:
getOrCreateTransientStorein 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()
-