Skip to content

HIVE-29703: LLAP: Parquet footer larger than alloc.max fails to cache — RuntimeException: Trying to allocate N; max is M#6584

Open
deniskuzZ wants to merge 3 commits into
apache:masterfrom
deniskuzZ:HIVE-29703
Open

HIVE-29703: LLAP: Parquet footer larger than alloc.max fails to cache — RuntimeException: Trying to allocate N; max is M#6584
deniskuzZ wants to merge 3 commits into
apache:masterfrom
deniskuzZ:HIVE-29703

Conversation

@deniskuzZ

@deniskuzZ deniskuzZ commented Jul 7, 2026

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

  • Allocate the remainder buffer with smallSize, not length.
  • Use maxAlloc <= length so a footer of exactly maxAlloc is held in one full buffer.

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:

  java.lang.RuntimeException: Trying to allocate 35405479; max is 33554432

Does this PR introduce any user-facing change?

No

How was this patch tested?

mvn test -pl llap-server -Dtest='TestOrcMetadataCache#testStreamFooterEqualToMaxAlloc+testStreamFooterLargerThanMaxAlloc

@deniskuzZ deniskuzZ changed the title HIVE-29703: LLAP: Parquet footer larger than alloc.max fails to cache - RuntimeException: Trying to allocate N; max is M HIVE-29703: LLAP: Parquet footer larger than alloc.max fails to cache — RuntimeException: Trying to allocate N; max is M Jul 7, 2026
@deniskuzZ deniskuzZ requested a review from Copilot July 7, 2026 09:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 == maxAlloc as a “full-buffer” case (avoid returning an empty wrapper).
  • Allocate the remainder buffer using smallSize (remainder length) instead of the full length when footers are split.
  • Refactor TestOrcMetadataCache to reuse a shared MetadataCache factory and add stream-based regression tests for == maxAlloc and > 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
@Aggarwal-Raghav

Copy link
Copy Markdown
Contributor

LGTM +1

@abstractdog abstractdog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only some minor nits, ideas, rest LGTM

@deniskuzZ deniskuzZ requested a review from abstractdog July 14, 2026 13:14

@abstractdog abstractdog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants