hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nspiegelb...@apache.org
Subject svn commit: r1227394 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/PreferredAssignmentManager.java
Date Wed, 04 Jan 2012 23:46:29 GMT
Author: nspiegelberg
Date: Wed Jan  4 23:46:29 2012
New Revision: 1227394

URL: http://svn.apache.org/viewvc?rev=1227394&view=rev
[master] Regions should not have multiple transient preferred assignments

Transient preferred assignments affect the way regions are load balanced
across servers, and those assignments should not exist longer than
necessary. If a server has a transient preferred assignment for a region
which is not in transition, that assignment will prevent the region from
receiving other regions without preferred assignments.

Some unexpected behavior which was observed was a region would have
multiple transient preferred assignments, only one of which could be
honored. The unhonored assignment would cause that server to ignore
assignments of other regions without preferred assignments. If that
server was the least-loaded, the ignored regions would not be assigned
to other servers and would remain unassigned until the preferred
assignment timed out.

This change causes any attempt to add a transient preferred assignment
for a region which already has an assignment to be ignored.

Test Plan:
On a cluster with a mix of regions with and without preferred
assignments, observe from log output that duplicate transient preferred
assignments are prevented and that load balancing does not cause some
regions to be unassigned for extended durations.

Reviewers: kranganathan, kannan, nspiegelberg

Reviewed By: nspiegelberg

CC: hbase-eng@lists, kranganathan, nspiegelberg, cgist

Differential Revision: 376980


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=1227394&r1=1227393&r2=1227394&view=diff
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/PreferredAssignmentManager.java
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/PreferredAssignmentManager.java
Wed Jan  4 23:46:29 2012
@@ -124,9 +124,21 @@ public class PreferredAssignmentManager 
     return servers;
+  /**
+   * Add a transient assignment for a region to a server. If the region already
+   * has a transient assignment, then this method will do nothing.
+   * @param server
+   * @param region
+   */
   public void addTransientAssignment(HServerAddress server,
       HRegionInfo region) {
     synchronized (transientAssignments) {
+      if (regionsWithTransientAssignment.contains(region)) {
+        LOG.info("Attempted to add transient assignment for " +
+            region.getRegionNameAsString() + " to " + server +
+            " but already had assignment, new assignment ignored");
+        return;
+      }
       Set<HRegionInfo> regions = transientAssignments.get(server);
       if (regions == null) {
         regions = new ConcurrentSkipListSet<HRegionInfo>();

View raw message