Apache9 commented on code in PR #7174:
URL: https://github.com/apache/hbase/pull/7174#discussion_r2234000333


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java:
##########
@@ -460,13 +460,15 @@ static void rollingSplit(TableName tableName, 
SplitAlgorithm splitAlgo, Configur
                 }
               }
 
+              // Sort the ServerNames by the number of regions they have
+              final List<ServerName> serversLeft = 
Lists.newArrayList(daughterRegions.keySet());
+              serversLeft.sort(Comparator.comparing(rsSizes::get));
+
               // Round-robin through the ServerName list. Choose the 
lightest-loaded servers
               // first to keep the master from load-balancing regions as we 
split.
-              for (Map.Entry<ServerName,
-                LinkedList<Pair<byte[], byte[]>>> daughterRegion : 
daughterRegions.entrySet()) {
+              for (final ServerName rsLoc : serversLeft) {
                 Pair<byte[], byte[]> dr = null;
-                ServerName rsLoc = daughterRegion.getKey();
-                LinkedList<Pair<byte[], byte[]>> regionList = 
daughterRegion.getValue();
+                final LinkedList<Pair<byte[], byte[]>> regionList = 
daughterRegions.get(rsLoc);

Review Comment:
   Is it possible to not use LinkedList here? Usually it does not benefit...
   
   Can be a separated issue though.



-- 
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-unsubscr...@hbase.apache.org

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

Reply via email to