TheR1sing3un opened a new pull request, #12530:
URL: https://github.com/apache/hudi/pull/12530

   In the current merge process, after judging whether the current log record 
can be merged or discarded, `writtenRecordKeys` only marks that the key has 
been deleted, rather than deleting it from the `keyToNewRecords`. This results 
in the following two problems:
   <img width="1207" alt="image" 
src="https://github.com/user-attachments/assets/2a560439-e236-4fdd-8c46-a0af394fe327";
 />
   
   > unnecessary memory usage 
   `keyToNewRecords` will only be used in `HoodieMergeHandle` one time, 
therefore, this log record can be deleted after determining it. As there is no 
actual deletion at present, the memory of this log record in 
`ExternalSpillableMap::inMemoryMap` has not been released until `close`
   
   > unnecessary disk access
   `HoodieMergeHandle::writeIncomingRecords` will always read all the log 
records from disk even thought hese log records we have previously confirmed 
that we do not need to insert.
   
   <img width="807" alt="image" 
src="https://github.com/user-attachments/assets/00168faf-96ba-4664-a6dd-f39ef5a8f347";
 />
   
   
   ### Change Logs
   1. remove log record from `ExternalSpillableMap` after merging/deleting
   2. save unnecessary memory usage in `ExternalSpillableMap::inMemoryMap` due 
to the current logic not deleting these log records in time
   3. avoid unnecessary disk reading due to 
`HoodieMergeHandle::writeIncomingRecords` will always visit all log records 
even though these log records we have previously confirmed that we do not need 
to insert
   
   _Describe context and summary for this change. Highlight if any code was 
copied._
   
   ### Impact
   
   _Describe any public API or user-facing feature change or any performance 
impact._
   none
   ### Risk level (write none, low medium or high below)
   none
   _If medium or high, explain what verification was done to mitigate the 
risks._
   
   ### Documentation Update
   none
   _Describe any necessary documentation update if there is any new feature, 
config, or user-facing change. If not, put "none"._
   
   - _The config description must be updated if new configs are added or the 
default value of the configs are changed_
   - _Any new feature or user-facing change requires updating the Hudi website. 
Please create a Jira ticket, attach the
     ticket number here and follow the 
[instruction](https://hudi.apache.org/contribute/developer-setup#website) to 
make
     changes to the website._
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Change Logs and Impact were stated clearly
   - [x] Adequate tests were added if applicable
   - [x] CI passed
   


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