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 190c4fedd5c6..d167eae354ff 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 synchronized void releaseAllReservedMemory() { } @Override - public Pair releaseMemoryVirtually(final long size) { + public synchronized Pair 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 a261297c2b30..e0655edc55a4 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 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 void testTVListOwnerTransfer() throws InterruptedException { } } 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()); } }