prashantwason opened a new pull request, #18023: URL: https://github.com/apache/hudi/pull/18023
### Describe the issue this Pull Request addresses This PR addresses memory issues when reading archival log files with multiple threads. The ThreadLocal variables in `HoodieAvroDataBlock` were being created as instance variables, leading to unnecessary object creation and memory overhead. Issue: HUDI-2202 ### Summary and Changelog Making ThreadLocal variables (`encoderCache`, `decoderCache`) and schema cache (`schemaMap`) static ensures that only one copy of these objects is maintained per thread across all instances of `HoodieAvroDataBlock`, reducing memory pressure and improving GC behavior. **Changes:** - Added static `ConcurrentHashMap<String, Schema> schemaMap` for schema caching - Made `ThreadLocal<BinaryEncoder> encoderCache` static - Made `ThreadLocal<BinaryDecoder> decoderCache` static - Added necessary imports for `BinaryEncoder` and `ConcurrentHashMap` ### Impact No public API changes. Internal memory optimization that improves performance when reading log files with multiple threads. ### Risk Level low - The change only affects internal caching behavior. ThreadLocal semantics are preserved, just shared across instances rather than per-instance. ### Documentation Update none ### Contributor's checklist - [x] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [x] Enough context is provided in the sections above - [x] 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]
