From 7530535601715a074eb29860bb077875f48bfdf5 Mon Sep 17 00:00:00 2001 From: wenweihuang Date: Tue, 16 Apr 2024 19:18:26 +0800 Subject: [PATCH 1/2] [INLONG-9997][Agent]Handling situations where the installation package md5 remains unchanged and other parameters md5 change --- .../org/apache/inlong/agent/installer/ModuleManager.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) { From d9a97bcc687cb103162514b6c7fceb90ea19c361 Mon Sep 17 00:00:00 2001 From: wenweihuang Date: Tue, 16 Apr 2024 19:27:29 +0800 Subject: [PATCH 2/2] [INLONG-9997][Agent] Handling situations where the installation package md5 remains unchanged and other parameters md5 change --- .../org/apache/inlong/agent/plugin/instance/CommonInstance.java | 1 + 1 file changed, 1 insertion(+) 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;