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

Conflicts:
	hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSTableDescriptors.java
	hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollingNoCluster.java
This commit is contained in:
stack 2014-09-19 00:05:50 -07:00
parent 60287ed983
commit 3a5e580010
7 changed files with 45 additions and 44 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

@ -144,7 +144,7 @@ public class FSTableDescriptors implements TableDescriptors {
public HTableDescriptor get(final TableName tablename)
throws IOException {
invocations++;
if (HTableDescriptor.META_TABLEDESC.getTableName().equals(tablename)) {
if (TableName.META_TABLE_NAME.equals(tablename)) {
cachehits++;
return HTableDescriptor.META_TABLEDESC;
}

View File

@ -1159,7 +1159,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

@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.SmallTests;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@ -125,7 +126,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

@ -64,7 +64,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

@ -160,7 +160,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+",,"));
@ -1310,7 +1310,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();
@ -1385,7 +1385,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
@ -1435,7 +1435,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
@ -1978,7 +1978,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

@ -278,7 +278,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) {