You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2022/04/12 12:55:13 UTC

[GitHub] [hbase] bbeaudreault commented on a diff in pull request #4335: HBASE-26942 cache region locations when getAllRegionLocations

bbeaudreault commented on code in PR #4335:
URL: https://github.com/apache/hbase/pull/4335#discussion_r848401342


##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableRegionLocatorImpl.java:
##########
@@ -62,7 +62,10 @@ public CompletableFuture<List<HRegionLocation>> getAllRegionLocations() {
           .thenApply(locs -> Arrays.asList(locs.getRegionLocations()));
       }
       return ClientMetaTableAccessor
-        .getTableHRegionLocations(conn.getTable(TableName.META_TABLE_NAME), tableName);
+        .getTableHRegionLocations(conn.getTable(TableName.META_TABLE_NAME), tableName)
+        .whenComplete((locs, error) -> {

Review Comment:
   You need to handle the case where error != null here. In that case I believe locs will be null, and you'll get an NPE below.  Can you add a test for this?
   
   Also, I think the convention in the async client is to use FutureUtils.addListener. The benefit there is it will also handle catching any errors thrown by your own callback.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org