[jira] [HBASE-6007] Make getTableRegions return an empty list if the table does not exist
Summary: Making the getTableRegions Thrift API method handle TableNotFoundException and return an empty list in that case. Without this the behavior is dependent on whether an HTable object is present in the thread-local cache in case a table was deleted. Test Plan: Unit tests Reviewers: kannan, liyintang Reviewed By: liyintang CC: stack Differential Revision: https://reviews.facebook.net/D3243 git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1340310 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ca81969a4f
commit
1a90a79658
|
@ -583,11 +583,19 @@ public class ThriftServerRunner implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of regions in the given table, or an empty list if the table does not exist
|
||||
*/
|
||||
@Override
|
||||
public List<TRegionInfo> getTableRegions(ByteBuffer tableName)
|
||||
throws IOError {
|
||||
try {
|
||||
HTable table = getTable(tableName);
|
||||
HTable table;
|
||||
try {
|
||||
table = getTable(tableName);
|
||||
} catch (TableNotFoundException ex) {
|
||||
return new ArrayList<TRegionInfo>();
|
||||
}
|
||||
Map<HRegionInfo, ServerName> regionLocations =
|
||||
table.getRegionLocations();
|
||||
List<TRegionInfo> results = new ArrayList<TRegionInfo>();
|
||||
|
|
Loading…
Reference in New Issue