hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r1576964 - /hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
Date Wed, 12 Mar 2014 22:31:18 GMT
Author: ddas
Date: Wed Mar 12 22:31:18 2014
New Revision: 1576964

URL: http://svn.apache.org/r1576964
Log:
HBASE-10729. Enable table doesn't balance out replicas evenly if the replicas were unassigned
earlier

Modified:
    hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java

Modified: hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java?rev=1576964&r1=1576963&r2=1576964&view=diff
==============================================================================
--- hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
(original)
+++ hbase/branches/hbase-10070/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
Wed Mar 12 22:31:18 2014
@@ -198,10 +198,15 @@ public class EnableTableHandler extends 
       // need to potentially create some regions for the replicas
       List<HRegionInfo> unrecordedReplicas = AssignmentManager.replicaRegionsNotRecordedInMeta(
           new HashSet<HRegionInfo>(regionsToAssign.keySet()), services);
-      for (HRegionInfo h : unrecordedReplicas) {
-        regionsToAssign.put(h, 
-            this.assignmentManager.getBalancer().randomAssignment(h,
-                serverManager.getOnlineServersList()));
+      Map<ServerName, List<HRegionInfo>> srvToUnassignedRegs =
+            this.assignmentManager.getBalancer().roundRobinAssignment(unrecordedReplicas,
+                serverManager.getOnlineServersList());
+      if (srvToUnassignedRegs != null) {
+        for (Map.Entry<ServerName, List<HRegionInfo>> entry : srvToUnassignedRegs.entrySet())
{
+          for (HRegionInfo h : entry.getValue()) {
+            regionsToAssign.put(h, entry.getKey());
+          }
+        }
       }
     }
     int regionsCount = regionsToAssign.size();



Mime
View raw message