Skip to content

Commit 685141a

Browse files
authored
Fixed the bug that the attribute update container may add extra calculated memory to schema engine (apache#16682)
1 parent 274fc9e commit 685141a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,17 +440,23 @@ private void updateMemory(final long size) {
440440
if (size > 0) {
441441
requestMemory(size);
442442
} else {
443-
releaseMemory(size);
443+
releaseMemory(-size);
444444
}
445445
}
446446

447447
private void requestMemory(final long size) {
448+
if (size < 0) {
449+
throw new UnsupportedOperationException("requestMemory size must not be negative");
450+
}
448451
if (regionStatistics != null) {
449452
regionStatistics.requestMemory(size);
450453
}
451454
}
452455

453456
private void releaseMemory(final long size) {
457+
if (size < 0) {
458+
throw new UnsupportedOperationException("releaseMemory size must not be negative");
459+
}
454460
if (regionStatistics != null) {
455461
regionStatistics.releaseMemory(size);
456462
}

0 commit comments

Comments
 (0)