Skip to content

HBASE-29272 Fix TableSnapshotInputFormatImpl returning 0 for InputSplit length (branch-2.6)#8493

Open
terrytlu wants to merge 1 commit into
apache:branch-2.6from
terrytlu:HBASE-29272-backport-2.6
Open

HBASE-29272 Fix TableSnapshotInputFormatImpl returning 0 for InputSplit length (branch-2.6)#8493
terrytlu wants to merge 1 commit into
apache:branch-2.6from
terrytlu:HBASE-29272-backport-2.6

Conversation

@terrytlu

Copy link
Copy Markdown
Contributor

Summary

Backport of #6947 to branch-2.6.

When Spark reads an HBase snapshot via TableSnapshotInputFormat, InputSplit.getLength() always returned 0. This caused the distributed computation framework (e.g. Spark) to treat all splits as empty and skip processing, resulting in no data or bogus data being read.

This change calculates the per-region size via the new SnapshotRegionSizeCalculator and sets the InputSplit length accordingly, so the framework can correctly schedule and process the splits.

Changes

  • Added RegionSizes and SnapshotRegionSizeCalculator classes.
  • SnapshotInfo now accumulates per-region sizes during manifest scanning.
  • TableSnapshotInputFormatImpl.InputSplit carries a length field, serialized in write/readFields.
  • Added TestSnapshotRegionSizeCalculator.

Branch-specific note

On this stable branch the @Deprecated TableSnapshotRegionSplit constructors (using HTableDescriptor/HRegionInfo) are retained for API compatibility. They are only removed on master (4.0.0).

Tests

  • mvn test -pl hbase-server -Dtest=TestSnapshotRegionSizeCalculator

@terrytlu
terrytlu force-pushed the HBASE-29272-backport-2.6 branch 5 times, most recently from b9a14d8 to 54039b3 Compare July 23, 2026 11:26
…eturning 0 on branch-2.6

When Spark reads a snapshot, InputSplit.getLength() always returned 0, so the distributed execution framework skipped the split and the job produced empty/incomplete data. Compute the actual region size via SnapshotRegionSizeCalculator (which returns a new RegionSizes holder) and use it as the split length.

Per the HBase API stability policy, the public 5-arg TableSnapshotRegionSplit constructor is retained but marked @deprecated (since 2.6.7, to be removed in 4.0.0), matching the removal already done on master.

Co-authored-by: Peng Lu <lupeng@apache.org>
Signed-off-by: terrytlu <terrytlu@tencent.com>
Signed-off-by: Peng Lu <lupeng@apache.org>
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.

1 participant