Apache9 commented on a change in pull request #1774:
URL: https://github.com/apache/hbase/pull/1774#discussion_r436483372
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java
##########
@@ -1105,23 +1097,7 @@ public void run(PRESP resp) {
* List all region locations for the specific table.
*/
private CompletableFuture<List<HRegionLocation>>
getTableHRegionLocations(TableName tableName) {
- if (TableName.META_TABLE_NAME.equals(tableName)) {
- CompletableFuture<List<HRegionLocation>> future = new
CompletableFuture<>();
- addListener(connection.registry.getMetaRegionLocations(), (metaRegions,
err) -> {
- if (err != null) {
- future.completeExceptionally(err);
- } else if (metaRegions == null || metaRegions.isEmpty() ||
- metaRegions.getDefaultRegionLocation() == null) {
- future.completeExceptionally(new IOException("meta region does not
found"));
- } else {
-
future.complete(Collections.singletonList(metaRegions.getDefaultRegionLocation()));
- }
- });
- return future;
- } else {
- // For non-meta table, we fetch all locations by scanning hbase:meta
table
- return AsyncMetaTableAccessor.getTableHRegionLocations(metaTable,
tableName);
- }
+ return connection.getRegionLocator(tableName).getAllRegionLocations();
Review comment:
The problem is that, for meta table we can not use the methods from
ConnectionRegistry any more as now we could have multiple meta regions, so we
change to use RegionLocator, and the RegionLocator could also deal with normal
tables, so here we can unify them together.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]