HBASE-2556 Add convenience method to HBaseAdmin to get a collection of HRegionInfo objects for each table; fix some formatting
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1130322 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ac8a57e93b
commit
f765254568
@ -1249,8 +1249,8 @@ public class HBaseAdmin implements Abortable, Closeable {
|
||||
* @return Ordered list of {@link HRegionInfo}. *
|
||||
* @throws IOException
|
||||
*/
|
||||
public List<HRegionInfo> getTableRegions(final byte[] tableName) throws IOException
|
||||
{
|
||||
public List<HRegionInfo> getTableRegions(final byte[] tableName)
|
||||
throws IOException {
|
||||
CatalogTracker ct = getCatalogTracker();
|
||||
List<HRegionInfo> Regions;
|
||||
try {
|
||||
@ -1258,11 +1258,9 @@ public class HBaseAdmin implements Abortable, Closeable {
|
||||
} finally {
|
||||
cleanupCatalogTracker(ct);
|
||||
}
|
||||
|
||||
return Regions;
|
||||
}
|
||||
|
||||
|
||||
public void close() throws IOException {
|
||||
if (this.connection != null) {
|
||||
this.connection.close();
|
||||
|
@ -100,7 +100,6 @@ public class TestThriftServer extends HBaseClusterTestCase {
|
||||
handler.deleteTable(tableAname);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests adding a series of Mutations and BatchMutations, including a
|
||||
* delete mutation. Also tests data retrieval, and getting back multiple
|
||||
@ -312,7 +311,6 @@ public class TestThriftServer extends HBaseClusterTestCase {
|
||||
handler.deleteTable(tableAname);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For HBASE-2556
|
||||
* Tests for GetTableRegions
|
||||
@ -321,16 +319,15 @@ public class TestThriftServer extends HBaseClusterTestCase {
|
||||
*/
|
||||
public void doTestGetTableRegions() throws Exception {
|
||||
ThriftServer.HBaseHandler handler = new ThriftServer.HBaseHandler(this.conf);
|
||||
|
||||
handler.createTable(tableAname, getColumnDescriptors());
|
||||
int RegionCount = handler.getTableRegions(tableAname).size();
|
||||
int regionCount = handler.getTableRegions(tableAname).size();
|
||||
assertEquals("empty table should have only 1 region, " +
|
||||
"but found " + RegionCount, RegionCount, 1);
|
||||
"but found " + regionCount, regionCount, 1);
|
||||
handler.disableTable(tableAname);
|
||||
handler.deleteTable(tableAname);
|
||||
RegionCount = handler.getTableRegions(tableAname).size();
|
||||
regionCount = handler.getTableRegions(tableAname).size();
|
||||
assertEquals("non-existing table should have 0 region, " +
|
||||
"but found " + RegionCount, RegionCount, 0);
|
||||
"but found " + regionCount, regionCount, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user