Seaven commented on a change in pull request #3219: [Plugin] Making FE audit module pluggable URL: https://github.com/apache/incubator-doris/pull/3219#discussion_r399930246
########## File path: fe/src/main/java/org/apache/doris/plugin/PluginMgr.java ########## @@ -76,14 +87,21 @@ public PluginInfo installPlugin(InstallPluginStmt stmt) throws IOException, User try { PluginInfo info = pluginLoader.getPluginInfo(); - if (plugins[info.getTypeId()].putIfAbsent(info.getName(), pluginLoader) != null) { - pluginLoader.uninstall(); + if (plugins[info.getTypeId()].containsKey(info.getName())) { throw new UserException("plugin " + info.getName() + " has already been installed."); } - + // install plugin pluginLoader.install(); pluginLoader.setStatus(PluginStatus.INSTALLED); + + if (plugins[info.getTypeId()].putIfAbsent(info.getName(), pluginLoader) != null) { + pluginLoader.uninstall(); Review comment: We can't uninstall the plugin here, because it may cause the actual plugin to be uninstalled by mistake ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org