Skip to content

Commit b75bcc6

Browse files
authored
Pipe: Fixed the bug that batch memory is not visible to pipe memory management (#16962)
1 parent 82f2dc4 commit b75bcc6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/payload/evolvable/batch/PipeTabletEventBatch.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
package org.apache.iotdb.db.pipe.sink.payload.evolvable.batch;
2121

2222
import org.apache.iotdb.commons.pipe.event.EnrichedEvent;
23+
import org.apache.iotdb.db.pipe.resource.PipeDataNodeResourceManager;
24+
import org.apache.iotdb.db.pipe.resource.memory.PipeMemoryBlock;
2325
import org.apache.iotdb.db.pipe.sink.protocol.thrift.async.IoTDBDataRegionAsyncSink;
2426
import org.apache.iotdb.db.storageengine.dataregion.wal.exception.WALPipeException;
2527
import org.apache.iotdb.pipe.api.event.Event;
@@ -45,6 +47,7 @@ public abstract class PipeTabletEventBatch implements AutoCloseable {
4547
private long firstEventProcessingTime = Long.MIN_VALUE;
4648

4749
protected long totalBufferSize = 0;
50+
private final PipeMemoryBlock allocatedMemoryBlock;
4851

4952
protected volatile boolean isClosed = false;
5053

@@ -56,6 +59,8 @@ protected PipeTabletEventBatch(
5659

5760
// limit in buffer size
5861
this.maxBatchSizeInBytes = requestMaxBatchSizeInBytes;
62+
this.allocatedMemoryBlock =
63+
PipeDataNodeResourceManager.memory().forceAllocate(requestMaxBatchSizeInBytes);
5964
if (recordMetric != null) {
6065
this.recordMetric = recordMetric;
6166
} else {
@@ -142,6 +147,7 @@ public synchronized void close() {
142147

143148
clearEventsReferenceCount(PipeTabletEventBatch.class.getName());
144149
events.clear();
150+
allocatedMemoryBlock.close();
145151
}
146152

147153
/**

0 commit comments

Comments
 (0)