This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch HBASE-22514 in repository https://gitbox.apache.org/repos/asf/hbase.git
commit 355e7b20ba021ae759ab16b21b076c36322d3342 Author: Guanghao Zhang <zg...@apache.org> AuthorDate: Tue Sep 3 11:39:19 2019 +0800 HBASE-22729 Start RSGroupInfoManager as default (#555) Amending-Author: Duo Zhang <zhang...@apache.org> Signed-off-by: stack <st...@apache.org> --- .../src/main/java/org/apache/hadoop/hbase/master/HMaster.java | 10 ++++++++++ .../java/org/apache/hadoop/hbase/master/MasterServices.java | 7 +++++-- .../org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java | 2 +- .../org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.java | 5 +++++ .../org/apache/hadoop/hbase/master/MockNoopMasterServices.java | 6 ++++++ 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index dc12a8f..760c31b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -186,6 +186,7 @@ import org.apache.hadoop.hbase.replication.master.ReplicationHFileCleaner; import org.apache.hadoop.hbase.replication.master.ReplicationLogCleaner; import org.apache.hadoop.hbase.replication.master.ReplicationPeerConfigUpgrader; import org.apache.hadoop.hbase.replication.regionserver.ReplicationStatus; +import org.apache.hadoop.hbase.rsgroup.RSGroupInfoManager; import org.apache.hadoop.hbase.security.AccessDeniedException; import org.apache.hadoop.hbase.security.SecurityConstants; import org.apache.hadoop.hbase.security.UserProvider; @@ -353,6 +354,8 @@ public class HMaster extends HRegionServer implements MasterServices { // manager of assignment nodes in zookeeper private AssignmentManager assignmentManager; + private RSGroupInfoManager rsGroupInfoManager; + // manager of replication private ReplicationPeerManager replicationPeerManager; @@ -775,6 +778,8 @@ public class HMaster extends HRegionServer implements MasterServices { this.splitOrMergeTracker = new SplitOrMergeTracker(zooKeeper, conf, this); this.splitOrMergeTracker.start(); + this.rsGroupInfoManager = RSGroupInfoManager.create(this); + this.replicationPeerManager = ReplicationPeerManager.create(zooKeeper, conf); this.drainingServerTracker = new DrainingServerTracker(zooKeeper, this, this.serverManager); @@ -3788,4 +3793,9 @@ public class HMaster extends HRegionServer implements MasterServices { public HbckChore getHbckChore() { return this.hbckChore; } + + @Override + public RSGroupInfoManager getRSRSGroupInfoManager() { + return rsGroupInfoManager; + } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java index 41cec5c..ead40b9 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java @@ -18,10 +18,8 @@ package org.apache.hadoop.hbase.master; import com.google.protobuf.Service; - import java.io.IOException; import java.util.List; - import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableDescriptors; @@ -51,6 +49,7 @@ import org.apache.hadoop.hbase.replication.ReplicationException; import org.apache.hadoop.hbase.replication.ReplicationPeerConfig; import org.apache.hadoop.hbase.replication.ReplicationPeerDescription; import org.apache.hadoop.hbase.replication.SyncReplicationState; +import org.apache.hadoop.hbase.rsgroup.RSGroupInfoManager; import org.apache.hadoop.hbase.security.access.AccessChecker; import org.apache.hadoop.hbase.security.access.ZKPermissionWatcher; import org.apache.yetus.audience.InterfaceAudience; @@ -537,4 +536,8 @@ public interface MasterServices extends Server { */ List<RegionPlan> executeRegionPlansWithThrottling(List<RegionPlan> plans); + /** + * @return the {@link RSGroupInfoManager} + */ + RSGroupInfoManager getRSRSGroupInfoManager(); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java index a2a5623..0bde67b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java @@ -66,7 +66,7 @@ public class RSGroupAdminEndpoint implements MasterCoprocessor, MasterObserver { } master = ((HasMasterServices) env).getMasterServices(); - groupInfoManager = RSGroupInfoManagerImpl.getInstance(master); + groupInfoManager = master.getRSRSGroupInfoManager(); groupAdminServer = new RSGroupAdminServer(master, groupInfoManager); Class<?> clazz = master.getConfiguration().getClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, null); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.java index 1b9f3ef..a46fa4b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.util.List; import java.util.Set; import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.master.MasterServices; import org.apache.hadoop.hbase.net.Address; import org.apache.yetus.audience.InterfaceAudience; @@ -87,4 +88,8 @@ public interface RSGroupInfoManager { */ @Deprecated RSGroupInfo getRSGroupForTable(TableName tableName) throws IOException; + + static RSGroupInfoManager create(MasterServices master) throws IOException { + return RSGroupInfoManagerImpl.getInstance(master); + } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java index cbfdd3f..26772ae 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockNoopMasterServices.java @@ -54,6 +54,7 @@ import org.apache.hadoop.hbase.replication.ReplicationException; import org.apache.hadoop.hbase.replication.ReplicationPeerConfig; import org.apache.hadoop.hbase.replication.ReplicationPeerDescription; import org.apache.hadoop.hbase.replication.SyncReplicationState; +import org.apache.hadoop.hbase.rsgroup.RSGroupInfoManager; import org.apache.hadoop.hbase.security.access.AccessChecker; import org.apache.hadoop.hbase.security.access.ZKPermissionWatcher; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; @@ -490,4 +491,9 @@ public class MockNoopMasterServices implements MasterServices { public AsyncClusterConnection getAsyncClusterConnection() { return null; } + + @Override + public RSGroupInfoManager getRSRSGroupInfoManager() { + return null; + } } \ No newline at end of file