Class RemoteFunctionRegistry

java.lang.Object
org.apache.drill.exec.expr.fn.registry.RemoteFunctionRegistry
All Implemented Interfaces:
AutoCloseable

public class RemoteFunctionRegistry extends Object implements 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 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.
  • 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: 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.
  • 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.
    • Constructor Details

    • 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

        public UserBitShared.Registry getRegistry(DataChangeVersion version)
      • updateRegistry

        public void updateRegistry(UserBitShared.Registry registryContent, DataChangeVersion version) throws VersionMismatchException
        Throws:
        VersionMismatchException
      • submitForUnregistration

        public void submitForUnregistration(String jar)
      • finishUnregistration

        public void finishUnregistration(String jar)
      • addToJars

        public String addToJars(String jar, RemoteFunctionRegistry.Action action)
      • removeFromJars

        public void removeFromJars(String jar)
      • 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 interface AutoCloseable