Author: nspiegelberg
Date: Wed Jan  4 23:46:22 2012
New Revision: 1227392

URL: http://svn.apache.org/viewvc?rev=1227392&view=rev
Log:
[master] Preferred assignments should ignore servers with no load info

Summary:
Before a server becomes dead or its info is removed from the collection
of server infos, it may be in the process of shutting down. Regions with
preferred assignments should not go to servers which are in such a
state, as identified by the absence of load information, which is among
the first things to be removed when a server shuts down.

Before, regions might get transient assignments to a server which is in
the process of shutting down, then that assignment would have to timeout
before the region could be assigned to another server. This change
should prevent that.

Test Plan:
Gracefully stop a region server which is the primary favored node for
some regions. Observe that those regions move to secondary or tertiary
nodes immediately.

Reviewers: kranganathan, kannan, liyintang

Reviewed By: liyintang

CC: hbase-eng@lists, kranganathan, liyintang, kannan

Differential Revision: 376982

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

Modified: 
hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/PreferredAssignmentManager.java
URL: 
http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/PreferredAssignmentManager.java?rev=1227392&r1=1227391&r2=1227392&view=diff
==============================================================================
--- 
hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/PreferredAssignmentManager.java
 (original)
+++ 
hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/PreferredAssignmentManager.java
 Wed Jan  4 23:46:22 2012
@@ -154,8 +154,15 @@ public class PreferredAssignmentManager 
     if (servers != null) {
       for (HServerAddress server : servers) {
         HServerInfo info = master.getServerManager().getHServerInfo(server);
+        // A preferred server is only eligible for assignment if the master
+        // knows about the server's info, the server is not in the collection 
of
+        // dead servers, and the server has load information. Absence of load
+        // information may indicate that the server is in the process of
+        // shutting down.
         if (info != null &&
-            !master.getServerManager().isDead(info.getServerName())) {
+            !master.getServerManager().isDead(info.getServerName()) &&
+            master.getServerManager().getServersToLoad()
+            .get(info.getServerName()) != null) {
           addTransientAssignment(server, region);
           return;
         }


Reply via email to