shizy818 commented on code in PR #16932:
URL: https://github.com/apache/iotdb/pull/16932#discussion_r2634335787


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/MemoryReservationManager.java:
##########
@@ -43,4 +45,23 @@ public interface MemoryReservationManager {
    * this manager ends, Or the memory to be released in the batch may not be 
released correctly.
    */
   void releaseAllReservedMemory();
+
+  /**
+   * Release memory virtually without actually freeing the memory. This is 
used for memory
+   * reservation transfer scenarios where memory ownership needs to be 
transferred between different
+   * FragmentInstances without actual memory deallocation.
+   *
+   * <p>NOTE: When calling this method, it should be guaranteed that 
bytesToBeReserved +
+   * reservedBytesInTotal >= size to ensure proper memory accounting and 
prevent negative
+   * reservation values.
+   */
+  Pair<Long, Long> releaseMemoryVirtually(final long size);
+
+  /**
+   * Reserve memory virtually without actually allocating new memory. This is 
used to transfer
+   * memory ownership from one FragmentInstances to another by reserving the 
memory that was
+   * previously released virtually. It updates the internal reservation state 
without changing the
+   * actual memory allocation.
+   */
+  void reserveMemoryVirtually(final long releasedBytesInReserved, final long 
releasedBytesInTotal);

Review Comment:
   done



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/MemoryReservationManager.java:
##########
@@ -43,4 +45,23 @@ public interface MemoryReservationManager {
    * this manager ends, Or the memory to be released in the batch may not be 
released correctly.
    */
   void releaseAllReservedMemory();
+
+  /**
+   * Release memory virtually without actually freeing the memory. This is 
used for memory
+   * reservation transfer scenarios where memory ownership needs to be 
transferred between different
+   * FragmentInstances without actual memory deallocation.
+   *
+   * <p>NOTE: When calling this method, it should be guaranteed that 
bytesToBeReserved +
+   * reservedBytesInTotal >= size to ensure proper memory accounting and 
prevent negative
+   * reservation values.
+   */
+  Pair<Long, Long> releaseMemoryVirtually(final long size);

Review Comment:
   done



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/FakedMemoryReservationManager.java:
##########
@@ -32,4 +34,13 @@ public void releaseMemoryCumulatively(long size) {}
 
   @Override
   public void releaseAllReservedMemory() {}
+
+  @Override
+  public Pair<Long, Long> releaseMemoryVirtually(final long size) {
+    return null;

Review Comment:
   done



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