hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [16/21] hbase git commit: HBASE-14614 Procedure v2 - Core Assignment Manager (Matteo Bertozzi)
Date Thu, 23 Mar 2017 15:43:20 GMT
http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-protocol-shaded/src/main/protobuf/Master.proto
----------------------------------------------------------------------
diff --git a/hbase-protocol-shaded/src/main/protobuf/Master.proto b/hbase-protocol-shaded/src/main/protobuf/Master.proto
index e22695b..eeaae97 100644
--- a/hbase-protocol-shaded/src/main/protobuf/Master.proto
+++ b/hbase-protocol-shaded/src/main/protobuf/Master.proto
@@ -79,6 +79,21 @@ message MoveRegionRequest {
 message MoveRegionResponse {
 }
 
+ /**
+ * Dispatch merging the specified regions.
+ */
+message DispatchMergingRegionsRequest {
+  required RegionSpecifier region_a = 1;
+  required RegionSpecifier region_b = 2;
+  optional bool forcible = 3 [default = false];
+  optional uint64 nonce_group = 4 [default = 0];
+  optional uint64 nonce = 5 [default = 0];
+}
+
+message DispatchMergingRegionsResponse {
+  optional uint64 proc_id = 1;
+}
+
 /**
  * Merging the specified regions in a table.
  */
@@ -117,6 +132,17 @@ message OfflineRegionResponse {
 
 /* Table-level protobufs */
 
+message SplitTableRegionRequest {
+  required RegionInfo region_info = 1;
+  required bytes split_row = 2;
+  optional uint64 nonce_group = 3 [default = 0];
+  optional uint64 nonce = 4 [default = 0];
+}
+
+message SplitTableRegionResponse {
+  optional uint64 proc_id = 1;
+}
+
 message CreateTableRequest {
   required TableSchema table_schema = 1;
   repeated bytes split_keys = 2;
@@ -628,6 +654,10 @@ service MasterService {
   rpc ModifyColumn(ModifyColumnRequest)
     returns(ModifyColumnResponse);
 
+ /** Master dispatch merging the regions */
+  rpc DispatchMergingRegions(DispatchMergingRegionsRequest)
+    returns(DispatchMergingRegionsResponse);
+
   /** Move the region region to the destination server. */
   rpc MoveRegion(MoveRegionRequest)
     returns(MoveRegionResponse);
@@ -658,6 +688,12 @@ service MasterService {
   rpc OfflineRegion(OfflineRegionRequest)
     returns(OfflineRegionResponse);
 
+  /**
+   * Split region
+   */
+  rpc SplitRegion(SplitTableRegionRequest)
+    returns(SplitTableRegionResponse);
+
   /** Deletes a table */
   rpc DeleteTable(DeleteTableRequest)
     returns(DeleteTableResponse);

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-protocol-shaded/src/main/protobuf/MasterProcedure.proto
----------------------------------------------------------------------
diff --git a/hbase-protocol-shaded/src/main/protobuf/MasterProcedure.proto b/hbase-protocol-shaded/src/main/protobuf/MasterProcedure.proto
index ef3f973..6b7206f 100644
--- a/hbase-protocol-shaded/src/main/protobuf/MasterProcedure.proto
+++ b/hbase-protocol-shaded/src/main/protobuf/MasterProcedure.proto
@@ -262,38 +262,31 @@ message RestoreSnapshotStateData {
   repeated RestoreParentToChildRegionsPair parent_to_child_regions_pair_list = 7;
 }
 
-enum MergeTableRegionsState {
-  MERGE_TABLE_REGIONS_PREPARE = 1;
-  MERGE_TABLE_REGIONS_MOVE_REGION_TO_SAME_RS = 2;
-  MERGE_TABLE_REGIONS_PRE_MERGE_OPERATION = 3;
-  MERGE_TABLE_REGIONS_SET_MERGING_TABLE_STATE = 4;
-  MERGE_TABLE_REGIONS_CLOSE_REGIONS = 5;
-  MERGE_TABLE_REGIONS_CREATE_MERGED_REGION = 6;
-  MERGE_TABLE_REGIONS_PRE_MERGE_COMMIT_OPERATION = 7;
-  MERGE_TABLE_REGIONS_UPDATE_META = 8;
-  MERGE_TABLE_REGIONS_POST_MERGE_COMMIT_OPERATION = 9;
-  MERGE_TABLE_REGIONS_OPEN_MERGED_REGION = 10;
-  MERGE_TABLE_REGIONS_POST_OPERATION = 11;
+enum DispatchMergingRegionsState {
+  DISPATCH_MERGING_REGIONS_PREPARE = 1;
+  DISPATCH_MERGING_REGIONS_PRE_OPERATION = 2;
+  DISPATCH_MERGING_REGIONS_MOVE_REGION_TO_SAME_RS = 3;
+  DISPATCH_MERGING_REGIONS_DO_MERGE_IN_RS = 4;
+  DISPATCH_MERGING_REGIONS_POST_OPERATION = 5;
 }
 
-message MergeTableRegionsStateData {
+message DispatchMergingRegionsStateData {
   required UserInformation user_info = 1;
-  repeated RegionInfo region_info = 2;
-  required RegionInfo merged_region_info = 3;
-  optional bool forcible = 4 [default = false];
+  required TableName table_name = 2;
+  repeated RegionInfo region_info = 3;
+  optional bool forcible = 4;
 }
 
 enum SplitTableRegionState {
   SPLIT_TABLE_REGION_PREPARE = 1;
   SPLIT_TABLE_REGION_PRE_OPERATION = 2;
-  SPLIT_TABLE_REGION_SET_SPLITTING_TABLE_STATE = 3;
-  SPLIT_TABLE_REGION_CLOSE_PARENT_REGION = 4;
-  SPLIT_TABLE_REGION_CREATE_DAUGHTER_REGIONS = 5;
-  SPLIT_TABLE_REGION_PRE_OPERATION_BEFORE_PONR = 6;
-  SPLIT_TABLE_REGION_UPDATE_META = 7;
-  SPLIT_TABLE_REGION_PRE_OPERATION_AFTER_PONR = 8;
-  SPLIT_TABLE_REGION_OPEN_CHILD_REGIONS = 9;
-  SPLIT_TABLE_REGION_POST_OPERATION = 10;
+  SPLIT_TABLE_REGION_CLOSE_PARENT_REGION = 3;
+  SPLIT_TABLE_REGION_CREATE_DAUGHTER_REGIONS = 4;
+  SPLIT_TABLE_REGION_PRE_OPERATION_BEFORE_PONR = 5;
+  SPLIT_TABLE_REGION_UPDATE_META = 6;
+  SPLIT_TABLE_REGION_PRE_OPERATION_AFTER_PONR = 7;
+  SPLIT_TABLE_REGION_OPEN_CHILD_REGIONS = 8;
+  SPLIT_TABLE_REGION_POST_OPERATION = 9;
 }
 
 message SplitTableRegionStateData {
@@ -302,6 +295,29 @@ message SplitTableRegionStateData {
   repeated RegionInfo child_region_info = 3;
 }
 
+enum MergeTableRegionsState {
+  MERGE_TABLE_REGIONS_PREPARE = 1;
+  MERGE_TABLE_REGIONS_PRE_OPERATION = 2;
+  MERGE_TABLE_REGIONS_MOVE_REGION_TO_SAME_RS = 3;
+  MERGE_TABLE_REGIONS_PRE_MERGE_OPERATION = 4;
+  MERGE_TABLE_REGIONS_SET_MERGING_TABLE_STATE = 5;
+  MERGE_TABLE_REGIONS_CLOSE_REGIONS = 6;
+  MERGE_TABLE_REGIONS_CREATE_MERGED_REGION = 7;
+  MERGE_TABLE_REGIONS_PRE_MERGE_COMMIT_OPERATION = 8;
+  MERGE_TABLE_REGIONS_UPDATE_META = 9;
+  MERGE_TABLE_REGIONS_POST_MERGE_COMMIT_OPERATION = 10;
+  MERGE_TABLE_REGIONS_OPEN_MERGED_REGION = 11;
+  MERGE_TABLE_REGIONS_POST_OPERATION = 12;
+}
+
+message MergeTableRegionsStateData {
+  required UserInformation user_info = 1;
+  repeated RegionInfo region_info = 2;
+  optional RegionInfo merged_region_info = 3;
+  optional bool forcible = 4 [default = false];
+}
+
+
 message ServerCrashStateData {
   required ServerName server_name = 1;
   optional bool distributed_log_replay = 2;
@@ -323,3 +339,34 @@ enum ServerCrashState {
   SERVER_CRASH_WAIT_ON_ASSIGN = 9;
   SERVER_CRASH_FINISH = 100;
 }
+
+enum RegionTransitionState {
+  REGION_TRANSITION_QUEUE = 1;
+  REGION_TRANSITION_DISPATCH = 2;
+  REGION_TRANSITION_FINISH = 3;
+}
+
+message AssignRegionStateData {
+  required RegionTransitionState transition_state = 1;
+  required RegionInfo region_info = 2;
+  optional bool force_new_plan = 3 [default = false];
+  optional ServerName target_server = 4;
+}
+
+message UnassignRegionStateData {
+  required RegionTransitionState transition_state = 1;
+  required RegionInfo region_info = 2;
+  optional ServerName destination_server = 3;
+  optional bool force = 4 [default = false];
+}
+
+enum MoveRegionState {
+  MOVE_REGION_UNASSIGN = 1;
+  MOVE_REGION_ASSIGN = 2;
+}
+
+message MoveRegionStateData {
+  required RegionInfo region_info = 1;
+  required ServerName source_server = 2;
+  required ServerName destination_server = 3;
+}

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-protocol-shaded/src/main/protobuf/RegionServerStatus.proto
----------------------------------------------------------------------
diff --git a/hbase-protocol-shaded/src/main/protobuf/RegionServerStatus.proto b/hbase-protocol-shaded/src/main/protobuf/RegionServerStatus.proto
index 1c373ee..60cf77a 100644
--- a/hbase-protocol-shaded/src/main/protobuf/RegionServerStatus.proto
+++ b/hbase-protocol-shaded/src/main/protobuf/RegionServerStatus.proto
@@ -26,7 +26,6 @@ option java_generate_equals_and_hash = true;
 option optimize_for = SPEED;
 
 import "HBase.proto";
-import "Master.proto";
 import "ClusterStatus.proto";
 
 message RegionServerStartupRequest {
@@ -127,20 +126,6 @@ message ReportRegionStateTransitionResponse {
   optional string error_message = 1;
 }
 
-/**
- * Splits the specified region.
- */
-message SplitTableRegionRequest {
-  required RegionInfo region_info = 1;
-  required bytes split_row = 2;
-  optional uint64 nonce_group = 3 [default = 0];
-  optional uint64 nonce = 4 [default = 0];
-}
-
-message SplitTableRegionResponse {
-  optional uint64 proc_id = 1;
-}
-
 service RegionServerStatusService {
   /** Called when a region server first starts. */
   rpc RegionServerStartup(RegionServerStartupRequest)
@@ -170,16 +155,4 @@ service RegionServerStatusService {
    */
   rpc ReportRegionStateTransition(ReportRegionStateTransitionRequest)
     returns(ReportRegionStateTransitionResponse);
-
-  /**
-   * Split region
-   */
-  rpc SplitRegion(SplitTableRegionRequest)
-    returns(SplitTableRegionResponse);
-
-  /**
-   * Get procedure result
-   */
-  rpc getProcedureResult(GetProcedureResultRequest)
-    returns(GetProcedureResultResponse);
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java
----------------------------------------------------------------------
diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java
b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java
index 3c0cccf..05ed333 100644
--- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java
+++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java
@@ -37,7 +37,8 @@ import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.constraint.ConstraintException;
-import org.apache.hadoop.hbase.master.AssignmentManager;
+import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
+import org.apache.hadoop.hbase.master.assignment.RegionStates.RegionStateNode;
 import org.apache.hadoop.hbase.master.LoadBalancer;
 import org.apache.hadoop.hbase.master.MasterServices;
 import org.apache.hadoop.hbase.master.RegionPlan;
@@ -121,10 +122,9 @@ public class RSGroupAdminServer implements RSGroupAdmin {
         addRegion(regions, el.getKey());
       }
     }
-    for (RegionState state:
-        this.master.getAssignmentManager().getRegionStates().getRegionsInTransition()) {
-      if (state.getServerName().getAddress().equals(server)) {
-        addRegion(regions, state.getRegion());
+    for (RegionStateNode state : master.getAssignmentManager().getRegionsInTransition())
{
+      if (state.getRegionLocation().getAddress().equals(server)) {
+        addRegion(regions, state.getRegionInfo());
       }
     }
     return regions;
@@ -531,7 +531,7 @@ public class RSGroupAdminServer implements RSGroupAdmin {
         LOG.info("RSGroup balance " + groupName + " starting with plan count: " + plans.size());
         for (RegionPlan plan: plans) {
           LOG.info("balance " + plan);
-          assignmentManager.balance(plan);
+          assignmentManager.moveAsync(plan);
         }
         LOG.info("RSGroup balance " + groupName + " completed after " +
             (System.currentTimeMillis()-startTime) + " seconds");

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java
b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java
index 30efc0a..5cdfad2 100644
--- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java
+++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java
@@ -138,7 +138,7 @@ public class RSGroupBasedLoadBalancer implements RSGroupableBalancer {
             }
           }
         }
-        groupClusterLoad.put(TableName.valueOf(HConstants.ENSEMBLE_TABLE_NAME), groupClusterState);
+        groupClusterLoad.put(HConstants.ENSEMBLE_TABLE_NAME, groupClusterState);
         this.internalBalancer.setClusterLoad(groupClusterLoad);
         List<RegionPlan> groupPlans = this.internalBalancer
             .balanceCluster(groupClusterState);

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRSGroupBasedLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRSGroupBasedLoadBalancer.java
b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRSGroupBasedLoadBalancer.java
index 83fe122..0f1e849 100644
--- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRSGroupBasedLoadBalancer.java
+++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRSGroupBasedLoadBalancer.java
@@ -32,7 +32,7 @@ import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.rsgroup.RSGroupBasedLoadBalancer;
 import org.apache.hadoop.hbase.rsgroup.RSGroupInfo;
 import org.apache.hadoop.hbase.rsgroup.RSGroupInfoManager;
-import org.apache.hadoop.hbase.master.AssignmentManager;
+import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.master.MasterServices;
 import org.apache.hadoop.hbase.master.RegionPlan;

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon
b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon
index 76a85a9..b5e6dd0 100644
--- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon
+++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon
@@ -18,7 +18,9 @@ limitations under the License.
 </%doc>
 <%import>
 org.apache.hadoop.hbase.HRegionInfo;
-org.apache.hadoop.hbase.master.AssignmentManager;
+org.apache.hadoop.hbase.master.assignment.AssignmentManager;
+org.apache.hadoop.hbase.master.assignment.AssignmentManager.RegionInTransitionStat;
+org.apache.hadoop.hbase.master.assignment.RegionStates.RegionFailedOpen;
 org.apache.hadoop.hbase.master.RegionState;
 org.apache.hadoop.conf.Configuration;
 org.apache.hadoop.hbase.HBaseConfiguration;
@@ -35,28 +37,12 @@ int limit = 100;
 
 <%java SortedSet<RegionState> rit = assignmentManager
   .getRegionStates().getRegionsInTransitionOrderedByTimestamp();
-  Map<String, AtomicInteger> failedRegionTracker = assignmentManager.getFailedOpenTracker();
-   %>
+%>
 
 <%if !rit.isEmpty() %>
 <%java>
-HashSet<String> ritsOverThreshold = new HashSet<String>();
-HashSet<String> ritsTwiceThreshold = new HashSet<String>();
-// process the map to find region in transition details
-Configuration conf = HBaseConfiguration.create();
-int ritThreshold = conf.getInt(HConstants.METRICS_RIT_STUCK_WARNING_THRESHOLD, 60000);
-int numOfRITOverThreshold = 0;
 long currentTime = System.currentTimeMillis();
-for (RegionState rs : rit) {
-  long ritTime = currentTime - rs.getStamp();
-  if(ritTime > (ritThreshold * 2)) {
-     numOfRITOverThreshold++;
-     ritsTwiceThreshold.add(rs.getRegion().getEncodedName());
-  } else if (ritTime > ritThreshold) {
-     numOfRITOverThreshold++;
-     ritsOverThreshold.add(rs.getRegion().getEncodedName());
-  }
-}
+RegionInTransitionStat ritStat = assignmentManager.computeRegionInTransitionStat();
 
 int numOfRITs = rit.size();
 int ritsPerPage = Math.min(5, numOfRITs);
@@ -65,15 +51,15 @@ int numOfPages = (int) Math.ceil(numOfRITs * 1.0 / ritsPerPage);
     <section>
     <h2>Regions in Transition</h2>
      <p><% numOfRITs %> region(s) in transition.
-     <%if !ritsTwiceThreshold.isEmpty()  %>
+     <%if ritStat.hasRegionsTwiceOverThreshold()  %>
          <span class="label label-danger" style="font-size:100%;font-weight:normal">
-     <%elseif !ritsOverThreshold.isEmpty() %>
+     <%elseif ritStat.hasRegionsOverThreshold() %>
          <span class="label label-warning" style="font-size:100%;font-weight:normal">
      <%else>
          <span>
      </%if>
-         <% numOfRITOverThreshold %> region(s) in transition for
-             more than <% ritThreshold %> milliseconds.
+         <% ritStat.getTotalRITsOverThreshold() %> region(s) in transition for
+             more than <% ritStat.getRITThreshold() %> milliseconds.
          </span>
      </p>
      <div class="tabbable">
@@ -90,25 +76,26 @@ int numOfPages = (int) Math.ceil(numOfRITs * 1.0 / ritsPerPage);
                      <th>State</th><th>RIT time (ms)</th> <th>Retries
</th></tr>
              </%if>
 
-             <%if ritsOverThreshold.contains(rs.getRegion().getEncodedName()) %>
-                     <tr class="alert alert-warning" role="alert">
-             <%elseif ritsTwiceThreshold.contains(rs.getRegion().getEncodedName()) %>
+             <%if ritStat.isRegionTwiceOverThreshold(rs.getRegion()) %>
                      <tr class="alert alert-danger" role="alert">
+             <%elseif ritStat.isRegionOverThreshold(rs.getRegion()) %>
+                     <tr class="alert alert-warning" role="alert">
             <%else>
                     <tr>
             </%if>
                         <%java>
                           String retryStatus = "0";
-                          AtomicInteger numOpenRetries = failedRegionTracker.get(
-                              rs.getRegion().getEncodedName());
-                          if (numOpenRetries != null ) {
-                            retryStatus = Integer.toString(numOpenRetries.get());
+                          RegionFailedOpen regionFailedOpen = assignmentManager
+                            .getRegionStates().getFailedOpen(rs.getRegion());
+                          if (regionFailedOpen != null) {
+                            retryStatus = Integer.toString(regionFailedOpen.getRetries());
                           } else if (rs.getState() ==  RegionState.State.FAILED_OPEN) {
-                             retryStatus = "Failed";
+                            retryStatus = "Failed";
                           }
                         </%java>
                         <td><% rs.getRegion().getEncodedName() %></td><td>
-                        <% HRegionInfo.getDescriptiveNameFromRegionStateForDisplay(rs,
conf) %></td>
+                        <% HRegionInfo.getDescriptiveNameFromRegionStateForDisplay(rs,
+                            assignmentManager.getConfiguration()) %></td>
                         <td><% (currentTime - rs.getStamp()) %> </td>
                         <td> <% retryStatus %> </td>
                      </tr>

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
index 36d5112..0e76455 100644
--- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
+++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
@@ -41,7 +41,7 @@ org.apache.hadoop.hbase.TableName;
 org.apache.hadoop.hbase.client.Admin;
 org.apache.hadoop.hbase.client.MasterSwitchType;
 org.apache.hadoop.hbase.client.SnapshotDescription;
-org.apache.hadoop.hbase.master.AssignmentManager;
+org.apache.hadoop.hbase.master.assignment.AssignmentManager;
 org.apache.hadoop.hbase.master.DeadServer;
 org.apache.hadoop.hbase.master.HMaster;
 org.apache.hadoop.hbase.master.RegionState;

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/VersionInfoUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/VersionInfoUtil.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/VersionInfoUtil.java
index ed1ae31..4f134c0 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/VersionInfoUtil.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/VersionInfoUtil.java
@@ -35,9 +35,7 @@ public final class VersionInfoUtil {
   }
 
   public static boolean currentClientHasMinimumVersion(int major, int minor) {
-    RpcCallContext call = RpcServer.getCurrentCall();
-    HBaseProtos.VersionInfo versionInfo = call != null ? call.getClientVersionInfo() : null;
-    return hasMinimumVersion(versionInfo, major, minor);
+    return hasMinimumVersion(getCurrentClientVersionInfo(), major, minor);
   }
 
   public static boolean hasMinimumVersion(HBaseProtos.VersionInfo versionInfo,
@@ -53,7 +51,7 @@ public final class VersionInfoUtil {
         return clientMinor >= minor;
       }
       try {
-        String[] components = versionInfo.getVersion().split("\\.");
+        final String[] components = getVersionComponents(versionInfo);
 
         int clientMajor = components.length > 0 ? Integer.parseInt(components[0]) : 0;
         if (clientMajor != major) {
@@ -68,4 +66,79 @@ public final class VersionInfoUtil {
     }
     return false;
   }
+
+  /**
+   * @return the versionInfo extracted from the current RpcCallContext
+   */
+  private static HBaseProtos.VersionInfo getCurrentClientVersionInfo() {
+    RpcCallContext call = RpcServer.getCurrentCall();
+    return call != null ? call.getClientVersionInfo() : null;
+  }
+
+  /**
+   * @return the version number extracted from the current RpcCallContext as int.
+   *         (e.g. 0x0103004 is 1.3.4)
+   */
+  public static int getCurrentClientVersionNumber() {
+    return getVersionNumber(getCurrentClientVersionInfo());
+  }
+
+
+  /**
+   * @param version
+   * @return the passed-in <code>version</code> int as a version String
+   *         (e.g. 0x0103004 is 1.3.4)
+   */
+  public static String versionNumberToString(final int version) {
+    return String.format("%d.%d.%d",
+        ((version >> 20) & 0xff),
+        ((version >> 12) & 0xff),
+        (version & 0xfff));
+  }
+
+  /**
+   * Pack the full number version in a int. by shifting each component by 8bit,
+   * except the dot release which has 12bit.
+   * Examples: (1.3.4 is 0x0103004, 2.1.0 is 0x0201000)
+   * @param versionInfo the VersionInfo object to pack
+   * @return the version number as int. (e.g. 0x0103004 is 1.3.4)
+   */
+  private static int getVersionNumber(final HBaseProtos.VersionInfo versionInfo) {
+    if (versionInfo != null) {
+      try {
+        final String[] components = getVersionComponents(versionInfo);
+        int clientMajor = components.length > 0 ? Integer.parseInt(components[0]) : 0;
+        int clientMinor = components.length > 1 ? Integer.parseInt(components[1]) : 0;
+        int clientPatch = components.length > 2 ? Integer.parseInt(components[2]) : 0;
+        return buildVersionNumber(clientMajor, clientMinor, clientPatch);
+      } catch (NumberFormatException e) {
+        int clientMajor = versionInfo.hasVersionMajor() ? versionInfo.getVersionMajor() :
0;
+        int clientMinor = versionInfo.hasVersionMinor() ? versionInfo.getVersionMinor() :
0;
+        return buildVersionNumber(clientMajor, clientMinor, 0);
+      }
+    }
+    return(0); // no version
+  }
+
+  /**
+   * Pack the full number version in a int. by shifting each component by 8bit,
+   * except the dot release which has 12bit.
+   * Examples: (1.3.4 is 0x0103004, 2.1.0 is 0x0201000)
+   * @param major version major number
+   * @param minor version minor number
+   * @param patch version patch number
+   * @return the version number as int. (e.g. 0x0103004 is 1.3.4)
+   */
+  private static int buildVersionNumber(int major, int minor, int patch) {
+    return (major << 20) | (minor << 12) | patch;
+  }
+
+  /**
+   * Returns the version components
+   * Examples: "1.2.3" returns [1, 2, 3], "4.5.6-SNAPSHOT" returns [4, 5, 6, "SNAPSHOT"]
+   * @returns the components of the version string
+   */
+  private static String[] getVersionComponents(final HBaseProtos.VersionInfo versionInfo)
{
+    return versionInfo.getVersion().split("[\\.-]");
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/BalancedQueueRpcExecutor.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/BalancedQueueRpcExecutor.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/BalancedQueueRpcExecutor.java
index f792b36..558c9c2 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/BalancedQueueRpcExecutor.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/BalancedQueueRpcExecutor.java
@@ -17,11 +17,8 @@
  */
 package org.apache.hadoop.hbase.ipc;
 
-import java.util.List;
 import java.util.concurrent.BlockingQueue;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Abortable;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FastPathBalancedQueueRpcExecutor.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FastPathBalancedQueueRpcExecutor.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FastPathBalancedQueueRpcExecutor.java
index ab16627..b3df28a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FastPathBalancedQueueRpcExecutor.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FastPathBalancedQueueRpcExecutor.java
@@ -120,4 +120,4 @@ public class FastPathBalancedQueueRpcExecutor extends BalancedQueueRpcExecutor
{
       return true;
     }
   }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java
index d51d83b..2ee2d7e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java
@@ -17,8 +17,6 @@
  */
 package org.apache.hadoop.hbase.ipc;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Abortable;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
@@ -37,8 +35,6 @@ import org.apache.hadoop.hbase.conf.ConfigurationObserver;
 @InterfaceAudience.LimitedPrivate({HBaseInterfaceAudience.COPROC, HBaseInterfaceAudience.PHOENIX})
 @InterfaceStability.Evolving
 public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObserver {
-  private static final Log LOG = LogFactory.getLog(SimpleRpcScheduler.class);
-
   private int port;
   private final PriorityFunction priority;
   private final RpcExecutor callExecutor;
@@ -82,14 +78,14 @@ public class SimpleRpcScheduler extends RpcScheduler implements ConfigurationObs
 
     if (callqReadShare > 0) {
       // at least 1 read handler and 1 write handler
-      callExecutor = new RWQueueRpcExecutor("deafult.RWQ", Math.max(2, handlerCount),
+      callExecutor = new RWQueueRpcExecutor("default.RWQ", Math.max(2, handlerCount),
         maxQueueLength, priority, conf, server);
     } else {
       if (RpcExecutor.isFifoQueueType(callQueueType) || RpcExecutor.isCodelQueueType(callQueueType))
{
-        callExecutor = new FastPathBalancedQueueRpcExecutor("deafult.FPBQ", handlerCount,
+        callExecutor = new FastPathBalancedQueueRpcExecutor("default.FPBQ", handlerCount,
             maxQueueLength, priority, conf, server);
       } else {
-        callExecutor = new BalancedQueueRpcExecutor("deafult.BQ", handlerCount, maxQueueLength,
+        callExecutor = new BalancedQueueRpcExecutor("default.BQ", handlerCount, maxQueueLength,
             priority, conf, server);
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServer.java
index 5f90d50..c409f6e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServer.java
@@ -1980,8 +1980,8 @@ public class SimpleRpcServer extends RpcServer {
           if (!running) {
             return;
           }
-          if (LOG.isDebugEnabled()) {
-            LOG.debug(Thread.currentThread().getName()+": task running");
+          if (LOG.isTraceEnabled()) {
+            LOG.trace("running");
           }
           try {
             closeIdle(false);

http://git-wip-us.apache.org/repos/asf/hbase/blob/8faab93a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignCallable.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignCallable.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignCallable.java
deleted file mode 100644
index 4513a5d..0000000
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignCallable.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.master;
-
-import java.util.concurrent.Callable;
-
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
-import org.apache.hadoop.hbase.HRegionInfo;
-
-/**
- * A callable object that invokes the corresponding action that needs to be
- * taken for assignment of a region in transition. 
- * Implementing as future callable we are able to act on the timeout
- * asynchronously.
- */
-@InterfaceAudience.Private
-public class AssignCallable implements Callable<Object> {
-  private AssignmentManager assignmentManager;
-
-  private HRegionInfo hri;
-
-  public AssignCallable(
-      AssignmentManager assignmentManager, HRegionInfo hri) {
-    this.assignmentManager = assignmentManager;
-    this.hri = hri;
-  }
-
-  @Override
-  public Object call() throws Exception {
-    assignmentManager.assign(hri);
-    return null;
-  }
-}


Mime
View raw message