[ 
https://issues.apache.org/jira/browse/DRILL-6762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633754#comment-16633754
 ] 

ASF GitHub Bot commented on DRILL-6762:
---------------------------------------

arina-ielchiieva closed pull request #1482: DRILL-6762: Dynamic UDFs registered 
on 1 Drillbit not visible on others
URL: https://github.com/apache/drill/pull/1482
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
index f24f9aaef58..79540500597 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
@@ -408,7 +408,7 @@ private boolean isRegistrySyncNeeded() {
    * @return true is local registry should be refreshed, false otherwise
    */
   private boolean isRegistrySyncNeeded(long remoteVersion, long localVersion) {
-    return remoteVersion != -1 && remoteVersion != localVersion;
+    return remoteVersion != RemoteFunctionRegistry.UNREACHABLE && 
remoteVersion != localVersion;
   }
 
   /**
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/registry/RemoteFunctionRegistry.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/registry/RemoteFunctionRegistry.java
index 4e947656f3a..c2d8a9a932d 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/registry/RemoteFunctionRegistry.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/registry/RemoteFunctionRegistry.java
@@ -84,6 +84,7 @@
   private static final String registry_path = "registry";
   private static final org.slf4j.Logger logger = 
org.slf4j.LoggerFactory.getLogger(RemoteFunctionRegistry.class);
   private static final ObjectMapper mapper = new 
ObjectMapper().enable(INDENT_OUTPUT);
+  public static final int UNREACHABLE = Integer.MIN_VALUE;
 
   private final TransientStoreListener unregistrationListener;
   private int retryAttempts;
@@ -108,9 +109,9 @@ public void init(DrillConfig config, 
PersistentStoreProvider storeProvider, Clus
 
   /**
    * Returns current remote function registry version.
-   * If remote function registry is not found or unreachable, logs error and 
returns -1.
+   * If remote function registry is not found or unreachable, logs error and 
returns UNREACHABLE (Integer.MIN_VALUE) .
    *
-   * @return remote function registry version if any, -1 otherwise
+   * @return remote function registry version if any, 
RemoteFunctionRegistry.UNREACHABLE otherwise
    */
   public long getRegistryVersion() {
     DataChangeVersion version = new DataChangeVersion();
@@ -124,7 +125,7 @@ public long getRegistryVersion() {
       return version.getVersion();
     } else {
       logger.error("Remote function registry [{}] is unreachable", 
registry_path);
-      return -1;
+      return UNREACHABLE;
     }
   }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Dynamic UDFs registered on one Drillbit are not visible on other Drillbits
> --------------------------------------------------------------------------
>
>                 Key: DRILL-6762
>                 URL: https://issues.apache.org/jira/browse/DRILL-6762
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>    Affects Versions: 1.13.0
>            Reporter: Kunal Khatua
>            Assignee: Arina Ielchiieva
>            Priority: Critical
>             Fix For: 1.15.0
>
>         Attachments: Dynamic UDFs issue.pdf
>
>
> Originally Reported : 
> https://stackoverflow.com/questions/52480160/dynamic-udf-in-apache-drill-cluster
> When using a 4-node Drill 1.14 cluster, UDF jars registered on one node are 
> not usable on other nodes despite the {{/registry}} and ZK showing the UDFs 
> as registered.
> This was previously working on 1.13.0
> *Root cause*
> 1. {{VersionedDelegatingStore}} was starting with version -1 and local 
> function registry with version 0. This caused issues when 
> {{LocalPersistentStore}} already existed on the file system. When adding jars 
> into remote registry its versioned was bumped to 0 and synchronization did 
> not happen since local registry had the same version.
> *Fix*: start {{VersionedDelegatingStore}} with version 0, local function 
> registry with undefined version (-2) thus first sync will always happen.
> 2. {{PersistentStoreProvider.getOrCreateVersionedStore}} was wrapping stores 
> into VersionedDelegatingStore for those store providers that did not override 
> this method. Only Zookeeper store was overriding it. But 
> {{VersionedDelegatingStore}} is only keeps versioning locally and thus can be 
> applied only for local stores, i.e. Hbase, Mongo cannot use it.
> {{CachingPersistentStoreProvider}} did not override 
> {{getOrCreateVersionedStore}} either. Mostly all stores in Drill are created 
> using {{CachingPersistentStoreProvider}}. Thus all stores where wrapped into 
> {{VersionedDelegatingStore}}, even Zookeeper one which caused function 
> registries version synchronization issues.
> *Fix*: Add {{UndefinedVersionDelegatingStore}} for those stores that do not 
> support versioning and wrap into it by default in 
> {{PersistentStoreProvider.getOrCreateVersionedStore}} if this method is not 
> overriden. {{UndefinedVersionDelegatingStore}}  will return UNDEFINED version 
> (-2). During sync between remote and local registries if remote registry has 
> UNDEFINED version sync will be done immediately, on the contrary with 
> NOT_AVAILABLE version (-1) which indicates that remote function registry is 
> not accessible.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to