diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java index d4f8e4585e6..ff5d4827990 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java @@ -2484,6 +2484,16 @@ public class HBaseFsck extends Configured implements Closeable { return; } } + + // For Replica region, we need to do a similar check. If replica is not split successfully, + // error is going to be reported against primary daughter region. + if (hbi.getReplicaId() != HRegionInfo.DEFAULT_REPLICA_ID) { + LOG.info("Region " + descriptiveName + " is a split parent in META, in HDFS, " + + "and not deployed on any region server. This may be transient."); + hbi.setSkipChecks(true); + return; + } + errors.reportError(ERROR_CODE.LINGERING_SPLIT_PARENT, "Region " + descriptiveName + " is a split parent in META, in HDFS, " + "and not deployed on any region server. This could be transient, " diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckReplicas.java index 3d0647e5e78..6e49b81f0c6 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckReplicas.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckReplicas.java @@ -110,6 +110,31 @@ public class TestHBaseFsckReplicas extends BaseTestHBaseFsck { EnvironmentEdgeManager.reset(); } + /* + * This creates a table with region_replica > 1, do a split, check + * that hbck will not report split replica parent as lingering split parent + */ + @Test public void testHbckReportReplicaLingeringSplitParent() throws Exception { + TableName table = TableName.valueOf("testHbckReportReplicaLingeringSplitParent"); + + try { + setupTableWithRegionReplica(table, 2); + admin.flush(table); + + // disable catalog janitor + admin.enableCatalogJanitor(false); + admin.split(table, Bytes.toBytes("A1")); + + Thread.sleep(1000); + // run hbck again to make sure we don't see any errors + assertNoErrors(doFsck(conf, false)); + } finally { + cleanupTable(table); + // enable catalog janitor + admin.enableCatalogJanitor(true); + } + } + /* * This creates a table with region_replica > 1 and verifies hbck runs * successfully