Avoid duplicate DataNode memory configuration initialization - #18467
Avoid duplicate DataNode memory configuration initialization#18467jt2594838 wants to merge 1 commit into
Conversation
|
|
||
| protected IoTDBDescriptor() { | ||
| loadProps(); | ||
| boolean hasLoadedProperties = loadProps(); |
There was a problem hiding this 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.
| /** load a property file and set TsfileDBConfig variables. */ | ||
| @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning | ||
| private void loadProps() { | ||
| private boolean loadProps() { |
There was a problem hiding this 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.
| // 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) { |
There was a problem hiding this 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.
Description
Problem
IoTDBDescriptor initialized the DataNode memory configuration while loading iotdb-system.properties, then initialized it again with default properties whenever no external properties loader was present. The second initialization could discard configuration-derived memory settings.
Changes
Validation
This PR has:
Key changed/added classes (or packages if there are too many classes) in this PR