HBASE-18362 hbck should not report split replica parent region from meta as errors (Huaxiang Sun)

Signed-off-by: Esteban Gutierrez <esteban@apache.org>
This commit is contained in:
Esteban Gutierrez 2017-07-27 15:58:16 -05:00
parent 10573c6c99
commit 75789048c1
2 changed files with 35 additions and 0 deletions

View File

@ -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, "

View File

@ -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