Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INLONG-9997][Agent] Handling situations where the installation package md5 remains unchanged and other parameters md5 change #9998

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading