SpriCoder commented on code in PR #14710:
URL: https://github.com/apache/iotdb/pull/14710#discussion_r1982681617


##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/memory/MemoryManager.java:
##########
@@ -294,35 +299,35 @@ public synchronized void 
releaseWithOutNotify(IMemoryBlock block) {
    *
    * @param name the name of memory manager
    * @param sizeInBytes the total memory size in bytes of memory manager
-   * @param enable whether memory management is enabled
+   * @param enabled whether memory management is enabled
    * @return the memory manager
    */
   public synchronized MemoryManager getOrCreateMemoryManager(
-      String name, long sizeInBytes, boolean enable) {
-    if (sizeInBytes <= 0) {
-      LOGGER.warn("getOrCreateMemoryManager {}: sizeInBytes should be 
positive", name);
-    }
-    if (this.enable
-        && sizeInBytes + this.allocatedMemorySizeInBytes > 
this.totalMemorySizeInBytes) {
-      LOGGER.warn(
-          "getOrCreateMemoryManager failed: total memory size {} bytes is less 
than allocated memory size {} bytes",
-          sizeInBytes,
-          allocatedMemorySizeInBytes);
-      return null;
-    }
+      String name, long sizeInBytes, boolean enabled) {
     return children.compute(
         name,
         (managerName, manager) -> {
-          if (manager != null) {
+          if (sizeInBytes <= 0) {
+            LOGGER.warn("getOrCreateMemoryManager {}: sizeInBytes should be 
positive", name);
+          }
+          if (this.enabled
+              && sizeInBytes + this.allocatedMemorySizeInBytes > 
this.totalMemorySizeInBytes) {
             LOGGER.warn(
-                "getOrCreateMemoryManager failed: memory manager {} already 
exists, it's size is {}, enable is {}",
+                "getOrCreateMemoryManager failed: total memory size {} bytes 
is less than allocated memory size {} bytes",
+                sizeInBytes,
+                allocatedMemorySizeInBytes);
+            return null;
+          }
+          if (manager != null) {
+            LOGGER.debug(
+                "getOrCreateMemoryManager failed: memory manager {} already 
exists, it's size is {}, enabled is {}",

Review Comment:
   Ok



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