Skip to content

Commit 22003b1

Browse files
authored
fix: synchronized method in ThreadSafeMemoryReservationManager (apache#16954)
1 parent 8e99486 commit 22003b1

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/memory/ThreadSafeMemoryReservationManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ public synchronized void releaseAllReservedMemory() {
5252
}
5353

5454
@Override
55-
public Pair<Long, Long> releaseMemoryVirtually(final long size) {
55+
public synchronized Pair<Long, Long> releaseMemoryVirtually(final long size) {
5656
return super.releaseMemoryVirtually(size);
5757
}
5858

5959
@Override
60-
public void reserveMemoryVirtually(
60+
public synchronized void reserveMemoryVirtually(
6161
final long bytesToBeReserved, final long bytesAlreadyReserved) {
6262
super.reserveMemoryVirtually(bytesToBeReserved, bytesAlreadyReserved);
6363
}

iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceExecutionTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import static org.apache.iotdb.db.queryengine.common.QueryId.MOCK_QUERY_ID;
5050
import static org.apache.iotdb.db.queryengine.execution.fragment.FragmentInstanceContext.createFragmentInstanceContext;
5151
import static org.junit.Assert.assertEquals;
52-
import static org.junit.Assert.assertFalse;
5352
import static org.junit.Assert.assertTrue;
5453
import static org.junit.Assert.fail;
5554

@@ -149,14 +148,12 @@ public void testTVListOwnerTransfer() throws InterruptedException {
149148
}
150149
} finally {
151150
// Restore original System.out
152-
System.setErr(systemOut);
151+
System.setOut(systemOut);
153152

154153
// should not contain warn message: "The memory cost to be released is larger than the memory
155154
// cost of memory block"
156155
String capturedOutput = logPrint.toString();
157-
assertFalse(
158-
"Should not contain warning message",
159-
capturedOutput.contains("The memory cost to be released is larger than the memory"));
156+
assertTrue(capturedOutput.isEmpty());
160157
}
161158
}
162159

0 commit comments

Comments
 (0)