Caideyipi opened a new pull request, #18266:
URL: https://github.com/apache/iotdb/pull/18266

   ## Description
   
   ### Problem
   
   A realtime Pipe with pattern.exclusion can convert InsertNode events into 
retained raw tablet events. These events create zero-sized 
PipeTabletMemoryBlocks and account for their memory later through forceResize.
   
   Before this change, forceResize checked only the remaining non-floating 
memory. It did not apply the tablet/TsFile admission thresholds used by 
non-zero initial allocations. Raw tablets could therefore fill the whole 
non-floating pool. Once full, the sink batch could not allocate even the small 
buffer needed to transfer and release those tablets, causing a memory self-lock 
and a frozen RemainingEventCount.
   
   ### Fix
   
   Apply the existing tablet/TsFile hard admission thresholds when a typed 
data-structure block grows through resize. Normal blocks, including sink batch 
buffers, retain the existing total-memory check.
   
   This backpressures raw-tablet production before it exhausts the pool and 
leaves memory for downstream transfer and release. It also avoids restoring a 
full static reservation for every sink batch.
   
   A package-private constructor accepting IMemoryBlock was added so the memory 
policy can be tested with a deterministic, isolated memory pool.
   
   ### Tests
   
   Added PipeMemoryManagerResizeTest to verify that:
   
   - tablet growth is rejected after the tablet threshold is reached;
   - a normal sink batch can still allocate memory;
   - tablet growth resumes after retained tablet memory is released;
   - all accounted memory returns to zero.
   
   Executed:
   
   mvn -Ddevelocity.off=true -o test -pl iotdb-core/datanode 
-Dtest=PipeMemoryManagerResizeTest,PipeTabletEventPlainBatchTest,TsFileInsertionEventParserTest
   
   Result: 25 tests run, 0 failures, 0 errors, 3 skipped.
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
       - [x] concurrent read
       - [x] concurrent write
   - [x] added comments explaining the why and the intent of the code wherever 
it would not be obvious.
   - [x] added unit tests to cover the new code path.
   
   <hr>
   
   ##### Key changed/added classes in this PR
   
   - PipeMemoryManager
   - PipeMemoryManagerResizeTest


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to