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 302864ae1ce Load: Add check for reset memory size to 0 in
LoadTsFileMemoryManager (#16940)
302864ae1ce is described below
commit 302864ae1ced9bf495812bbc976fba583f675630
Author: Zhenyu Luo <[email protected]>
AuthorDate: Mon Dec 22 14:02:26 2025 +0800
Load: Add check for reset memory size to 0 in LoadTsFileMemoryManager
(#16940)
---
.../load/memory/LoadTsFileMemoryManager.java | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/memory/LoadTsFileMemoryManager.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/memory/LoadTsFileMemoryManager.java
index 5094cbf2868..6142d122714 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/memory/LoadTsFileMemoryManager.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/memory/LoadTsFileMemoryManager.java
@@ -82,6 +82,10 @@ public class LoadTsFileMemoryManager {
}
public synchronized void releaseToQuery(final long sizeInBytes) {
+ if (sizeInBytes <= 0) {
+ throw new IllegalArgumentException(
+ String.format("Load: Invalid memory size %d bytes, must be
positive", sizeInBytes));
+ }
if (usedMemorySizeInBytes.get() < sizeInBytes) {
LOGGER.error(
"Load: Attempting to release more memory ({}) than allocated ({})",
@@ -96,6 +100,10 @@ public class LoadTsFileMemoryManager {
public synchronized LoadTsFileMemoryBlock allocateMemoryBlock(long
sizeInBytes)
throws LoadRuntimeOutOfMemoryException {
+ if (sizeInBytes <= 0) {
+ throw new IllegalArgumentException(
+ String.format("Load: Invalid memory size %d bytes, must be
positive", sizeInBytes));
+ }
try {
forceAllocateFromQuery(sizeInBytes);
if (LOGGER.isDebugEnabled()) {
@@ -120,7 +128,16 @@ public class LoadTsFileMemoryManager {
*/
synchronized void forceResize(LoadTsFileMemoryBlock memoryBlock, long
newSizeInBytes)
throws LoadRuntimeOutOfMemoryException {
- if (memoryBlock.getTotalMemorySizeInBytes() >= newSizeInBytes) {
+ if (newSizeInBytes < 0) {
+ throw new IllegalArgumentException(
+ String.format(
+ "Load: Invalid memory size %d bytes, must be non-negative",
newSizeInBytes));
+ }
+ if (memoryBlock.getTotalMemorySizeInBytes() == newSizeInBytes) {
+ return;
+ }
+
+ if (memoryBlock.getTotalMemorySizeInBytes() > newSizeInBytes) {
if (memoryBlock.getMemoryUsageInBytes() > newSizeInBytes) {
LOGGER.error(