Description
When scanning for a non existent table in hbase shell, error message in shell sometimes(based on META table content) displays completely unrelated table info , which seems to be unnecessary and inconsistent with other error messages:
hbase(main):016:0> scan 'noTable' ROW COLUMN+CELL ERROR: Unknown table Table 'noTable' was not found, got: hbase:namespace.! --------------------------------------------------------------------------------------------- hbase(main):017:0> scan '01_noTable' ROW COLUMN+CELL ERROR: Unknown table 01_noTable! --------------------------------------------------
Its happening when doing a META table scan (to locate input table ) and scanner stops at row of another table (beyond which table can not exist) in ConnectionManager.locateRegionInMeta:
private RegionLocations locateRegionInMeta(TableName tableName, byte[] row, boolean useCache, boolean retry, int replicaId) throws IOException { ................................. ................................ // possible we got a region of a different table... if (!regionInfo.getTable().equals(tableName)) { throw new TableNotFoundException( "Table '" + tableName + "' was not found, got: " + regionInfo.getTable() + "."); } ............................... ...............................
Here, we can simply put a debug message(if required) and just throw the TableNotFoundException(tableName) with only tableName instead of with scanner positioned row.