hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1421537 - in /hbase/trunk/hbase-server/src: main/java/org/apache/hadoop/hbase/coprocessor/ main/java/org/apache/hadoop/hbase/master/ main/java/org/apache/hadoop/hbase/security/access/ test/java/org/apache/hadoop/hbase/coprocessor/
Date Thu, 13 Dec 2012 21:11:50 GMT
Author: tedyu
Date: Thu Dec 13 21:11:43 2012
New Revision: 1421537

URL: http://svn.apache.org/viewvc?rev=1421537&view=rev
Log:
HBASE-7340 Master coprocessor notification for assignmentManager.balance() is inconsistent
(Ted Yu)


Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionPlan.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java?rev=1421537&r1=1421536&r2=1421537&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java
Thu Dec 13 21:11:43 2012
@@ -27,8 +27,10 @@ import org.apache.hadoop.hbase.Coprocess
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.UnknownRegionException;
+import org.apache.hadoop.hbase.master.RegionPlan;
 
 import java.io.IOException;
+import java.util.List;
 
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
@@ -236,7 +238,7 @@ public class BaseMasterObserver implemen
   }
 
   @Override
-  public void postBalance(ObserverContext<MasterCoprocessorEnvironment> ctx)
+  public void postBalance(ObserverContext<MasterCoprocessorEnvironment> ctx, List<RegionPlan>
plans)
       throws IOException {
   }
 

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java?rev=1421537&r1=1421536&r2=1421537&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java
Thu Dec 13 21:11:43 2012
@@ -19,11 +19,17 @@
 
 package org.apache.hadoop.hbase.coprocessor;
 
+import java.io.IOException;
+import java.util.List;
+
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
-import org.apache.hadoop.hbase.*;
-
-import java.io.IOException;
+import org.apache.hadoop.hbase.Coprocessor;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.master.RegionPlan;
 
 /**
  * Defines coprocessor hooks for interacting with operations on the
@@ -444,8 +450,11 @@ public interface MasterObserver extends 
   /**
    * Called after the balancing plan has been submitted.
    * @param ctx the environment to interact with the framework and master
+   * @param plans the RegionPlans which master has executed. RegionPlan serves as hint
+   * as for the final destination for the underlying region but may not represent the
+   * final state of assignment
    */
-  void postBalance(final ObserverContext<MasterCoprocessorEnvironment> ctx)
+  void postBalance(final ObserverContext<MasterCoprocessorEnvironment> ctx, List<RegionPlan>
plans)
       throws IOException;
 
   /**

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1421537&r1=1421536&r2=1421537&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Thu
Dec 13 21:11:43 2012
@@ -1332,7 +1332,7 @@ Server {
         }
       }
       if (this.cpHost != null) {
-        this.cpHost.postBalance();
+        this.cpHost.postBalance(rpCount < plans.size() ? plans.subList(0, rpCount) : plans);
       }
     }
     return balancerRan;

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java?rev=1421537&r1=1421536&r2=1421537&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java
Thu Dec 13 21:11:43 2012
@@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.*;
 import org.apache.hadoop.hbase.coprocessor.*;
 
 import java.io.IOException;
+import java.util.List;
 
 /**
  * Provides the coprocessor framework and environment for master oriented
@@ -827,13 +828,13 @@ public class MasterCoprocessorHost
     return bypass;
   }
 
-  void postBalance() throws IOException {
+  void postBalance(List<RegionPlan> plans) throws IOException {
     ObserverContext<MasterCoprocessorEnvironment> ctx = null;
     for (MasterEnvironment env: coprocessors) {
       if (env.getInstance() instanceof MasterObserver) {
         ctx = ObserverContext.createAndPrepare(env, ctx);
         try {
-          ((MasterObserver)env.getInstance()).postBalance(ctx);
+          ((MasterObserver)env.getInstance()).postBalance(ctx, plans);
         } catch (Throwable e) {
           handleCoprocessorThrowable(env, e);
         }

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionPlan.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionPlan.java?rev=1421537&r1=1421536&r2=1421537&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionPlan.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionPlan.java
Thu Dec 13 21:11:43 2012
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import java.util.Comparator;
 
 import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.ServerName;
 
@@ -34,7 +35,8 @@ import org.apache.hadoop.hbase.ServerNam
  * The comparable implementation of this class compares only the region
  * information and not the source/dest server info.
  */
-@InterfaceAudience.Private
+@InterfaceAudience.LimitedPrivate("Coprocessors")
+@InterfaceStability.Evolving
 public class RegionPlan implements Comparable<RegionPlan> {
   private final HRegionInfo hri;
   private final ServerName source;

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java?rev=1421537&r1=1421536&r2=1421537&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java
Thu Dec 13 21:11:43 2012
@@ -50,6 +50,7 @@ import org.apache.hadoop.hbase.filter.By
 import org.apache.hadoop.hbase.ipc.HBaseRPC;
 import org.apache.hadoop.hbase.ipc.ProtocolSignature;
 import org.apache.hadoop.hbase.ipc.RequestContext;
+import org.apache.hadoop.hbase.master.RegionPlan;
 import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.ResponseConverter;
 import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos;
@@ -727,7 +728,7 @@ public class AccessController extends Ba
     requirePermission(Permission.Action.ADMIN);
   }
   @Override
-  public void postBalance(ObserverContext<MasterCoprocessorEnvironment> c)
+  public void postBalance(ObserverContext<MasterCoprocessorEnvironment> c, List<RegionPlan>
plans)
       throws IOException {}
 
   @Override

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java?rev=1421537&r1=1421536&r2=1421537&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
Thu Dec 13 21:11:43 2012
@@ -42,6 +42,7 @@ import org.apache.hadoop.hbase.client.HT
 import org.apache.hadoop.hbase.master.AssignmentManager;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
+import org.apache.hadoop.hbase.master.RegionPlan;
 import org.apache.hadoop.hbase.master.RegionState;
 import org.apache.hadoop.hbase.protobuf.RequestConverter;
 import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
@@ -434,8 +435,8 @@ public class TestMasterObserver {
     }
 
     @Override
-    public void postBalance(ObserverContext<MasterCoprocessorEnvironment> env)
-        throws IOException {
+    public void postBalance(ObserverContext<MasterCoprocessorEnvironment> env,
+        List<RegionPlan> plans) throws IOException {
       postBalanceCalled = true;
     }
 



Mime
View raw message