fix(partition-ttl): Fix the integer overflow issue when TTL exceeded 24 days.#19075
fix(partition-ttl): Fix the integer overflow issue when TTL exceeded 24 days.#19075wangxianghu wants to merge 1 commit into
Conversation
hudi-agent
left a comment
There was a problem hiding this comment.
Thanks for the contribution! This PR fixes an integer overflow in KeepByTimeStrategy where daysRetain > 24 caused ttlInMilis to go negative, making getExpiredPartitionPaths always return an empty list. The (long) cast correctly promotes the multiplication to long arithmetic, and the added test covers the overflow boundary well. No correctness issues found. A few style/readability suggestions in the inline comments. Please take a look, and this should be ready for a Hudi committer or PMC member to take it from here. One simplification suggestion for the production-side fix — the test coverage is solid.
cc @yihua
a4c900c to
435fb50
Compare
Describe the issue this Pull Request addresses
when days to retain is bigger than 24, then
writeConfig.getPartitionTTLStrategyDaysRetain() * 1000 * 3600 * 24> Integer.MAX_VALUE,ttlInMilis <= 0will always be trueorg.apache.hudi.table.action.ttl.strategy.KeepByTimeStrategy#getExpiredPartitionPathsalways return empty list.cast
writeConfig.getPartitionTTLStrategyDaysRetain()to long can fix itSummary and Changelog
Fix daysReatain> 24 integer overflow issue
Impact
None
Risk Level
low
Documentation Update
None
Contributor's checklist