You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "ziyanTOP (via GitHub)" <gi...@apache.org> on 2024/03/19 12:38:56 UTC

[I] [Bug] external audit loader plugin doesn't work after upgrading to 2.1.0 [doris]

ziyanTOP opened a new issue, #32493:
URL: https://github.com/apache/doris/issues/32493

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Version
   
   2.1.0-rc11
   
   ### What's Wrong?
   
   There are two reasons lead to this bug:
   
   <br />
   
   1. The package name of the `AuditEvent` class has been changed from `org.apache.doris.plugin` to `org.apache.doris.plugin.audit`, when worker in `AuditEventProcessor` pass audit event to the old external audit loader plugin, it causes `AbstractMethodError` due to method signature mismatched, and this also makes worker thread down.
   
   <br />
   
   2. The package name of the built-in `AuditLoaderPlugin` class is same with the external one, when try to use `DynamicPluginLoader` to load the external audit loader plugin, it always loads the built-in one due to parent delegation model mechanism.
   
   <br />
   
   Code location:
   
   org.apache.doris.plugin.audit.AuditEvent
   ```java
   package org.apache.doris.plugin.audit;
   ```
   
   <br />
   
   org.apache.doris.qe.AuditEventProcessor
   ```java
       public class Worker implements Runnable {
           @Override
           public void run() {
               ...
               for (Plugin plugin : auditPlugins) {
                   if (((AuditPlugin) plugin).eventFilter(auditEvent.type)) {
                       ((AuditPlugin) plugin).exec(auditEvent);
                   }
               }
               ...
           }
       }
   ```
   
   <br />
   
   org.apache.doris.plugin.DynamicPluginLoader
   ```java
       Plugin dynamicLoadPlugin(boolean closePreviousPlugin) throws IOException, UserException {
           ...
           ClassLoader parentLoader = PluginClassLoader.createLoader(getClass().getClassLoader(), Collections.EMPTY_LIST);
           ClassLoader loader = URLClassLoader.newInstance(jarList.toArray(new URL[0]), parentLoader);
   
           Class<? extends Plugin> pluginClass;
           try {
               pluginClass = loader.loadClass(pluginInfo.getClassName()).asSubclass(Plugin.class);
           } catch (ClassNotFoundException e) {
               throw new UserException("Could not find plugin class [" + pluginInfo.getClassName() + "]", e);
           }
           ...
       }
   ```
   
   ### What You Expected?
   
   the external audit loader plugin can still work after upgrading
   
   ### How to Reproduce?
   
   install audit loader plugin before 2.1.0, then upgrade to 2.1.0
   
   ### Anything Else?
   
   I'd like to submit a PR to add `.ext` in the end of package name of external audit loader plugin, so that it can be loaded by class loader
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [I] [Bug] external audit loader plugin doesn't work after upgrading to 2.1.0 [doris]

Posted by "ziyanTOP (via GitHub)" <gi...@apache.org>.
ziyanTOP closed issue #32493: [Bug] external audit loader plugin doesn't work after upgrading to 2.1.0
URL: https://github.com/apache/doris/issues/32493


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org