HBASE-12010 Use TableName.META_TABLE_NAME instead of indirectly from HTableDescriptor
This commit is contained in:
parent
64a69f0ffc
commit
e05f78ec01
@ -328,7 +328,7 @@ public class MetaTableAccessor {
|
|||||||
public static boolean tableExists(HConnection hConnection,
|
public static boolean tableExists(HConnection hConnection,
|
||||||
final TableName tableName)
|
final TableName tableName)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (tableName.equals(HTableDescriptor.META_TABLEDESC.getTableName())) {
|
if (tableName.equals(TableName.META_TABLE_NAME)) {
|
||||||
// Catalog tables always exist.
|
// Catalog tables always exist.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ public class FSTableDescriptors implements TableDescriptors {
|
|||||||
public TableDescriptor getDescriptor(final TableName tablename)
|
public TableDescriptor getDescriptor(final TableName tablename)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
invocations++;
|
invocations++;
|
||||||
if (HTableDescriptor.META_TABLEDESC.getTableName().equals(tablename)) {
|
if (TableName.META_TABLE_NAME.equals(tablename)) {
|
||||||
cachehits++;
|
cachehits++;
|
||||||
return new TableDescriptor(HTableDescriptor.META_TABLEDESC, TableState.State.ENABLED);
|
return new TableDescriptor(HTableDescriptor.META_TABLEDESC, TableState.State.ENABLED);
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ public class FSTableDescriptors implements TableDescriptors {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public HTableDescriptor get(TableName tableName) throws IOException {
|
public HTableDescriptor get(TableName tableName) throws IOException {
|
||||||
if (HTableDescriptor.META_TABLEDESC.getTableName().equals(tableName)) {
|
if (TableName.META_TABLE_NAME.equals(tableName)) {
|
||||||
cachehits++;
|
cachehits++;
|
||||||
return HTableDescriptor.META_TABLEDESC;
|
return HTableDescriptor.META_TABLEDESC;
|
||||||
}
|
}
|
||||||
|
@ -1157,7 +1157,7 @@ public class TestAdmin {
|
|||||||
}
|
}
|
||||||
assertTrue("Unexcepted exception message " + msg, msg != null &&
|
assertTrue("Unexcepted exception message " + msg, msg != null &&
|
||||||
msg.startsWith(TableExistsException.class.getName()) &&
|
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.
|
// Now try and do concurrent creation with a bunch of threads.
|
||||||
final HTableDescriptor threadDesc =
|
final HTableDescriptor threadDesc =
|
||||||
|
@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.HConstants;
|
|||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||||
import org.apache.hadoop.hbase.KeyValue;
|
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.RegionServerTests;
|
||||||
import org.apache.hadoop.hbase.testclassification.SmallTests;
|
import org.apache.hadoop.hbase.testclassification.SmallTests;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
@ -126,7 +127,7 @@ public class TestLogRollingNoCluster {
|
|||||||
byte[] bytes = Bytes.toBytes(i);
|
byte[] bytes = Bytes.toBytes(i);
|
||||||
edit.add(new KeyValue(bytes, bytes, bytes, now, EMPTY_1K_ARRAY));
|
edit.add(new KeyValue(bytes, bytes, bytes, now, EMPTY_1K_ARRAY));
|
||||||
this.wal.append(HRegionInfo.FIRST_META_REGIONINFO,
|
this.wal.append(HRegionInfo.FIRST_META_REGIONINFO,
|
||||||
HTableDescriptor.META_TABLEDESC.getTableName(),
|
TableName.META_TABLE_NAME,
|
||||||
edit, now, HTableDescriptor.META_TABLEDESC, sequenceId);
|
edit, now, HTableDescriptor.META_TABLEDESC, sequenceId);
|
||||||
}
|
}
|
||||||
String msg = getName() + " finished";
|
String msg = getName() + " finished";
|
||||||
|
@ -65,7 +65,7 @@ public class TestReplicationWALEntryFilters {
|
|||||||
assertNull(filter.filter(metaEntry));
|
assertNull(filter.filter(metaEntry));
|
||||||
|
|
||||||
// ns table
|
// 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);
|
HLog.Entry nsEntry = new Entry(key2, null);
|
||||||
assertNull(filter.filter(nsEntry));
|
assertNull(filter.filter(nsEntry));
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ public class TestHBaseFsck {
|
|||||||
|
|
||||||
// Now let's mess it up and change the assignment in hbase:meta to
|
// Now let's mess it up and change the assignment in hbase:meta to
|
||||||
// point to a different region server
|
// 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);
|
executorService);
|
||||||
Scan scan = new Scan();
|
Scan scan = new Scan();
|
||||||
scan.setStartRow(Bytes.toBytes(table+",,"));
|
scan.setStartRow(Bytes.toBytes(table+",,"));
|
||||||
@ -1521,7 +1521,7 @@ public class TestHBaseFsck {
|
|||||||
Bytes.toBytes("C"), true, true, false);
|
Bytes.toBytes("C"), true, true, false);
|
||||||
|
|
||||||
// Create a new meta entry to fake it as a split parent.
|
// 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);
|
executorService);
|
||||||
HRegionInfo hri = location.getRegionInfo();
|
HRegionInfo hri = location.getRegionInfo();
|
||||||
|
|
||||||
@ -1596,7 +1596,7 @@ public class TestHBaseFsck {
|
|||||||
TEST_UTIL.getHBaseAdmin().flush(table);
|
TEST_UTIL.getHBaseAdmin().flush(table);
|
||||||
HRegionLocation location = tbl.getRegionLocation("B");
|
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();
|
HRegionInfo hri = location.getRegionInfo();
|
||||||
|
|
||||||
// do a regular split
|
// do a regular split
|
||||||
@ -1646,7 +1646,7 @@ public class TestHBaseFsck {
|
|||||||
TEST_UTIL.getHBaseAdmin().flush(table);
|
TEST_UTIL.getHBaseAdmin().flush(table);
|
||||||
HRegionLocation location = tbl.getRegionLocation("B");
|
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();
|
HRegionInfo hri = location.getRegionInfo();
|
||||||
|
|
||||||
// do a regular split
|
// do a regular split
|
||||||
@ -2189,7 +2189,7 @@ public class TestHBaseFsck {
|
|||||||
|
|
||||||
// Mess it up by removing the RegionInfo for one region.
|
// Mess it up by removing the RegionInfo for one region.
|
||||||
final List<Delete> deletes = new LinkedList<Delete>();
|
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() {
|
MetaScanner.metaScan(conf, new MetaScanner.MetaScannerVisitor() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -279,7 +279,7 @@ public class OfflineMetaRebuildTestCore {
|
|||||||
*/
|
*/
|
||||||
protected int scanMeta() throws IOException {
|
protected int scanMeta() throws IOException {
|
||||||
int count = 0;
|
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());
|
ResultScanner scanner = meta.getScanner(new Scan());
|
||||||
LOG.info("Table: " + Bytes.toString(meta.getTableName()));
|
LOG.info("Table: " + Bytes.toString(meta.getTableName()));
|
||||||
for (Result res : scanner) {
|
for (Result res : scanner) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user