sijie commented on a change in pull request #4577: fix issue when submitting 
NAR via file url
URL: https://github.com/apache/pulsar/pull/4577#discussion_r296974584
 
 

 ##########
 File path: 
pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java
 ##########
 @@ -318,79 +322,89 @@ public static ExtractedSinkDetails validate(SinkConfig 
sinkConfig, Path archiveP
             throw new IllegalArgumentException("Sink timeout must be a 
positive number");
         }
 
-        String sinkClassName;
-        final Class<?> typeArg;
-        final ClassLoader classLoader;
-        if (!isEmpty(sinkConfig.getClassName())) {
-            sinkClassName = sinkConfig.getClassName();
-            // We really don't know if we should use nar class loader or 
regular classloader
-            ClassLoader jarClassLoader = null;
-            ClassLoader narClassLoader = null;
-            try {
-                jarClassLoader = 
FunctionCommon.extractClassLoader(archivePath, uploadedInputStreamAsFile);
-            } catch (Exception e) {
+
+        Class<?> typeArg;
+        ClassLoader classLoader;
+        String sinkClassName = sinkConfig.getClassName();
+        ClassLoader jarClassLoader = null;
+        ClassLoader narClassLoader = null;
+        try {
+            jarClassLoader = FunctionCommon.extractClassLoader(archivePath, 
sinkPackageFile);
+        } catch (Exception e) {
 
 Review comment:
   @jerrypeng 
   
   first of all, it is going to become very hard to help people to understand 
the problem if we don't log any errors. based on the experiences that I have 
helped with pulsar users, one of the problems is that we don't have enough 
logging information for people to understand what is wrong. I ended up asking 
people adding logging themselves, recompiling the codebase and rerun the 
program again. This is an inefficient approach for helping our pulsar users. 
from this perspective, I would rather having more information than having 
limited information, especially submitting a pulsar function is an end-user 
facing operation. 
   
   secondly, I agreed that it probably doesn't tell you if it is a JAR or NAR. 
but the user who submitted this package, it knows what type is the package. So 
when the log tells him both NAR and JAR class loader can't load the package, he 
knows where to look into the problem. Also there can be errors not just related 
to class loading but other problems (such as malformed url, file not found, 
filesystem io problem). The stack trace will tell you these problems.

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


With regards,
Apache Git Services

Reply via email to