jt2594838 commented on code in PR #14551:
URL: https://github.com/apache/iotdb/pull/14551#discussion_r1897696548


##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java:
##########
@@ -1647,39 +1648,60 @@ public TSStatus setConfiguration(TSetConfigurationReq 
req) {
         return tsStatus;
       }
     }
-    if (currentNodeId == req.getNodeId() || req.getNodeId() < 0) {
-      URL url = 
ConfigNodeDescriptor.getPropsUrl(CommonConfig.SYSTEM_CONFIG_NAME);
-      boolean configurationFileFound = (url != null && new 
File(url.getFile()).exists());
-      TrimProperties properties = new TrimProperties();
-      properties.putAll(req.getConfigs());
 
-      if (configurationFileFound) {
-        File file = new File(url.getFile());
-        try {
-          ConfigurationFileUtils.updateConfiguration(
-              file,
-              properties,
-              mergedProps -> {
-                
ConfigNodeDescriptor.getInstance().loadHotModifiedProps(mergedProps);
-              });
-        } catch (Exception e) {
-          tsStatus = RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR, 
e.getMessage());
-        }
-      } else {
-        String msg =
-            "Unable to find the configuration file. Some modifications are 
made only in memory.";
-        tsStatus = RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR, 
msg);
-        LOGGER.warn(msg);
-      }
-      if (currentNodeId == req.getNodeId()) {
-        return tsStatus;
+    if (currentNodeId == req.getNodeId()) {
+      return setConfigLocally(req, null);
+    } else if (req.getNodeId() < 0) {
+      // re-config CN in memory -> re-config DN in memory -> re-config DN in 
file -> re-config CN in
+      // file
+      TSStatus finalTsStatus = tsStatus;
+      return setConfigLocally(
+          req,
+          () -> {
+            List<TSStatus> statusListOfOtherNodes = 
nodeManager.setConfiguration(req);
+            List<TSStatus> statusList = new 
ArrayList<>(statusListOfOtherNodes.size() + 1);
+            statusList.add(finalTsStatus);
+            statusList.addAll(statusListOfOtherNodes);
+            return RpcUtils.squashResponseStatusList(statusList);
+          });
+    } else {
+      // not for this node, ignore it
+      return tsStatus;

Review Comment:
   fixed



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to