Junegunn Choi created HBASE-30365:
-------------------------------------

             Summary: Reading a MOB table snapshot as MapReduce input fails 
after HBASE-30336
                 Key: HBASE-30365
                 URL: https://issues.apache.org/jira/browse/HBASE-30365
             Project: HBase
          Issue Type: Bug
          Components: mapreduce, mob
            Reporter: Junegunn Choi


h2. Problem

Reading a MOB table snapshot through {{TableSnapshotInputFormat}} fails since 
HBASE-30336.

{noformat}
java.io.IOException: Region directory does not exist: 
.../data/default/testLoadingSnapshotToMobTable1/2fd029de2ee9a2e42a9aaa50ba0a0d55
  at HRegionFileSystem.writeRegionInfoOnFilesystem(HRegionFileSystem.java:874)
  at ClientSideRegionScanner.<init>(ClientSideRegionScanner.java:88)
  at 
TableSnapshotInputFormatImpl$RecordReader.initialize(TableSnapshotInputFormatImpl.java:271)
{noformat}

That encoded name is the MOB pseudo-region: 
{{MD5("testLoadingSnapshotToMobTable1,.mob,0")}}, which is what 
{{MobUtils.getMobRegionInfo}} produces.

{{TableSnapshotInputFormatImpl.getRegionInfosFromManifest}} creates a split for 
every region in the manifest, and a MOB snapshot manifest includes the 
pseudo-region. Each split is then opened as a real region under the restore 
dir. HBASE-30336 correctly stopped creating a directory for that pseudo-region 
under the table dir, so the split now has nothing to open.

Found by a nightly run on Java 21, but not JDK specific. It fails the same way 
on 17, locally and on CI.

{noformat}
mvn -pl hbase-mapreduce test 
-Dtest='TestCopyTable#testLoadingSnapshotAndBulkLoadToMobTable+tsetLoadingSnapshotToMobTable'
{noformat}

All the affected fix versions are still unreleased, so this has not shipped.

h2. Fix

Skip the pseudo-region when building splits, next to the existing offline-split 
filter:

{code:java}
if (MobUtils.isMobRegionInfo(hri)) {
  continue;
}
{code}

This is behaviour-preserving. Before HBASE-30336 the pseudo-region's family 
files were written under {{mobdir}} while only a {{.regioninfo}} was written 
under the table dir, so the split opened a region with no store files and 
returned zero rows. Skipping it removes the exception without changing any 
output.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to