hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1407904 - in /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master: AssignmentDomain.java RegionAssignmentSnapshot.java RegionPlacement.java
Date Sun, 11 Nov 2012 00:02:17 GMT
Author: liyin
Date: Sun Nov 11 00:02:16 2012
New Revision: 1407904

URL: http://svn.apache.org/viewvc?rev=1407904&view=rev
Log:
[master] Avoid "new" region server starvation during the region assignment

Author: liyintang

Summary:
Currently, the RegionPlacement would use all the region server in the META table as the assignment
domain. It may cause the starvation problem for the region server who just back from in-repair.

The fix is to add all the online region server into the assignment domain.

Test Plan: will test it on dark launch cluster

Reviewers: kannan, aaiyer, pritam

Reviewed By: kannan

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D626385

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/AssignmentDomain.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionAssignmentSnapshot.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionPlacement.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/AssignmentDomain.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/AssignmentDomain.java?rev=1407904&r1=1407903&r2=1407904&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/AssignmentDomain.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/AssignmentDomain.java
Sun Nov 11 00:02:16 2012
@@ -171,6 +171,10 @@ public class AssignmentDomain {
     }
   }
 
+  public Set<HServerAddress> getAllServers() {
+    return regionServerToRackMap.keySet();
+  }
+  
   /**
    * Get the region server to rack map
    */

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionAssignmentSnapshot.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionAssignmentSnapshot.java?rev=1407904&r1=1407903&r2=1407904&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionAssignmentSnapshot.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionAssignmentSnapshot.java
Sun Nov 11 00:02:16 2012
@@ -33,6 +33,8 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HServerAddress;
+import org.apache.hadoop.hbase.HServerInfo;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.MetaScanner;
 import org.apache.hadoop.hbase.client.MetaScanner.MetaScannerVisitor;
 import org.apache.hadoop.hbase.client.Result;
@@ -77,6 +79,12 @@ public class RegionAssignmentSnapshot {
     LOG.info("Start to scan the META for the current region assignment " +
 		"snappshot");
 
+    // Add all the online region servers
+    HBaseAdmin admin  = new HBaseAdmin(conf);
+    for (HServerInfo serverInfo : admin.getClusterStatus().getServerInfo()) {
+      globalAssignmentDomain.addServer(serverInfo.getServerAddress());
+    }
+    
     MetaScannerVisitor visitor = new MetaScannerVisitor() {
       public boolean processRow(Result result) throws IOException {
         try {
@@ -94,13 +102,10 @@ public class RegionAssignmentSnapshot {
 
           // Process the region server
           if (server == null) return true;
-          HServerAddress regionServer =
-            new HServerAddress(Bytes.toString(server));
+          HServerAddress regionServer = new HServerAddress(Bytes.toString(server));
 
           // Add the current assignment to the snapshot
           addAssignment(regionInfo, regionServer);
-          // Add the region server into the rack view
-          globalAssignmentDomain.addServer(regionServer);
 
           // Process the assignment plan
           byte[] favoredNodes = result.getValue(HConstants.CATALOG_FAMILY,
@@ -111,7 +116,6 @@ public class RegionAssignmentSnapshot {
             RegionPlacement.getFavoredNodesList(favoredNodes);
           exsitingAssignmentPlan.updateAssignmentPlan(regionInfo,
               favoredServerList);
-
           return true;
         } catch (RuntimeException e) {
           LOG.error("Catche remote exception " + e.getMessage() +

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionPlacement.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionPlacement.java?rev=1407904&r1=1407903&r2=1407904&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionPlacement.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionPlacement.java
Sun Nov 11 00:02:16 2012
@@ -315,12 +315,14 @@ public class RegionPlacement implements 
       // Get the current assignment map
       Map<HRegionInfo, HServerAddress> currentAssignmentMap =
         assignmentSnapshot.getRegionToRegionServerMap();
-      // Get the all the region servers
-      List<HServerAddress> servers = new ArrayList<HServerAddress>();
-      servers.addAll(assignmentSnapshot.getRegionServerToRegionMap().keySet());
+
       // Get the assignment domain
       AssignmentDomain domain = assignmentSnapshot.getGlobalAssignmentDomain();
 
+      // Get the all the region servers
+      List<HServerAddress> servers = new ArrayList<HServerAddress>();
+      servers.addAll(domain.getAllServers());
+      
       LOG.info("Start to generate assignment plan for " + numRegions +
           " regions from table " + tableName + " with " +
           servers.size() + " region servers");



Mime
View raw message