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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java:
##########
@@ -141,7 +141,7 @@ public class IoTDBDescriptor {
   }
 
   protected IoTDBDescriptor() {
-    loadProps();
+    boolean hasLoadedProperties = loadProps();

Review Comment:
   Capture whether the system properties source was loaded because 
loadProperties initializes memoryConfig as part of that path. The constructor 
needs this state to distinguish an already configured memory manager from the 
no-configuration fallback.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java:
##########
@@ -167,8 +167,8 @@ protected IoTDBDescriptor() {
           .getConfig()
           .setCustomizedProperties(loader.getCustomizedProperties());
     }
-    // if there are no properties, we need to init memory config
-    if (!hasProperties) {
+    // If no configuration source initialized the memory config, initialize it 
with defaults.
+    if (!hasLoadedProperties && !hasProperties) {

Review Comment:
   Require both configuration sources to be absent before applying defaults. 
This preserves values loaded from iotdb-system.properties while retaining the 
existing fallback when neither the system file nor an external loader is 
available.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java:
##########
@@ -227,7 +227,7 @@ else if (!urlString.endsWith(".properties")) {
 
   /** load a property file and set TsfileDBConfig variables. */
   @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity 
warning
-  private void loadProps() {
+  private boolean loadProps() {

Review Comment:
   Return a boolean from loadProps so callers can tell whether this method 
reached the configuration-loading path. The true and false returns mirror the 
existing URL-present and URL-absent branches without changing their error 
handling.



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