You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2023/04/14 15:07:12 UTC

[linkis] branch dev-1.4.0 updated: fix config cache bug (#4457)

This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.4.0
in repository https://gitbox.apache.org/repos/asf/linkis.git


The following commit(s) were added to refs/heads/dev-1.4.0 by this push:
     new 35ff59b88 fix config cache bug (#4457)
35ff59b88 is described below

commit 35ff59b8835ff589283a5e394cba577a16f90707
Author: huangKai-2323 <62...@users.noreply.github.com>
AuthorDate: Fri Apr 14 23:07:06 2023 +0800

    fix config cache bug (#4457)
---
 docs/info-1.4.0.md                                 |  5 +++
 .../restful/api/ConfigurationRestfulApi.java       | 36 ++++++++++++++++++++--
 .../linkis/configuration/conf/Configuration.scala  |  3 ++
 3 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/docs/info-1.4.0.md b/docs/info-1.4.0.md
new file mode 100644
index 000000000..a62dba35a
--- /dev/null
+++ b/docs/info-1.4.0.md
@@ -0,0 +1,5 @@
+## 参数变化
+
+| 模块名(服务名)         | 类型  | 参数名                                                                  | 默认值  | 描述                                                    |
+|------------------| ----- |----------------------------------------------------------------------|------| ------------------------------------------------------- |
+| cg-entrance | 新增  | linkis.entrance.auto.clean.dirty.data.enable | true |entrance重启调用ps-jobhistory接口是否开启,ture为开启,取值范围:true或false|
diff --git a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/restful/api/ConfigurationRestfulApi.java b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/restful/api/ConfigurationRestfulApi.java
index dd4bbc258..283960d5d 100644
--- a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/restful/api/ConfigurationRestfulApi.java
+++ b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/restful/api/ConfigurationRestfulApi.java
@@ -275,9 +275,39 @@ public class ConfigurationRestfulApi {
       version = tmpString[1];
     }
     configurationService.updateUserValue(createList, updateList);
-    configurationService.clearAMCacheConf(username, creator, engine, version);
-    Message message = Message.ok();
-    return message;
+    // TODO: Add a refresh cache interface later
+    if (StringUtils.isNotBlank(creator) && creator.equals("*")) {
+      List<CategoryLabelVo> allCategory = categoryService.getAllCategory(null);
+      List<CategoryLabelVo> categoryLabelVos =
+          allCategory.stream()
+              .filter(s -> s.getCategoryName().equals(Configuration.REMOVE_APPLICATION_CACHE()))
+              .map(CategoryLabelVo::getChildCategory)
+              .findFirst()
+              .get();
+      categoryLabelVos.stream()
+          .map(CategoryLabelVo::getCategoryName)
+          .filter(StringUtils::isNotBlank)
+          .forEach(
+              info -> {
+                String[] tmpString = info.split("-");
+                if (tmpString.length == 2) {
+                  String engineName = tmpString[0];
+                  String engineVersion = tmpString[1];
+                  logger.info(
+                      "Config remove engine cache:engineName:{},engineVersion:{}",
+                      engineName,
+                      engineVersion);
+                  configurationService.clearAMCacheConf(
+                      username,
+                      Configuration.REMOVE_APPLICATION_CACHE(),
+                      engineName,
+                      engineVersion);
+                }
+              });
+    } else {
+      configurationService.clearAMCacheConf(username, creator, engine, version);
+    }
+    return Message.ok();
   }
 
   @ApiOperation(
diff --git a/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/conf/Configuration.scala b/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/conf/Configuration.scala
index 1721241ab..963837ade 100644
--- a/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/conf/Configuration.scala
+++ b/linkis-public-enhancements/linkis-configuration/src/main/scala/org/apache/linkis/configuration/conf/Configuration.scala
@@ -43,4 +43,7 @@ object Configuration {
   val USE_CREATOR_DEFAULE_VALUE =
     CommonVars.apply("wds.linkis.configuration.use.creator.default.value", true).getValue
 
+  val REMOVE_APPLICATION_CACHE =
+    CommonVars.apply("linkis.configuration.remove.application.cache", "IDE").getValue
+
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org