HBASE-12010 Use TableName.META_TABLE_NAME instead of indirectly from HTableDescriptor

This commit is contained in:
stack 2014-09-19 00:05:50 -07:00
parent 64a69f0ffc
commit e05f78ec01
7 changed files with 13 additions and 12 deletions

View File

@ -328,7 +328,7 @@ public class MetaTableAccessor {
public static boolean tableExists(HConnection hConnection,
final TableName tableName)
throws IOException {
if (tableName.equals(HTableDescriptor.META_TABLEDESC.getTableName())) {
if (tableName.equals(TableName.META_TABLE_NAME)) {
// Catalog tables always exist.
return true;
}

View File

@ -156,7 +156,7 @@ public class FSTableDescriptors implements TableDescriptors {
public TableDescriptor getDescriptor(final TableName tablename)
throws IOException {
invocations++;
if (HTableDescriptor.META_TABLEDESC.getTableName().equals(tablename)) {
if (TableName.META_TABLE_NAME.equals(tablename)) {
cachehits++;
return new TableDescriptor(HTableDescriptor.META_TABLEDESC, TableState.State.ENABLED);
}
@ -202,7 +202,7 @@ public class FSTableDescriptors implements TableDescriptors {
*/
@Override
public HTableDescriptor get(TableName tableName) throws IOException {
if (HTableDescriptor.META_TABLEDESC.getTableName().equals(tableName)) {
if (TableName.META_TABLE_NAME.equals(tableName)) {
cachehits++;
return HTableDescriptor.META_TABLEDESC;
}

View File

@ -1157,7 +1157,7 @@ public class TestAdmin {
}
assertTrue("Unexcepted exception message " + msg, msg != null &&
msg.startsWith(TableExistsException.class.getName()) &&
msg.contains(HTableDescriptor.META_TABLEDESC.getTableName().getNameAsString()));
msg.contains(TableName.META_TABLE_NAME.getNameAsString()));
// Now try and do concurrent creation with a bunch of threads.
final HTableDescriptor threadDesc =

View File

@ -31,6 +31,7 @@ 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.TableName;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
@ -126,7 +127,7 @@ public class TestLogRollingNoCluster {
byte[] bytes = Bytes.toBytes(i);
edit.add(new KeyValue(bytes, bytes, bytes, now, EMPTY_1K_ARRAY));
this.wal.append(HRegionInfo.FIRST_META_REGIONINFO,
HTableDescriptor.META_TABLEDESC.getTableName(),
TableName.META_TABLE_NAME,
edit, now, HTableDescriptor.META_TABLEDESC, sequenceId);
}
String msg = getName() + " finished";

View File

@ -65,7 +65,7 @@ public class TestReplicationWALEntryFilters {
assertNull(filter.filter(metaEntry));
// ns table
HLogKey key2 = new HLogKey(new byte[] {}, HTableDescriptor.NAMESPACE_TABLEDESC.getTableName());
HLogKey key2 = new HLogKey(new byte[] {}, TableName.NAMESPACE_TABLE_NAME);
HLog.Entry nsEntry = new Entry(key2, null);
assertNull(filter.filter(nsEntry));

View File

@ -169,7 +169,7 @@ public class TestHBaseFsck {
// Now let's mess it up and change the assignment in hbase:meta to
// point to a different region server
Table meta = new HTable(conf, HTableDescriptor.META_TABLEDESC.getTableName(),
Table meta = new HTable(conf, TableName.META_TABLE_NAME,
executorService);
Scan scan = new Scan();
scan.setStartRow(Bytes.toBytes(table+",,"));
@ -1521,7 +1521,7 @@ public class TestHBaseFsck {
Bytes.toBytes("C"), true, true, false);
// Create a new meta entry to fake it as a split parent.
meta = new HTable(conf, HTableDescriptor.META_TABLEDESC.getTableName(),
meta = new HTable(conf, TableName.META_TABLE_NAME,
executorService);
HRegionInfo hri = location.getRegionInfo();
@ -1596,7 +1596,7 @@ public class TestHBaseFsck {
TEST_UTIL.getHBaseAdmin().flush(table);
HRegionLocation location = tbl.getRegionLocation("B");
meta = new HTable(conf, HTableDescriptor.META_TABLEDESC.getTableName());
meta = new HTable(conf, TableName.META_TABLE_NAME);
HRegionInfo hri = location.getRegionInfo();
// do a regular split
@ -1646,7 +1646,7 @@ public class TestHBaseFsck {
TEST_UTIL.getHBaseAdmin().flush(table);
HRegionLocation location = tbl.getRegionLocation("B");
meta = new HTable(conf, HTableDescriptor.META_TABLEDESC.getTableName());
meta = new HTable(conf, TableName.META_TABLE_NAME);
HRegionInfo hri = location.getRegionInfo();
// do a regular split
@ -2189,7 +2189,7 @@ public class TestHBaseFsck {
// Mess it up by removing the RegionInfo for one region.
final List<Delete> deletes = new LinkedList<Delete>();
Table meta = new HTable(conf, HTableDescriptor.META_TABLEDESC.getTableName());
Table meta = new HTable(conf, TableName.META_TABLE_NAME);
MetaScanner.metaScan(conf, new MetaScanner.MetaScannerVisitor() {
@Override

View File

@ -279,7 +279,7 @@ public class OfflineMetaRebuildTestCore {
*/
protected int scanMeta() throws IOException {
int count = 0;
HTable meta = new HTable(conf, HTableDescriptor.META_TABLEDESC.getTableName());
HTable meta = new HTable(conf, TableName.META_TABLE_NAME);
ResultScanner scanner = meta.getScanner(new Scan());
LOG.info("Table: " + Bytes.toString(meta.getTableName()));
for (Result res : scanner) {