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

   ### Describe the issue this Pull Request addresses
   
   In production environments, data governance, scheduling, or data integration 
platforms (e.g., Apache Atlas, DolphinScheduler, or internal DataOps systems) 
often automatically pre-create an empty directory (fs.mkdirs(basePath)) for a 
new table to pre-configure asset management or permissions.
   Currently, Hudi Streamer may fail during initialization if basePath 
pre-exists, even when empty. This PR optimizes the pre-check logic to allow 
initialization for empty directories.
   
   ### Summary and Changelog
   
   • org.apache.hudi.storage.HoodieStorage: Added isEmpty(StoragePath) method 
via HadoopStorage with memory-safe iteration.
   • org.apache.hudi.utilities.streamer.StreamSync: Updated 
initializeMetaClient(boolean) to use storage.isEmpty(basePath) for safe 
initialization.
   • org.apache.hudi.utilities.streamer.HoodieStreamer.StreamSyncService: 
Aligned context and storage parameters during setup.
   
   ### Impact
   
   No errors are thrown on pre-created empty base paths.
   
   ### Risk Level
   
   Low, as non-empty directories without metadata still correctly trigger 
exceptions.
   
   ### Documentation Update
   
   none
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Enough context is provided in the sections above
   - [ ] Adequate tests were added if applicable
   


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