HBASE-6665 ROOT region should not be splitted even with META row as explicit split key (Rajesh)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1403037 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-10-28 16:33:27 +00:00
parent 094e8d4420
commit 056977d70b
2 changed files with 16 additions and 3 deletions

View File

@ -5157,10 +5157,10 @@ public class HRegion implements HeapSize { // , Writable{
* is based on the size of the store.
*/
public byte[] checkSplit() {
// Can't split META
if (getRegionInfo().isMetaRegion()) {
// Can't split ROOT/META
if (this.regionInfo.isMetaTable()) {
if (shouldForceSplit()) {
LOG.warn("Cannot split meta regions in HBase 0.20 and above");
LOG.warn("Cannot split root/meta regions in HBase 0.20 and above");
}
return null;
}

View File

@ -1631,5 +1631,18 @@ public class TestAdmin {
ct.stop();
}
}
@Test
public void testRootTableSplit() throws Exception {
ServerName serverName = TEST_UTIL.getMiniHBaseCluster().getServerHoldingRoot();
Scan s = new Scan();
HTable rootTable = new HTable(TEST_UTIL.getConfiguration(), HConstants.ROOT_TABLE_NAME);
ResultScanner scanner = rootTable.getScanner(s);
Result metaEntry = scanner.next();
this.admin.split(HConstants.ROOT_TABLE_NAME, metaEntry.getRow());
Thread.sleep(1000);
List<HRegionInfo> onlineRegions = this.admin.getOnlineRegions(serverName);
assertTrue(onlineRegions != null && onlineRegions.contains(HRegionInfo.ROOT_REGIONINFO));
}
}