Class RemoteFunctionRegistry
java.lang.Object
org.apache.drill.exec.expr.fn.registry.RemoteFunctionRegistry
- All Implemented Interfaces:
AutoCloseable
Is responsible for remote function registry management.
Creates all remote registry areas at startup and validates them,
during init establishes connections with three udf related stores.
Provides tools to work with three udf related stores, gives access to remote registry areas.
There are three udf stores:
REGISTRY - persistent store, stores remote function registry
UNREGISTRATION - transient store, stores information under udf/unregister path.
udf/unregister path is persistent by itself but any child created will be transient.
Whenever user submits request to unregister jar, child path with jar name is created under this store.
This store also holds unregistration listener, which notifies all drill bits when child path is created,
so they can start local unregistration process.
JARS - transient store, stores information under udf/jars path.
udf/jars path is persistent by itself but any child created will be transient.
Servers as lock, not allowing to perform any action on the same time.
There two types of actions:
There are three udf areas:
STAGING - area where user copies binary and source jars before starting registration process.
REGISTRY - area where registered jars are stored.
TMP - area where source and binary jars are backed up in unique folder during registration process.
UserBitShared.Registry
under udf path
which contains information about all dynamically registered jars and their function signatures.
If connection is created for the first time, puts empty remote registry.RemoteFunctionRegistry.Action.REGISTRATION
and RemoteFunctionRegistry.Action.UNREGISTRATION
.
Before starting any action, users tries to create child path with jar name under this store
and if such path already exists, receives action being performed on that very jar.
When user finishes its action, he deletes child path with jar name.-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddToJars
(String jar, RemoteFunctionRegistry.Action action) void
close()
void
org.apache.hadoop.fs.FileSystem
getFs()
getRegistry
(DataChangeVersion version) org.apache.hadoop.fs.Path
int
Returns current remote function registry version.int
org.apache.hadoop.fs.Path
org.apache.hadoop.fs.Path
boolean
Report whether a remote registry exists.void
init
(DrillConfig config, PersistentStoreProvider storeProvider, ClusterCoordinator coordinator) void
removeFromJars
(String jar) void
void
updateRegistry
(UserBitShared.Registry registryContent, DataChangeVersion version)
-
Constructor Details
-
RemoteFunctionRegistry
-
-
Method Details
-
init
public void init(DrillConfig config, PersistentStoreProvider storeProvider, ClusterCoordinator coordinator) -
getRegistryVersion
public int getRegistryVersion()Returns current remote function registry version. If remote function registry is not found or unreachable, logs error and returns -1.- Returns:
- remote function registry version if any, -1 otherwise
-
hasRegistry
public boolean hasRegistry()Report whether a remote registry exists. During some unit tests, no remote registry exists, so the other methods should not be called.- Returns:
- true if a remote registry exists, false if this a local-only instance and no such registry exists
-
getRegistry
-
submitForUnregistration
-
finishUnregistration
-
addToJars
-
removeFromJars
-
getRetryAttempts
public int getRetryAttempts() -
getFs
public org.apache.hadoop.fs.FileSystem getFs() -
getRegistryArea
public org.apache.hadoop.fs.Path getRegistryArea() -
getStagingArea
public org.apache.hadoop.fs.Path getStagingArea() -
getTmpArea
public org.apache.hadoop.fs.Path getTmpArea() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-