Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public static List<RegionInfo> getRegionInfosFromManifest(SnapshotManifest manif
continue;
}
// The mob region is a dummy region used only to organise mob files under mobdir. It has no
// region directory under the table dir to open, and holds no rows. See HBASE-30365.
// region directory under the table dir to open. See HBASE-30365.
if (MobUtils.isMobRegionInfo(hri)) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.PrivateCellUtil;
import org.apache.hadoop.hbase.client.metrics.ScanMetrics;
import org.apache.hadoop.hbase.mob.MobUtils;
import org.apache.hadoop.hbase.regionserver.MemStoreLAB;
import org.apache.hadoop.hbase.snapshot.RestoreSnapshotHelper;
import org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils;
Expand Down Expand Up @@ -160,6 +161,11 @@ private boolean isValidRegion(RegionInfo hri) {
if (hri.isOffline() && (hri.isSplit() || hri.isSplitParent())) {
return false;
}
// The mob region is a dummy region used only to organise mob files under mobdir. It has no
// region directory under the table dir to open. See HBASE-30365 and HBASE-30368.
if (MobUtils.isMobRegionInfo(hri)) {
return false;
}
return PrivateCellUtil.overlappingKeys(scan.getStartRow(), scan.getStopRow(), hri.getStartKey(),
hri.getEndKey());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.apache.hadoop.hbase.regionserver.StoreContext;
import org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTracker;
import org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory;
import org.apache.hadoop.hbase.snapshot.MobSnapshotTestingUtils;
import org.apache.hadoop.hbase.snapshot.RestoreSnapshotHelper;
import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils;
import org.apache.hadoop.hbase.testclassification.ClientTests;
Expand Down Expand Up @@ -370,6 +371,31 @@ public void testScannerWithRestoreScanner() throws Exception {
}
}

@Test
public void testScannerWithRestoredMobSnapshot() throws Exception {
TableName tableName = TableName.valueOf(methodName);
String snapshotName = methodName + "Snapshot";
Path restoreDir = UTIL.getDataTestDirOnTestFS(snapshotName);
try {
MobSnapshotTestingUtils.createMobTable(UTIL, tableName, new byte[0][], 1, FAMILIES);
try (Table table = UTIL.getConnection().getTable(tableName)) {
UTIL.loadTable(table, FAMILIES);
}
UTIL.getAdmin().snapshot(snapshotName, tableName);

Configuration conf = UTIL.getConfiguration();
RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName);
try (TableSnapshotScanner scanner = new TableSnapshotScanner(conf, rootDir, restoreDir,
snapshotName, new Scan().withStartRow(Bytes.toBytes("zzzz")), true)) {
assertNull(scanner.next());
}
} finally {
fs.delete(restoreDir, true);
UTIL.getAdmin().deleteSnapshot(snapshotName);
UTIL.deleteTable(tableName);
}
Comment thread
liuxiaocs7 marked this conversation as resolved.
}

private void testScanner(HBaseTestingUtil util, String snapshotName, int numRegions,
boolean shutdownCluster) throws Exception {
TableName tableName = TableName.valueOf("testScanner");
Expand Down