diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/PipeMemoryManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/PipeMemoryManager.java index 895d5890a03d4..97688e7b87dc4 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/PipeMemoryManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/PipeMemoryManager.java @@ -170,13 +170,6 @@ public synchronized PipeMemoryBlock tryAllocate(long sizeInBytes) { return new PipeMemoryBlock(sizeToAllocateInBytes); } - try { - this.wait(MEMORY_ALLOCATE_RETRY_INTERVAL_IN_MS); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - LOGGER.warn("tryAllocate: interrupted while waiting for available memory", e); - } - sizeToAllocateInBytes = Math.max(sizeToAllocateInBytes * 2 / 3, MEMORY_ALLOCATE_MIN_SIZE_IN_BYTES); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALInsertNodeCache.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALInsertNodeCache.java index 44e2c287622bf..da651cf4322bd 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALInsertNodeCache.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALInsertNodeCache.java @@ -69,7 +69,12 @@ public class WALInsertNodeCache { private WALInsertNodeCache(Integer dataRegionId) { allocatedMemoryBlock = - PipeResourceManager.memory().tryAllocate(2 * CONFIG.getWalFileSizeThresholdInByte()); + PipeResourceManager.memory() + .tryAllocate( + (long) + Math.min( + 2 * CONFIG.getWalFileSizeThresholdInByte(), + CONFIG.getAllocateMemoryForPipe() * 0.8 / 5)); isBatchLoadEnabled = allocatedMemoryBlock.getMemoryUsageInBytes() >= CONFIG.getWalFileSizeThresholdInByte(); lruCache =