Fix pipe tablet memory self-lock during batching#18266
Open
Caideyipi wants to merge 1 commit into
Open
Conversation
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.
This PR has:
Key changed/added classes in this PR