Mryange opened a new pull request, #70843:
URL: https://github.com/apache/doris/pull/70843

   ### Background
   
   During a sorted MemTable flush, Doris copies rows into an output block in 
sort order before writing the segment.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: None
   PR Type: Performance
   
   Problem Summary:
   
   The source block holds all input columns until the full copy finishes. 
Release each source column reference immediately after copying it.
   
   ### Details
   
   - **Why it was slow:** Columns already copied still occupied memory 
alongside the output.
   - **Optimization:** Take ownership of the input columns and drop each 
reference at its last use.
   - **Results:** Input column buffers can be freed earlier during flush. An 
earlier implementation showed no consistent reduction in whole-load peak 
memory, and this revision was not benchmarked.
   - **Applicability and cost:** Applies when flush materializes sorted rows 
into an output block. The row selection and column copies are the same.
   
   ### Testing
   
   - All 11 targeted ASAN tests passed in `MemTableMemoryTrackingTest` and 
`MemTableSortTest`.
   
   ### Release note
   
   None.
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Partially verified: this revision has no end-to-end 
memory benchmark.
   
   ### AI Disclosure
   
   - Tool: Codex
   - Generated: Code and PR description
   - Human review: The author reviewed the source changes before requesting 
submission.
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to