shizy818 commented on code in PR #16932:
URL: https://github.com/apache/iotdb/pull/16932#discussion_r2634334980
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/NotThreadSafeMemoryReservationManager.java:
##########
@@ -91,4 +93,25 @@ public void releaseAllReservedMemory() {
bytesToBeReleased = 0;
}
}
+
+ @Override
+ public Pair<Long, Long> releaseMemoryVirtually(final long size) {
+ if (bytesToBeReserved >= size) {
+ bytesToBeReserved -= size;
+ return new Pair<>(size, 0L);
+ } else {
+ long releasedBytesInReserved = bytesToBeReserved;
+ long releasedBytesInTotal = size - bytesToBeReserved;
+ bytesToBeReserved = 0;
+ reservedBytesInTotal -= releasedBytesInTotal;
+ return new Pair<>(releasedBytesInReserved, releasedBytesInTotal);
+ }
+ }
+
+ @Override
+ public void reserveMemoryVirtually(
+ final long releasedBytesInReserved, final long releasedBytesInTotal) {
+ bytesToBeReserved += releasedBytesInReserved;
+ reservedBytesInTotal += releasedBytesInTotal;
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]