Skip to content

Commit

Permalink
[INLONG-9997][Agent] Handling situations where the installation packa…
Browse files Browse the repository at this point in the history
…ge 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
  • Loading branch information
justinwwhuang authored Apr 17, 2024
1 parent 6b5ab82 commit c8c050e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c8c050e

Please sign in to comment.