saintstack commented on a change in pull request #2652:
URL: https://github.com/apache/hbase/pull/2652#discussion_r524416358



##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ZKConnectionRegistry.java
##########
@@ -138,8 +141,15 @@ private void 
getMetaRegionLocation(CompletableFuture<RegionLocations> future,
     if (metaReplicaZNodes.isEmpty()) {
       future.completeExceptionally(new IOException("No meta znode available"));
     }
-    HRegionLocation[] locs = new HRegionLocation[metaReplicaZNodes.size()];
-    MutableInt remaining = new MutableInt(locs.length);
+    // Note, the list of metaReplicaZNodes may be discontiguous regards 
replicaId; i.e. we may have
+    // a znode for the default -- replicaId=0 -- and perhaps replicaId '2' but 
be could be missing
+    // znode for replicaId '1'. This is a transient condition. Because of this 
we are careful
+    // accumulating locations. We use a Map so retries overwrite rather than 
aggregate and the
+    // Map sorts just to be kind to further processing. The Map will retain 
the discontinuity on
+    // replicaIds but on completion (of the future), the Map values are passed 
to the
+    // RegionLocations constructor which knows how to deal with 
discontinuities.
+    final Map<Integer, HRegionLocation> locs = new TreeMap();

Review comment:
       Fixed




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


Reply via email to