Revert "HBASE-15128 Disable region splits and merges switch in master"
This reverts commit 24d481c5803e69a6190339cd8bb218b2c4585459. Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/bf4fcc30 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/bf4fcc30 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/bf4fcc30 Branch: refs/heads/hbase-12439 Commit: bf4fcc30c62395e8db9fe52fde07c752f9e00e54 Parents: 24d481c Author: chenheng <chenh...@apache.org> Authored: Fri Feb 26 08:52:12 2016 +0800 Committer: chenheng <chenh...@apache.org> Committed: Fri Feb 26 08:52:12 2016 +0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/client/Admin.java | 27 +- .../hbase/client/ConnectionImplementation.java | 14 - .../apache/hadoop/hbase/client/HBaseAdmin.java | 31 - .../hadoop/hbase/protobuf/RequestConverter.java | 49 - .../hbase/zookeeper/ZooKeeperWatcher.java | 10 - .../hbase/protobuf/generated/MasterProtos.java | 4304 ++++-------------- .../protobuf/generated/SnapshotProtos.java | 500 +- .../protobuf/generated/ZooKeeperProtos.java | 462 +- hbase-protocol/src/main/protobuf/Master.proto | 36 - .../src/main/protobuf/ZooKeeper.proto | 7 - .../hadoop/hbase/master/AssignmentManager.java | 10 - .../org/apache/hadoop/hbase/master/HMaster.java | 28 - .../hadoop/hbase/master/MasterRpcServices.java | 42 - .../org/apache/hadoop/hbase/util/HBaseFsck.java | 35 - .../zookeeper/SplitOrMergeTrackerManager.java | 151 - .../hbase/client/TestSplitOrMergeStatus.java | 198 - hbase-shell/src/main/ruby/hbase/admin.rb | 32 - hbase-shell/src/main/ruby/shell.rb | 2 - .../ruby/shell/commands/splitormerge_enabled.rb | 41 - .../ruby/shell/commands/splitormerge_switch.rb | 43 - 20 files changed, 1200 insertions(+), 4822 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/bf4fcc30/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java index c3b524b..d7b52d5 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java @@ -1678,28 +1678,11 @@ public interface Admin extends Abortable, Closeable { List<SecurityCapability> getSecurityCapabilities() throws IOException; /** - * Turn the Split or Merge switches on or off. - * - * @param enabled enabled or not - * @param synchronous If true, it waits until current split() call, if outstanding, to return. - * @param switchTypes switchType list {@link MasterSwitchType} - * @return Previous switch value array - */ - boolean[] setSplitOrMergeEnabled(final boolean enabled, final boolean synchronous, - final MasterSwitchType... switchTypes) throws IOException; - - /** - * Query the current state of the switch - * - * @return true if the switch is enabled, false otherwise. - */ - boolean isSplitOrMergeEnabled(final MasterSwitchType switchType) throws IOException; - - /** * Currently, there are only two compact types: * {@code NORMAL} means do store files compaction; * {@code MOB} means do mob files compaction. * */ + @InterfaceAudience.Public @InterfaceStability.Unstable public enum CompactType { @@ -1709,12 +1692,4 @@ public interface Admin extends Abortable, Closeable { CompactType(int value) {} } - - @InterfaceAudience.Public - @InterfaceStability.Evolving - public enum MasterSwitchType { - SPLIT, - MERGE - } - } http://git-wip-us.apache.org/repos/asf/hbase/blob/bf4fcc30/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java index 64eb9fb..dfa9937 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java @@ -1742,20 +1742,6 @@ class ConnectionImplementation implements ClusterConnection, Closeable { } @Override - public MasterProtos.SetSplitOrMergeEnabledResponse setSplitOrMergeEnabled( - RpcController controller, MasterProtos.SetSplitOrMergeEnabledRequest request) - throws ServiceException { - return stub.setSplitOrMergeEnabled(controller, request); - } - - @Override - public MasterProtos.IsSplitOrMergeEnabledResponse isSplitOrMergeEnabled( - RpcController controller, MasterProtos.IsSplitOrMergeEnabledRequest request) - throws ServiceException { - return stub.isSplitOrMergeEnabled(controller, request); - } - - @Override public IsNormalizerEnabledResponse isNormalizerEnabled(RpcController controller, IsNormalizerEnabledRequest request) throws ServiceException { return stub.isNormalizerEnabled(controller, request); http://git-wip-us.apache.org/repos/asf/hbase/blob/bf4fcc30/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 c2a0bb8..db94ff4 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 @@ -89,7 +89,6 @@ import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ProcedureDescripti import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier.RegionSpecifierType; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.TableSchema; -import org.apache.hadoop.hbase.protobuf.generated.MasterProtos; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.AbortProcedureRequest; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.AbortProcedureResponse; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.AddColumnRequest; @@ -3379,36 +3378,6 @@ public class HBaseAdmin implements Admin { } } - @Override - public boolean[] setSplitOrMergeEnabled(final boolean enabled, final boolean synchronous, - final MasterSwitchType... switchTypes) - throws IOException { - return executeCallable(new MasterCallable<boolean[]>(getConnection()) { - @Override - public boolean[] call(int callTimeout) throws ServiceException { - MasterProtos.SetSplitOrMergeEnabledResponse response = master.setSplitOrMergeEnabled(null, - RequestConverter.buildSetSplitOrMergeEnabledRequest(enabled, synchronous, switchTypes)); - boolean[] result = new boolean[switchTypes.length]; - int i = 0; - for (Boolean prevValue : response.getPrevValueList()) { - result[i++] = prevValue; - } - return result; - } - }); - } - - @Override - public boolean isSplitOrMergeEnabled(final MasterSwitchType switchType) throws IOException { - return executeCallable(new MasterCallable<Boolean>(getConnection()) { - @Override - public Boolean call(int callTimeout) throws ServiceException { - return master.isSplitOrMergeEnabled(null, - RequestConverter.buildIsSplitOrMergeEnabledRequest(switchType)).getEnabled(); - } - }); - } - private HRegionInfo getMobRegionInfo(TableName tableName) { return new HRegionInfo(tableName, Bytes.toBytes(".mob"), HConstants.EMPTY_END_ROW, false, 0); http://git-wip-us.apache.org/repos/asf/hbase/blob/bf4fcc30/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 99e993d..572d92c 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 @@ -31,7 +31,6 @@ import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.client.Action; -import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Append; import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.client.Durability; @@ -77,7 +76,6 @@ import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.CompareType; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier.RegionSpecifierType; -import org.apache.hadoop.hbase.protobuf.generated.MasterProtos; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.AddColumnRequest; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.AssignRegionRequest; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.BalanceRequest; @@ -97,7 +95,6 @@ import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsBalancerEnabled 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.IsNormalizerEnabledRequest; -import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.IsSplitOrMergeEnabledRequest; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.ModifyColumnRequest; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.ModifyTableRequest; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.MoveRegionRequest; @@ -106,7 +103,6 @@ import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.OfflineRegionRequ import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.RunCatalogScanRequest; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.SetBalancerRunningRequest; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.SetNormalizerRunningRequest; -import org.apache.hadoop.hbase.protobuf.generated.MasterProtos.SetSplitOrMergeEnabledRequest; 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; @@ -1696,49 +1692,4 @@ public final class RequestConverter { public static SetNormalizerRunningRequest buildSetNormalizerRunningRequest(boolean on) { return SetNormalizerRunningRequest.newBuilder().setOn(on).build(); } - - /** - * Creates a protocol buffer IsSplitOrMergeEnabledRequest - * - * @param switchType see {@link org.apache.hadoop.hbase.client.Admin.MasterSwitchType} - * @return a IsSplitOrMergeEnabledRequest - */ - public static IsSplitOrMergeEnabledRequest buildIsSplitOrMergeEnabledRequest( - Admin.MasterSwitchType switchType) { - IsSplitOrMergeEnabledRequest.Builder builder = IsSplitOrMergeEnabledRequest.newBuilder(); - builder.setSwitchType(convert(switchType)); - return builder.build(); - } - - /** - * Creates a protocol buffer SetSplitOrMergeEnabledRequest - * - * @param enabled switch is enabled or not - * @param synchronous set switch sync? - * @param switchTypes see {@link org.apache.hadoop.hbase.client.Admin.MasterSwitchType}, it is - * a list. - * @return a SetSplitOrMergeEnabledRequest - */ - public static SetSplitOrMergeEnabledRequest buildSetSplitOrMergeEnabledRequest(boolean enabled, - boolean synchronous, Admin.MasterSwitchType... switchTypes) { - SetSplitOrMergeEnabledRequest.Builder builder = SetSplitOrMergeEnabledRequest.newBuilder(); - builder.setEnabled(enabled); - builder.setSynchronous(synchronous); - for (Admin.MasterSwitchType switchType : switchTypes) { - builder.addSwitchTypes(convert(switchType)); - } - return builder.build(); - } - - private static MasterProtos.MasterSwitchType convert(Admin.MasterSwitchType switchType) { - switch (switchType) { - case SPLIT: - return MasterProtos.MasterSwitchType.SPLIT; - case MERGE: - return MasterProtos.MasterSwitchType.MERGE; - default: - break; - } - throw new UnsupportedOperationException("Unsupport switch type:" + switchType); - } } http://git-wip-us.apache.org/repos/asf/hbase/blob/bf4fcc30/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java index b665353..36a9bc5 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java @@ -115,8 +115,6 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable { public String balancerZNode; // znode containing the state of region normalizer private String regionNormalizerZNode; - // znode containing the state of all switches, currently there are split and merge child node. - private String switchZNode; // znode containing the lock for the tables public String tableLockZNode; // znode containing the state of recovering regions @@ -432,7 +430,6 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable { conf.get("zookeeper.znode.balancer", "balancer")); regionNormalizerZNode = ZKUtil.joinZNode(baseZNode, conf.get("zookeeper.znode.regionNormalizer", "normalizer")); - switchZNode = ZKUtil.joinZNode(baseZNode, conf.get("zookeeper.znode.switch", "switch")); tableLockZNode = ZKUtil.joinZNode(baseZNode, conf.get("zookeeper.znode.tableLock", "table-lock")); recoveringRegionsZNode = ZKUtil.joinZNode(baseZNode, @@ -792,11 +789,4 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable { public String getRegionNormalizerZNode() { return regionNormalizerZNode; } - - /** - * @return ZK node for switch - * */ - public String getSwitchZNode() { - return switchZNode; - } }