HBASE-20930 MetaScanner.metaScan should respect meta table name (Vishal Khandelwal)
This commit is contained in:
parent
9b5a839b99
commit
ab3ec9477a
|
@ -147,7 +147,7 @@ public class MetaScanner {
|
|||
// managed connections getting tables. Leaving this as it is for now. Will
|
||||
// revisit when inclined to change all tests. User code probaby makes use of
|
||||
// managed connections too so don't change it till post hbase 1.0.
|
||||
try (Table metaTable = new HTable(TableName.META_TABLE_NAME, connection, null)) {
|
||||
try (Table metaTable = new HTable(metaTableName, connection, null)) {
|
||||
if (row != null) {
|
||||
// Scan starting at a particular row in a particular table
|
||||
Result startRowResult = getClosestRowOrBefore(metaTable, tableName, row,
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.hadoop.hbase.HRegionInfo;
|
|||
import org.apache.hadoop.hbase.MetaTableAccessor;
|
||||
import org.apache.hadoop.hbase.ServerName;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
import org.apache.hadoop.hbase.TableNotFoundException;
|
||||
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.apache.hadoop.hbase.util.StoppableImplementation;
|
||||
|
@ -107,6 +108,15 @@ public class TestMetaScanner {
|
|||
doReturn(true).when(visitor).processRow((Result) anyObject());
|
||||
MetaScanner.metaScan(connection, visitor, TABLENAME, Bytes.toBytes("region_ac"), 1);
|
||||
verify(visitor, times(1)).processRow((Result) anyObject());
|
||||
|
||||
// Verifying whether passed meta is honored by call or not
|
||||
try {
|
||||
MetaScanner.metaScan(connection, visitor, TABLENAME, Bytes.toBytes("region_ac"), 1,
|
||||
TableName.valueOf("invalidMeta"));
|
||||
Assert.fail("Passed invalid meta table name but it is not honored");
|
||||
} catch (TableNotFoundException e) {
|
||||
}
|
||||
|
||||
table.close();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue