xy720 commented on a change in pull request #4704:
URL: https://github.com/apache/incubator-doris/pull/4704#discussion_r502412386



##########
File path: docs/zh-CN/administrator-guide/config/be_config.md
##########
@@ -45,9 +52,15 @@ BE 的配置项有两种方式进行配置:
 
        BE 启动后,可以通过一下命令动态设置配置项。
 
-       ```curl -X POST 
http://{be_ip}:{be_http_port}/api/update_config?{key}={value}'```
+       ```
+       curl -X POST 
http://{be_ip}:{be_http_port}/api/update_config?{key}={value}'
+       ```
 
-       **通过该方式修改的配置项将在 BE 进程重启后失效。**
+       在 0.13 版本及之前,通过该方式修改的配置项将在 BE 进程重启后失效。在 0.14 
及之后版本中,可以通过以下命令持久化修改后的配置。修改后的配置项存储在 `be_custom.conf` 文件中。
+       
+       ```
+       curl -X POST 
http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persis=true'

Review comment:
       ```suggestion
        curl -X POST 
http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persist=true'
   ```

##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/ConfigBase.java
##########
@@ -284,4 +308,31 @@ public synchronized static boolean 
checkIsMasterOnly(String key) {
 
         return anno.masterOnly();
     }
+
+    // overwrite configs to customConfFile.
+    // use synchronized to make sure only one thread modify this file
+    public synchronized static void persistConfig(Map<String, String> 
customConf) throws IOException {
+        File file = new File(customConfFile);
+        if (!file.exists()) {
+            file.createNewFile();
+        } else {
+            // clear the file content
+            try (PrintWriter writer = new PrintWriter(file)) {
+                writer.print("");
+            }
+        }
+
+        Properties props = new Properties();
+        props.load(new FileReader(customConfFile));
+
+        for (Map.Entry<String, String> entry : customConf.entrySet()) {
+            props.setProperty(entry.getKey(), entry.getValue());
+        }
+
+        try (FileOutputStream fos = new FileOutputStream(file)) {
+            props.store(fos, "THIS IS AN AUTO GENERATED CONFIG FILE. DO NOT 
EDIT IT!\n\n" +

Review comment:
       I think users can edit this file if they need to.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to