hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [3/3] hbase git commit: HBASE-13610 Backport HBASE-13222 (Provide means of non-destructive balancer inspection) to 0.98
Date Mon, 04 May 2015 00:28:05 GMT
HBASE-13610 Backport HBASE-13222 (Provide means of non-destructive balancer inspection) to
0.98


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ca6e942e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ca6e942e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ca6e942e

Branch: refs/heads/0.98
Commit: ca6e942e56b78b78aae3fcdfd4ff2de294a1b916
Parents: f2bfe84
Author: Andrew Purtell <apurtell@apache.org>
Authored: Sun May 3 17:26:32 2015 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Sun May 3 17:26:32 2015 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/client/HBaseAdmin.java  |   17 +
 .../hadoop/hbase/client/HConnectionManager.java |    8 +
 .../hadoop/hbase/protobuf/RequestConverter.java |   12 +-
 .../hbase/protobuf/generated/MasterProtos.java  | 1511 ++++++++++++++----
 hbase-protocol/src/main/protobuf/Master.proto   |   13 +
 .../hbase/tmpl/master/MasterStatusTmpl.jamon    |   12 +
 .../org/apache/hadoop/hbase/master/HMaster.java |   39 +-
 .../master/balancer/LoadBalancerFactory.java    |   14 +-
 .../apache/hadoop/hbase/client/TestAdmin2.java  |   23 +
 hbase-shell/src/main/ruby/hbase/admin.rb        |    7 +
 hbase-shell/src/main/ruby/shell.rb              |    1 +
 .../ruby/shell/commands/balancer_enabled.rb     |   41 +
 12 files changed, 1374 insertions(+), 324 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ca6e942e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
index 8be31c9..8397132 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
@@ -1853,6 +1853,23 @@ public class HBaseAdmin implements Abortable, Closeable {
   }
 
   /**
+   * Query the state of the balancer from the Master. It's not a guarantee that the balancer
is
+   * actually running this very moment, but that it will run.
+   *
+   * @return True if the balancer is enabled, false otherwise.
+   */
+  public boolean isBalancerEnabled()
+      throws ServiceException, MasterNotRunningException {
+    MasterKeepAliveConnection stub = connection.getKeepAliveMasterService();
+    try {
+      return stub.isBalancerEnabled(null, RequestConverter.buildIsBalancerEnabledRequest())
+        .getEnabled();
+    } finally {
+      stub.close();
+    }
+  }
+
+  /**
    * Enable/Disable the catalog janitor
    * @param enable if true enables the catalog janitor
    * @return the previous state

http://git-wip-us.apache.org/repos/asf/hbase/blob/ca6e942e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
index e66175b..a0e9996 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
@@ -119,6 +119,8 @@ import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetTableDescripto
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetTableDescriptorsResponse;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetTableNamesRequest;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetTableNamesResponse;
+import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsBalancerEnabledRequest;
+import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsBalancerEnabledResponse;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsCatalogJanitorEnabledRequest;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsCatalogJanitorEnabledResponse;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsMasterRunningRequest;
@@ -2043,6 +2045,12 @@ public class HConnectionManager {
         }
 
         @Override
+        public IsBalancerEnabledResponse isBalancerEnabled(RpcController controller,
+            IsBalancerEnabledRequest request) throws ServiceException {
+          return stub.isBalancerEnabled(controller, request);
+        }
+
+        @Override
         public RunCatalogScanResponse runCatalogScan(RpcController controller,
             RunCatalogScanRequest request) throws ServiceException {
           return stub.runCatalogScan(controller, request);

http://git-wip-us.apache.org/repos/asf/hbase/blob/ca6e942e/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java
index f5c128b..d14c2fd 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.hadoop.hbase.util.ByteStringer;
-
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.CellScannable;
 import org.apache.hadoop.hbase.DoNotRetryIOException;
@@ -90,6 +89,7 @@ import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.EnableTableReques
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetClusterStatusRequest;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetSchemaAlterStatusRequest;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetTableDescriptorsRequest;
+import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsBalancerEnabledRequest;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsCatalogJanitorEnabledRequest;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsMasterRunningRequest;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.ModifyColumnRequest;
@@ -101,7 +101,6 @@ import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.SetBalancerRunnin
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.TruncateTableRequest;
 import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.UnassignRegionRequest;
 import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.GetLastFlushedSequenceIdRequest;
-import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.Triple;
@@ -1289,6 +1288,15 @@ public final class RequestConverter {
   }
 
   /**
+   * Creates a protocol buffer IsBalancerEnabledRequest
+   *
+   * @return a IsBalancerEnabledRequest
+   */
+  public static IsBalancerEnabledRequest buildIsBalancerEnabledRequest() {
+    return IsBalancerEnabledRequest.newBuilder().build();
+  }
+
+  /**
    * @see {@link #buildGetClusterStatusRequest}
    */
   private static final GetClusterStatusRequest GET_CLUSTER_STATUS_REQUEST =


Mime
View raw message