diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java index 58b3a2d345a..369f86a2ce1 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java @@ -429,18 +429,6 @@ public class HTableDescriptor implements WritableComparable { return isMetaRegion() && !isRootRegion(); } - /** - * Checks of the tableName being passed is a system table - * - * - * @return true if a tableName is a member of the system - * namesapce (aka hbase) - */ - public static boolean isSystemTable(final TableName tableName) { - return tableName.getNamespaceAsString() - .equals(NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR); - } - /** * Getter for accessing the metadata associated with the key * diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java index e2f08c00353..93b7e503eb7 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java @@ -304,7 +304,7 @@ public class HTable implements HTableInterface { */ private void finishSetup() throws IOException { this.connection.locateRegion(tableName, HConstants.EMPTY_START_ROW); - this.operationTimeout = HTableDescriptor.isSystemTable(tableName) ? + this.operationTimeout = tableName.isSystemTable() ? this.configuration.getInt(HConstants.HBASE_CLIENT_META_OPERATION_TIMEOUT, HConstants.DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT): this.configuration.getInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ClientSnapshotDescriptionUtils.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ClientSnapshotDescriptionUtils.java index 9da1c84de1b..51f48abf327 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ClientSnapshotDescriptionUtils.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/ClientSnapshotDescriptionUtils.java @@ -21,8 +21,6 @@ package org.apache.hadoop.hbase.snapshot; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.HTableDescriptor; -import org.apache.hadoop.hbase.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; import org.apache.hadoop.hbase.util.Bytes; @@ -46,7 +44,7 @@ public class ClientSnapshotDescriptionUtils { // make sure the table name is valid, this will implicitly check validity TableName tableName = TableName.valueOf(snapshot.getTable()); - if (HTableDescriptor.isSystemTable(tableName)) { + if (tableName.isSystemTable()) { throw new IllegalArgumentException("System table snapshots are not allowed"); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java index 7aaa9c57ff3..4a21cbc93a9 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java @@ -47,7 +47,6 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.Chore; import org.apache.hadoop.hbase.HBaseIOException; import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.exceptions.DeserializationException; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; @@ -453,7 +452,7 @@ public class AssignmentManager extends ZooKeeperListener { // its a clean cluster startup, else its a failover. Map regions = regionStates.getRegionAssignments(); for (Map.Entry e: regions.entrySet()) { - if (!HTableDescriptor.isSystemTable(e.getKey().getTableName()) + if (!e.getKey().getTableName().isSystemTable() && e.getValue() != null) { LOG.debug("Found " + e + " out on cluster"); failover = true; @@ -2575,7 +2574,7 @@ public class AssignmentManager extends ZooKeeperListener { //remove system tables because they would have been assigned earlier for(Iterator iter = allRegions.keySet().iterator(); iter.hasNext();) { - if (HTableDescriptor.isSystemTable(iter.next().getTableName())) { + if (iter.next().getTableName().isSystemTable()) { iter.remove(); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index 14d7ad09102..c429263631f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -1045,7 +1045,7 @@ MasterServices, Server { MetaReader.fullScan(catalogTracker, disabledOrDisablingOrEnabling, true); for(Iterator iter = allRegions.keySet().iterator(); iter.hasNext();) { - if (!HTableDescriptor.isSystemTable(iter.next().getTableName())) { + if (!iter.next().getTableName().isSystemTable()) { iter.remove(); } } @@ -2601,7 +2601,7 @@ MasterServices, Server { } if (descriptorMap != null) { for(HTableDescriptor desc: descriptorMap.values()) { - if(!HTableDescriptor.isSystemTable(desc.getTableName())) { + if(!desc.getTableName().isSystemTable()) { descriptors.add(desc); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java index 03d9c5f680a..5bcd2e57f1b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java @@ -39,7 +39,6 @@ import org.apache.hadoop.hbase.CoprocessorEnvironment; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; -import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.client.Append; import org.apache.hadoop.hbase.client.Delete; @@ -147,7 +146,7 @@ public class RegionCoprocessorHost loadSystemCoprocessors(conf, REGION_COPROCESSOR_CONF_KEY); // load system default cp's for user tables from configuration. - if (!HTableDescriptor.isSystemTable(region.getRegionInfo().getTableName())) { + if (!region.getRegionInfo().getTableName().isSystemTable()) { loadSystemCoprocessors(conf, USER_REGION_COPROCESSOR_CONF_KEY); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/model/TableRegionModel.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/model/TableRegionModel.java index 02ba03561d2..9002da75784 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/model/TableRegionModel.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/model/TableRegionModel.java @@ -27,7 +27,6 @@ import javax.xml.bind.annotation.XmlRootElement; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.HRegionInfo; -import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.util.Bytes; /** @@ -96,10 +95,9 @@ public class TableRegionModel implements Serializable { @XmlAttribute public String getName() { byte [] tableNameAsBytes = Bytes.toBytes(this.table); + TableName tableName = TableName.valueOf(tableNameAsBytes); byte [] nameAsBytes = HRegionInfo.createRegionName( - TableName.valueOf(tableNameAsBytes), - this.startKey, this.id, - !HTableDescriptor.isSystemTable(TableName.valueOf(tableNameAsBytes))); + tableName, this.startKey, this.id, !tableName.isSystemTable()); return Bytes.toString(nameAsBytes); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java index c6bcfbdff67..72da6de22f7 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin.java @@ -1325,7 +1325,7 @@ public class TestAdmin { HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLENAME); List onlineRegions = ProtobufUtil.getOnlineRegions(rs); for (HRegionInfo regionInfo : onlineRegions) { - if (!HTableDescriptor.isSystemTable(regionInfo.getTableName())) { + if (!regionInfo.getTableName().isSystemTable()) { info = regionInfo; admin.closeRegionWithEncodedRegionName(regionInfo.getEncodedName(), rs .getServerName().getServerName()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java index efc5aa1bce7..8b281e13f07 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestDistributedLogSplitting.java @@ -1121,7 +1121,7 @@ public class TestDistributedLogSplitting { HRegionServer hrs = rst.getRegionServer(); List hris = ProtobufUtil.getOnlineRegions(hrs); for (HRegionInfo hri : hris) { - if (HTableDescriptor.isSystemTable(hri.getTableName())) { + if (hri.getTableName().isSystemTable()) { continue; } LOG.debug("adding data to rs = " + rst.getName() + @@ -1146,7 +1146,7 @@ public class TestDistributedLogSplitting { for(Iterator iter = regions.iterator(); iter.hasNext(); ) { HRegionInfo regionInfo = iter.next(); - if(HTableDescriptor.isSystemTable(regionInfo.getTableName())) { + if(regionInfo.getTableName().isSystemTable()) { iter.remove(); } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java index 7c20665d681..59be5f4250c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java @@ -1868,8 +1868,7 @@ public class TestHBaseFsck { @Override public boolean processRow(Result rowResult) throws IOException { - if(!HTableDescriptor.isSystemTable(MetaScanner.getHRegionInfo(rowResult) - .getTableName())) { + if(!MetaScanner.getHRegionInfo(rowResult).getTableName().isSystemTable()) { Delete delete = new Delete(rowResult.getRow()); delete.deleteColumn(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER); deletes.add(delete);