HBASE-4889 HRegionInfo.isMetaTable() should be true for -ROOT- regions
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1208006 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e0a283fa3c
commit
8db322ebdd
|
@ -600,12 +600,12 @@ implements WritableComparable<HRegionInfo> {
|
||||||
* either <code>.META.</code> or <code>-ROOT-</code>
|
* either <code>.META.</code> or <code>-ROOT-</code>
|
||||||
*/
|
*/
|
||||||
public boolean isMetaTable() {
|
public boolean isMetaTable() {
|
||||||
return Bytes.equals(tableName, HRegionInfo.FIRST_META_REGIONINFO.getTableName());
|
return isRootRegion() || isMetaRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return true if this region is a meta region */
|
/** @return true if this region is a meta region */
|
||||||
public boolean isMetaRegion() {
|
public boolean isMetaRegion() {
|
||||||
return isMetaTable();
|
return Bytes.equals(tableName, HRegionInfo.FIRST_META_REGIONINFO.getTableName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -359,8 +359,7 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
// its a clean cluster startup, else its a failover.
|
// its a clean cluster startup, else its a failover.
|
||||||
boolean regionsToProcess = false;
|
boolean regionsToProcess = false;
|
||||||
for (Map.Entry<HRegionInfo, ServerName> e: this.regions.entrySet()) {
|
for (Map.Entry<HRegionInfo, ServerName> e: this.regions.entrySet()) {
|
||||||
if (!e.getKey().isMetaRegion()
|
if (!e.getKey().isMetaTable()
|
||||||
&& !e.getKey().isRootRegion()
|
|
||||||
&& e.getValue() != null) {
|
&& e.getValue() != null) {
|
||||||
LOG.debug("Found " + e + " out on cluster");
|
LOG.debug("Found " + e + " out on cluster");
|
||||||
regionsToProcess = true;
|
regionsToProcess = true;
|
||||||
|
@ -489,7 +488,7 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
|
|
||||||
// Just insert region into RIT
|
// Just insert region into RIT
|
||||||
// If this never updates the timeout will trigger new assignment
|
// If this never updates the timeout will trigger new assignment
|
||||||
if (regionInfo.isMetaRegion() || regionInfo.isRootRegion()) {
|
if (regionInfo.isMetaTable()) {
|
||||||
regionsInTransition.put(encodedRegionName, new RegionState(
|
regionsInTransition.put(encodedRegionName, new RegionState(
|
||||||
regionInfo, RegionState.State.OPENING, data.getStamp(), data
|
regionInfo, RegionState.State.OPENING, data.getStamp(), data
|
||||||
.getOrigin()));
|
.getOrigin()));
|
||||||
|
@ -1514,7 +1513,7 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void debugLog(HRegionInfo region, String string) {
|
private void debugLog(HRegionInfo region, String string) {
|
||||||
if (region.isMetaTable() || region.isRootRegion()) {
|
if (region.isMetaTable()) {
|
||||||
LOG.info(string);
|
LOG.info(string);
|
||||||
} else {
|
} else {
|
||||||
LOG.debug(string);
|
LOG.debug(string);
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class OpenedRegionHandler extends EventHandler implements TotesHRegionInf
|
||||||
}
|
}
|
||||||
|
|
||||||
private void debugLog(HRegionInfo region, String string) {
|
private void debugLog(HRegionInfo region, String string) {
|
||||||
if (region.isMetaTable() || region.isRootRegion()) {
|
if (region.isMetaTable()) {
|
||||||
LOG.info(string);
|
LOG.info(string);
|
||||||
} else {
|
} else {
|
||||||
LOG.debug(string);
|
LOG.debug(string);
|
||||||
|
|
|
@ -1095,7 +1095,7 @@ public class HBaseFsck {
|
||||||
throws IOException, KeeperException, InterruptedException {
|
throws IOException, KeeperException, InterruptedException {
|
||||||
List <HbckInfo> metaRegions = Lists.newArrayList();
|
List <HbckInfo> metaRegions = Lists.newArrayList();
|
||||||
for (HbckInfo value : regionInfo.values()) {
|
for (HbckInfo value : regionInfo.values()) {
|
||||||
if (value.metaEntry.isMetaTable()) {
|
if (value.metaEntry.isMetaRegion()) {
|
||||||
metaRegions.add(value);
|
metaRegions.add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1501,7 +1501,7 @@ public class HBaseFsck {
|
||||||
private List<HRegionInfo> filterOnlyMetaRegions(List<HRegionInfo> regions) {
|
private List<HRegionInfo> filterOnlyMetaRegions(List<HRegionInfo> regions) {
|
||||||
List<HRegionInfo> ret = Lists.newArrayList();
|
List<HRegionInfo> ret = Lists.newArrayList();
|
||||||
for (HRegionInfo hri : regions) {
|
for (HRegionInfo hri : regions) {
|
||||||
if (hri.isMetaRegion() || hri.isRootRegion()) {
|
if (hri.isMetaTable()) {
|
||||||
ret.add(hri);
|
ret.add(hri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1137,7 +1137,7 @@ public class TestAdmin {
|
||||||
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLENAME);
|
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLENAME);
|
||||||
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
||||||
for (HRegionInfo regionInfo : onlineRegions) {
|
for (HRegionInfo regionInfo : onlineRegions) {
|
||||||
if (!regionInfo.isMetaRegion() && !regionInfo.isRootRegion()) {
|
if (!regionInfo.isMetaTable()) {
|
||||||
info = regionInfo;
|
info = regionInfo;
|
||||||
admin.closeRegionWithEncodedRegionName(regionInfo.getEncodedName(), rs
|
admin.closeRegionWithEncodedRegionName(regionInfo.getEncodedName(), rs
|
||||||
.getServerName().getServerName());
|
.getServerName().getServerName());
|
||||||
|
@ -1158,7 +1158,7 @@ public class TestAdmin {
|
||||||
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLENAME);
|
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLENAME);
|
||||||
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
||||||
for (HRegionInfo regionInfo : onlineRegions) {
|
for (HRegionInfo regionInfo : onlineRegions) {
|
||||||
if (!regionInfo.isMetaRegion() && !regionInfo.isRootRegion()) {
|
if (!regionInfo.isMetaTable()) {
|
||||||
if (regionInfo.getRegionNameAsString().contains("TestHBACloseRegion1")) {
|
if (regionInfo.getRegionNameAsString().contains("TestHBACloseRegion1")) {
|
||||||
info = regionInfo;
|
info = regionInfo;
|
||||||
admin.closeRegionWithEncodedRegionName("sample", rs.getServerName()
|
admin.closeRegionWithEncodedRegionName("sample", rs.getServerName()
|
||||||
|
@ -1180,7 +1180,7 @@ public class TestAdmin {
|
||||||
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLENAME);
|
HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLENAME);
|
||||||
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
||||||
for (HRegionInfo regionInfo : onlineRegions) {
|
for (HRegionInfo regionInfo : onlineRegions) {
|
||||||
if (!regionInfo.isMetaRegion() && !regionInfo.isRootRegion()) {
|
if (!regionInfo.isMetaTable()) {
|
||||||
|
|
||||||
if (regionInfo.getRegionNameAsString().contains("TestHBACloseRegion2")) {
|
if (regionInfo.getRegionNameAsString().contains("TestHBACloseRegion2")) {
|
||||||
info = regionInfo;
|
info = regionInfo;
|
||||||
|
@ -1211,7 +1211,7 @@ public class TestAdmin {
|
||||||
try {
|
try {
|
||||||
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
||||||
for (HRegionInfo regionInfo : onlineRegions) {
|
for (HRegionInfo regionInfo : onlineRegions) {
|
||||||
if (!regionInfo.isMetaRegion() && !regionInfo.isRootRegion()) {
|
if (!regionInfo.isMetaTable()) {
|
||||||
if (regionInfo.getRegionNameAsString()
|
if (regionInfo.getRegionNameAsString()
|
||||||
.contains("TestHBACloseRegion3")) {
|
.contains("TestHBACloseRegion3")) {
|
||||||
admin.closeRegionWithEncodedRegionName(regionInfo.getEncodedName(),
|
admin.closeRegionWithEncodedRegionName(regionInfo.getEncodedName(),
|
||||||
|
@ -1235,7 +1235,7 @@ public class TestAdmin {
|
||||||
try {
|
try {
|
||||||
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
||||||
for (HRegionInfo regionInfo : onlineRegions) {
|
for (HRegionInfo regionInfo : onlineRegions) {
|
||||||
if (!regionInfo.isMetaRegion() && !regionInfo.isRootRegion()) {
|
if (!regionInfo.isMetaTable()) {
|
||||||
if (regionInfo.getRegionNameAsString()
|
if (regionInfo.getRegionNameAsString()
|
||||||
.contains("TestHBACloseRegionWhenServerNameIsEmpty")) {
|
.contains("TestHBACloseRegionWhenServerNameIsEmpty")) {
|
||||||
admin.closeRegionWithEncodedRegionName(regionInfo.getEncodedName(),
|
admin.closeRegionWithEncodedRegionName(regionInfo.getEncodedName(),
|
||||||
|
@ -1258,7 +1258,7 @@ public class TestAdmin {
|
||||||
|
|
||||||
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
List<HRegionInfo> onlineRegions = rs.getOnlineRegions();
|
||||||
for (HRegionInfo regionInfo : onlineRegions) {
|
for (HRegionInfo regionInfo : onlineRegions) {
|
||||||
if (!regionInfo.isMetaRegion() && !regionInfo.isRootRegion()) {
|
if (!regionInfo.isMetaTable()) {
|
||||||
if (regionInfo.getRegionNameAsString().contains("TestHBACloseRegion4")) {
|
if (regionInfo.getRegionNameAsString().contains("TestHBACloseRegion4")) {
|
||||||
info = regionInfo;
|
info = regionInfo;
|
||||||
admin.closeRegionWithEncodedRegionName(regionInfo
|
admin.closeRegionWithEncodedRegionName(regionInfo
|
||||||
|
|
|
@ -688,7 +688,7 @@ public class TestMasterObserver {
|
||||||
int moveCnt = openRegions.size()/2;
|
int moveCnt = openRegions.size()/2;
|
||||||
for (int i=0; i<moveCnt; i++) {
|
for (int i=0; i<moveCnt; i++) {
|
||||||
HRegionInfo info = openRegions.get(i);
|
HRegionInfo info = openRegions.get(i);
|
||||||
if (!(info.isMetaRegion() || info.isRootRegion())) {
|
if (!info.isMetaTable()) {
|
||||||
master.move(openRegions.get(i).getEncodedNameAsBytes(), destRS);
|
master.move(openRegions.get(i).getEncodedNameAsBytes(), destRS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ public class TestDistributedLogSplitting {
|
||||||
Iterator<HRegionInfo> it = regions.iterator();
|
Iterator<HRegionInfo> it = regions.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
HRegionInfo region = it.next();
|
HRegionInfo region = it.next();
|
||||||
if (region.isMetaRegion() || region.isRootRegion()) {
|
if (region.isMetaTable()) {
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,7 @@ public class TestDistributedLogSplitting {
|
||||||
HRegionServer hrs = rst.getRegionServer();
|
HRegionServer hrs = rst.getRegionServer();
|
||||||
List<HRegionInfo> hris = hrs.getOnlineRegions();
|
List<HRegionInfo> hris = hrs.getOnlineRegions();
|
||||||
for (HRegionInfo hri : hris) {
|
for (HRegionInfo hri : hris) {
|
||||||
if (hri.isMetaRegion() || hri.isRootRegion()) {
|
if (hri.isMetaTable()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LOG.debug("adding data to rs = " + rst.getName() +
|
LOG.debug("adding data to rs = " + rst.getName() +
|
||||||
|
|
|
@ -197,8 +197,7 @@ public class TestOpenedRegionHandler {
|
||||||
HRegion region = null;
|
HRegion region = null;
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
region = iterator.next();
|
region = iterator.next();
|
||||||
if (!region.getRegionInfo().isMetaRegion()
|
if (!region.getRegionInfo().isMetaTable()) {
|
||||||
&& !region.getRegionInfo().isRootRegion()) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,4 +113,10 @@ public class TestHRegionInfo {
|
||||||
} catch (IllegalArgumentException iae) {
|
} catch (IllegalArgumentException iae) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMetaTables() {
|
||||||
|
assertTrue(HRegionInfo.ROOT_REGIONINFO.isMetaTable());
|
||||||
|
assertTrue(HRegionInfo.FIRST_META_REGIONINFO.isMetaTable());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue