Skip to content

HBASE-30600 Preserve legacy open behavior for hbase.fs.wrapper when using FileSystem.openFile - #8953

Merged
taklwu merged 3 commits into
apache:masterfrom
taklwu:HBASE-30600
Dec 3, 2026
Merged

taklwu merged 3 commits into
apache:masterfrom
taklwu:HBASE-30600

Conversation

@taklwu

@taklwu taklwu commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

it's mainly from this review comment #8935 (comment) such that we need to make sure the FileSystem.openFile is being used correctly with HFileSystem.

@kgeisz kgeisz 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.

Claude has some non-blocking comments, but overall the change looks good:

  1. The check is too cautious. It goes back to the slower open for any custom wrapper that doesn't support the new method, even wrappers that never hooked open() in the first place (for example, one that only adds metrics on writes). Those wrappers lose the speedup for no reason. A sharper check would fall back only when the wrapper actually customizes open().
  2. It repeats the same lookup on every file open. The check inspects the wrapper's class using reflection every time a file is opened. The answer never changes for a given class, so it could be worked out once and cached (for example with ClassValue). This is cheap and keeps the code clean.
  3. There's no log message. When HBase falls back to the slower open, nothing is logged. A one-time message like "your wrapper doesn't support the faster open, using the old one" would help operators see why they aren't getting the speedup.
  4. One error branch can never run. NoSuchMethodException can't happen on the Hadoop versions HBase supports. It's harmless, but a short comment saying so would help readers.
  5. The tests miss the real-world setup.
    • The test builds the wrapper by hand. It never sets hbase.fs.wrapper in the config, which is how real users enable it. A test that goes through the config would cover the actual code path.
    • No test checks the opposite case: a wrapper that does support the new method should still get the fast open.
  6. Docs and backports. Update the openForRead Javadoc to describe the fallback, and make sure the fix lands on every branch the original change went to (master and branch-3).

@taklwu

taklwu commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

those are good points, let me adjust it

@taklwu
taklwu requested review from kgeisz and a balanced review from Copilot and removed request for kgeisz December 2, 2026 23:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The fast-path check still bypasses stream decoration when a transparent FilterFileSystem wraps a legacy-open-only wrapper, requiring inspection of nested delegating layers and a regression test.

1 open issue
What changed in this PR

Preserves legacy read behavior for HBase filesystem wrappers while retaining faster openFile() reads for compatible implementations.

Changes:

  • Adds cached wrapper checks before selecting the fast read path.
  • Extends tests for legacy-only, builder-aware, and transparent wrappers through HFileSystem.
File Description
hbase-server/​src/​test/​java/​org/​apache/​hadoop/​hbase/​util/​TestFSUtils.java Adds wrapper compatibility tests and helpers.
hbase-server/​src/​main/​java/​org/​apache/​hadoop/​hbase/​util/​FSUtils.java Guards fast reads to preserve legacy wrapper overrides.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The compatibility check still allows builder opens to bypass wrapper stream decoration for legacy open overrides, affecting reads such as no-checksum HFile reads.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Builder opens bypass stream decoration for legacy open overrides

hbase-server/​src/​main/​java/​org/​apache/​hadoop/​hbase/​util/​FSUtils.java:139

The compatibility check still allows builder opens to bypass stream decoration when a wrapper overrides only open(Path), or when a subclass adds a legacy override below an inherited, delegating openFile(Path) override. This affects direct wrapper reads such as no-checksum HFile reads; Hadoop's default-branch implementation delegates builder opens to the backing filesystem. Check both legacy overloads and require the builder override to be declared at least as far down the hierarchy as either legacy override, with regression tests for both cases.

1 resolved since last review

Review effort: Balanced

@taklwu
taklwu merged commit 8732b6c into apache:master Dec 3, 2026
8 checks passed
@taklwu
taklwu deleted the HBASE-30600 branch December 3, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants