This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 22003b175f2 fix: synchronized method in
ThreadSafeMemoryReservationManager (#16954)
22003b175f2 is described below
commit 22003b175f22c83edbf6423aef03189eedc00c76
Author: shizy <[email protected]>
AuthorDate: Fri Dec 26 10:37:25 2025 +0800
fix: synchronized method in ThreadSafeMemoryReservationManager (#16954)
---
.../plan/planner/memory/ThreadSafeMemoryReservationManager.java | 4 ++--
.../execution/fragment/FragmentInstanceExecutionTest.java | 7 ++-----
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/ThreadSafeMemoryReservationManager.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/ThreadSafeMemoryReservationManager.java
index 190c4fedd5c..d167eae354f 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/ThreadSafeMemoryReservationManager.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/ThreadSafeMemoryReservationManager.java
@@ -52,12 +52,12 @@ public class ThreadSafeMemoryReservationManager extends
NotThreadSafeMemoryReser
}
@Override
- public Pair<Long, Long> releaseMemoryVirtually(final long size) {
+ public synchronized Pair<Long, Long> releaseMemoryVirtually(final long size)
{
return super.releaseMemoryVirtually(size);
}
@Override
- public void reserveMemoryVirtually(
+ public synchronized void reserveMemoryVirtually(
final long bytesToBeReserved, final long bytesAlreadyReserved) {
super.reserveMemoryVirtually(bytesToBeReserved, bytesAlreadyReserved);
}
diff --git
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceExecutionTest.java
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceExecutionTest.java
index a261297c2b3..e0655edc55a 100644
---
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceExecutionTest.java
+++
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceExecutionTest.java
@@ -49,7 +49,6 @@ import java.util.concurrent.ExecutorService;
import static org.apache.iotdb.db.queryengine.common.QueryId.MOCK_QUERY_ID;
import static
org.apache.iotdb.db.queryengine.execution.fragment.FragmentInstanceContext.createFragmentInstanceContext;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -149,14 +148,12 @@ public class FragmentInstanceExecutionTest {
}
} finally {
// Restore original System.out
- System.setErr(systemOut);
+ System.setOut(systemOut);
// should not contain warn message: "The memory cost to be released is
larger than the memory
// cost of memory block"
String capturedOutput = logPrint.toString();
- assertFalse(
- "Should not contain warning message",
- capturedOutput.contains("The memory cost to be released is larger
than the memory"));
+ assertTrue(capturedOutput.isEmpty());
}
}