diff --git a/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java b/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java index 626c8985e7e..e7a375cfb6c 100755 --- a/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java +++ b/inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java @@ -318,8 +318,10 @@ private void deleteModule(ModuleConfig module) { private void updateModule(ModuleConfig localModule, ModuleConfig managerModule) { LOGGER.info("update module {} start", localModule.getId()); if (localModule.getPackageConfig().getMd5().equals(managerModule.getPackageConfig().getMd5())) { - LOGGER.info("module {} package md5 no change, will restart", localModule.getId()); + LOGGER.info("module {} package md5 no change, will restart and save config", localModule.getId()); restartModule(localModule, managerModule); + managerModule.setState(ModuleStateEnum.INSTALLED); + updateModuleConfig(managerModule); } else { LOGGER.info("module {} package md5 changed, will reinstall", localModule.getId()); deleteModule(localModule); @@ -346,6 +348,11 @@ private void deleteAndSaveModuleConfig(ModuleConfig module) { saveToLocalFile(confPath); } + private void updateModuleConfig(ModuleConfig module) { + currentModules.put(module.getId(), module); + saveToLocalFile(confPath); + } + private boolean saveModuleState(Integer moduleId, ModuleStateEnum state) { ModuleConfig module = currentModules.get(moduleId); if (module == null) { diff --git a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/instance/CommonInstance.java b/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/instance/CommonInstance.java index 08479ceb442..d381c88bd2b 100644 --- a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/instance/CommonInstance.java +++ b/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/instance/CommonInstance.java @@ -70,6 +70,7 @@ public boolean init(Object srcManager, InstanceProfile srcProfile) { profile.getInstanceId(), profile.toJsonStr()); source = (Source) Class.forName(profile.getSourceClass()).newInstance(); source.init(profile); + source.start(); sink = (Sink) Class.forName(profile.getSinkClass()).newInstance(); sink.init(profile); inited = true;