morningman commented on a change in pull request #2463: Add fe plugin framework URL: https://github.com/apache/incubator-doris/pull/2463#discussion_r395083379
########## File path: fe/src/main/java/org/apache/doris/catalog/Catalog.java ########## @@ -6515,6 +6546,77 @@ public void replayReplaceTempPartition(ReplacePartitionOperationLog replaceTempP } } + public void installPlugin(InstallPluginStmt stmt) throws UserException, IOException { + PluginInfo pluginInfo = pluginMgr.installPlugin(stmt); + if (Config.plugin_enable) { + editLog.logInstallPlugin(pluginInfo); + } + LOG.info("install plugin = " + pluginInfo.getName()); + } + + public long savePlugins(DataOutputStream dos, long checksum) throws IOException { + if (!Config.plugin_enable) { + return checksum; + } + + List<PluginInfo> list = pluginMgr.getAllDynamicPluginInfo(); + + int size = list.size(); + checksum ^= size; + + dos.writeInt(size); + + for (PluginInfo pc : list) { + pc.write(dos); + } + + return checksum; + } + + public long loadPlugins(DataInputStream dis, long checksum) throws IOException { + if (!Config.plugin_enable) { + return checksum; + } + + int size = dis.readInt(); + long newChecksum = checksum ^ size; + + for (int i = 0; i < size; i++) { + PluginInfo pluginInfo = PluginInfo.read(dis); + try { + pluginMgr.loadDynamicPlugin(pluginInfo); + } catch (Exception e) { + LOG.warn("load plugin failed.", e); + } + } + + return newChecksum; + } + + public void replayInstallPlugin(PluginInfo pluginInfo) { + try { + pluginMgr.loadDynamicPlugin(pluginInfo); + } catch (Exception e) { + LOG.warn("replay install plugin failed.", e); + } + } + + public void uninstallPlugin(UninstallPluginStmt stmt) throws IOException, UserException { + pluginMgr.uninstallPlugin(stmt.getPluginName()); + if (Config.plugin_enable) { Review comment: You can not modify the meta without writing edit log ---------------------------------------------------------------- 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