This is an automated email from the ASF dual-hosted git repository.
wenweihuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new c8c050e333 [INLONG-9997][Agent] Handling situations where the
installation package md5 remains unchanged and other parameters md5 change
(#9998)
c8c050e333 is described below
commit c8c050e333ddbd92367bbbc0ac3f7a0f1056c344
Author: justinwwhuang <[email protected]>
AuthorDate: Wed Apr 17 10:18:50 2024 +0800
[INLONG-9997][Agent] Handling situations where the installation package md5
remains unchanged and other parameters md5 change (#9998)
* [INLONG-9997][Agent]Handling situations where the installation package
md5 remains unchanged and other parameters md5 change
* [INLONG-9997][Agent] Handling situations where the installation package
md5 remains unchanged and other parameters md5 change
---
.../java/org/apache/inlong/agent/installer/ModuleManager.java | 9 ++++++++-
.../org/apache/inlong/agent/plugin/instance/CommonInstance.java | 1 +
2 files changed, 9 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 626c8985e7..e7a375cfb6 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 @@ public class ModuleManager extends AbstractDaemon {
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 @@ public class ModuleManager extends AbstractDaemon {
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 08479ceb44..d381c88bd2 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 abstract class CommonInstance extends Instance {
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;