Copilot commented on code in PR #8628:
URL: https://github.com/apache/hbase/pull/8628#discussion_r3956847055


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableSnapshotScanner.java:
##########
@@ -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);
+    }

Review Comment:
   Cleanup in the finally-block can throw (e.g., deleteSnapshot when snapshot 
creation failed), which may mask the original test failure and cause flaky test 
behavior. Prefer guarding cleanup steps so they don't override the initial 
exception (e.g., wrap each cleanup action in its own try/catch, or use helper 
utilities that swallow cleanup exceptions while preserving the primary failure).



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/client/TableSnapshotScanner.java:
##########
@@ -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, and holds no rows. See 
HBASE-30365.

Review Comment:
   The comment references HBASE-30365, but the PR is for HBASE-30368; if the 
behavior change is actually motivated by HBASE-30368 (TableSnapshotScanner 
failing on restored MOB snapshots), update the reference (or include both 
tickets) to avoid confusion for future maintainers.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to