HIVE-29703: LLAP: Parquet footer larger than alloc.max fails to cache — RuntimeException: Trying to allocate N; max is M#6584
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes an LLAP MetadataCache allocation bug when caching file footers via the InputStream path, specifically for footers at or above allocator.getMaxAllocation(), preventing failures like “Trying to allocate N; max is M”.
Changes:
- Adjust split logic to treat
length == maxAllocas a “full-buffer” case (avoid returning an empty wrapper). - Allocate the remainder buffer using
smallSize(remainder length) instead of the fulllengthwhen footers are split. - Refactor
TestOrcMetadataCacheto reuse a sharedMetadataCachefactory and add stream-based regression tests for== maxAllocand> maxAlloc.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| llap-server/src/java/org/apache/hadoop/hive/llap/io/metadata/MetadataCache.java | Fixes buffer-splitting and remainder allocation so stream footers at/over max alloc are cached without over-allocation or empty-wrapper behavior. |
| llap-server/src/test/org/apache/hadoop/hive/llap/cache/TestOrcMetadataCache.java | Adds regression coverage for stream footer sizes equal to and larger than MAX_ALLOC, and reduces test duplication via helper constructors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… — RuntimeException: Trying to allocate N; max is M
|
|
||
| @SuppressWarnings({ "rawtypes", "unchecked" }) | ||
| @SuppressWarnings("unchecked") | ||
| private LlapBufferOrBuffers wrapBbForFile(LlapBufferOrBuffers result, |
There was a problem hiding this comment.
Question? If there are any exceptions like IOException or AllocatorOutOfMemoryException in readIntoCacheBuffer()/ allocateMultiple() shouldn't there be a finally block to deallocate the previously allocated buffer memory?
In readIntoCacheBuffer() there is no finally block. In allocateMultiple() there is finally block but will deallocate the current buffer not previously allocated buffer.
There was a problem hiding this comment.
need to check, but that's seems to be a diff issue
There was a problem hiding this comment.
yeah, its outside the scope of current JIRA. If it's ok , can I pick it up as separate JIRA? Will come up with a UT for this?
There was a problem hiding this comment.
oh, haven't noticed your latest comment and decided to fix it here: 3bf7817
There was a problem hiding this comment.
No worries, resolution of issue is important.
|
LGTM +1 |
|



What changes were proposed in this pull request?
Why are the changes needed?
When LLAP caches a Parquet file footer whose size exceeds hive.llap.io.allocator.alloc.max, the query fails with:
Does this PR introduce any user-facing change?
No
How was this patch tested?