Package org.apache.drill.exec.coord
Class ClusterCoordinator
java.lang.Object
org.apache.drill.exec.coord.ClusterCoordinator
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
LocalClusterCoordinator
,ZKClusterCoordinator
,ZKClusterCoordinator
Pluggable interface built to manage cluster coordination. Allows Drillbit or DrillClient to register its capabilities
as well as understand other node's existence and capabilities.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescription -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Register a DrillbitStatusListener.protected void
drillbitRegistered
(Set<CoordinationProtos.DrillbitEndpoint> registeredBits) protected void
drillbitUnregistered
(Set<CoordinationProtos.DrillbitEndpoint> unregisteredBits) Actions to take when there are a set of new de-active drillbits.Get a collection of available Drillbit endpoints, Thread-safe.Get a collection of ONLINE drillbit endpoints by excluding the drillbits that are in QUIESCENT state (drillbits that are shutting down).abstract <V> TransientStore<V>
getOrCreateTransientStore
(TransientStoreConfig<V> config) Returns astore
instance with the givenconfiguration
.abstract DistributedSemaphore
getSemaphore
(String name, int maximumLeases) boolean
isDrillbitInState
(CoordinationProtos.DrillbitEndpoint endpoint, CoordinationProtos.DrillbitEndpoint.State state) void
Unregister a DrillbitStatusListener.abstract void
start
(long millisToWait) Start the cluster coordinator.abstract void
update
(ClusterCoordinator.RegistrationHandle handle, CoordinationProtos.DrillbitEndpoint.State state) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.AutoCloseable
close
-
Field Details
-
listeners
-
-
Constructor Details
-
ClusterCoordinator
public ClusterCoordinator()
-
-
Method Details
-
start
Start the cluster coordinator. Millis to wait is- 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
-
register
public abstract ClusterCoordinator.RegistrationHandle register(CoordinationProtos.DrillbitEndpoint data) -
unregister
-
getAvailableEndpoints
Get a collection of available Drillbit endpoints, Thread-safe. Could be slightly out of date depending on refresh policy.- Returns:
- A collection of available endpoints.
-
getOnlineEndPoints
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)- Returns:
- A collection of ONLINE endpoints
-
update
public abstract ClusterCoordinator.RegistrationHandle update(ClusterCoordinator.RegistrationHandle handle, CoordinationProtos.DrillbitEndpoint.State state) -
getSemaphore
-
getOrCreateTransientStore
Returns astore
instance with the givenconfiguration
. Note that implementor might cache the instance so new instance creation is not guaranteed.- Type Parameters:
V
- value type for this store- Parameters:
config
- store configuration
-
drillbitUnregistered
Actions to take when there are a set of new de-active drillbits.- Parameters:
unregisteredBits
- set of drillbits to unregister
-
drillbitRegistered
-
addDrillbitStatusListener
Register a DrillbitStatusListener. Note : the listeners are not guaranteed to be called in the order in which they call this method, since all the listeners are in a ConcurrentHashMap.- Parameters:
listener
- status listener
-
removeDrillbitStatusListener
Unregister a DrillbitStatusListener.- Parameters:
listener
- status listener
-
isDrillbitInState
public boolean isDrillbitInState(CoordinationProtos.DrillbitEndpoint endpoint, CoordinationProtos.DrillbitEndpoint.State state)
-