From 90c86ea7aeeacc02bba9277a1e822076ec33c68c Mon Sep 17 00:00:00 2001 From: benjobs Date: Tue, 8 Oct 2024 12:18:59 +0800 Subject: [PATCH] [Improve] app backup minor improvements --- .../impl/ApplicationBackUpServiceImpl.java | 43 ++++++------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationBackUpServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationBackUpServiceImpl.java index 5a95ff5e70..780acff701 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationBackUpServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationBackUpServiceImpl.java @@ -207,37 +207,22 @@ public Boolean delete(Long id) throws InternalException { @Override @Transactional(rollbackFor = {Exception.class}) public void backup(Application application, FlinkSql flinkSql) { - // basic configuration file backup - log.info("skip backup.."); - if (application != null) { - return; + ApplicationConfig config = configService.getEffective(application.getId()); + if (config != null) { + application.setConfigId(config.getId()); + } + // flink sql tasks need to back up sql and dependencies + int version = 1; + if (flinkSql != null) { + application.setSqlId(flinkSql.getId()); + version = flinkSql.getVersion(); + } else if (config != null) { + version = config.getVersion(); } - String appHome = - (application.isCustomCodeJob() && application.isCICDJob()) - ? application.getDistHome() - : application.getAppHome(); - FsOperator fsOperator = application.getFsOperator(); - if (fsOperator.exists(appHome)) { - // move files to back up directory - ApplicationConfig config = configService.getEffective(application.getId()); - if (config != null) { - application.setConfigId(config.getId()); - } - // flink sql tasks need to back up sql and dependencies - int version = 1; - if (flinkSql != null) { - application.setSqlId(flinkSql.getId()); - version = flinkSql.getVersion(); - } else if (config != null) { - version = config.getVersion(); - } - ApplicationBackUp applicationBackUp = new ApplicationBackUp(application); - applicationBackUp.setVersion(version); + ApplicationBackUp applicationBackUp = new ApplicationBackUp(application); + applicationBackUp.setVersion(version); - this.save(applicationBackUp); - fsOperator.mkdirs(applicationBackUp.getPath()); - fsOperator.copyDir(appHome, applicationBackUp.getPath()); - } + this.save(applicationBackUp); } }