From ea1375d6be0afad03d8bfa484fa51c6b8d5ae074 Mon Sep 17 00:00:00 2001 From: WenFeiYi Date: Thu, 12 Nov 2020 22:13:24 +0800 Subject: [PATCH] HBASE-25253 Deprecated master carrys regions related methods and configs (#2635) Signed-off-by: Duo Zhang --- .../org/apache/hadoop/hbase/ZNodeClearer.java | 4 +++- .../hadoop/hbase/master/LoadBalancer.java | 21 +++++++++++++++++++ .../master/balancer/BaseLoadBalancer.java | 19 +++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java index 697706507bf..1cde2fa2484 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java @@ -146,9 +146,11 @@ public final class ZNodeClearer { } /** - * * @return true if cluster is configured with master-rs collocation + * @deprecated since 2.4.0, will be removed in 3.0.0. + * @see HBASE-15549 */ + @Deprecated private static boolean tablesOnMaster(Configuration conf) { boolean tablesOnMaster = true; String confValue = conf.get(BaseLoadBalancer.TABLES_ON_MASTER); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java index daa4083df98..752f67b4dfc 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java @@ -53,12 +53,20 @@ public interface LoadBalancer extends Configurable, Stoppable, ConfigurationObse * Master can carry regions as of hbase-2.0.0. * By default, it carries no tables. * TODO: Add any | system as flags to indicate what it can do. + * + * @deprecated since 2.4.0, will be removed in 3.0.0. + * @see HBASE-15549 */ + @Deprecated String TABLES_ON_MASTER = "hbase.balancer.tablesOnMaster"; /** * Master carries system tables. + * + * @deprecated since 2.4.0, will be removed in 3.0.0. + * @see HBASE-15549 */ + @Deprecated String SYSTEM_TABLES_ON_MASTER = "hbase.balancer.tablesOnMaster.systemTablesOnly"; // Used to signal to the caller that the region(s) cannot be assigned @@ -163,15 +171,28 @@ public interface LoadBalancer extends Configurable, Stoppable, ConfigurationObse /** * @return true if Master carries regions + * @deprecated since 2.4.0, will be removed in 3.0.0. + * @see HBASE-15549 */ + @Deprecated static boolean isTablesOnMaster(Configuration conf) { return conf.getBoolean(TABLES_ON_MASTER, false); } + /** + * @deprecated since 2.4.0, will be removed in 3.0.0. + * @see HBASE-15549 + */ + @Deprecated static boolean isSystemTablesOnlyOnMaster(Configuration conf) { return conf.getBoolean(SYSTEM_TABLES_ON_MASTER, false); } + /** + * @deprecated since 2.4.0, will be removed in 3.0.0. + * @see HBASE-15549 + */ + @Deprecated static boolean isMasterCanHostUserRegions(Configuration conf) { return isTablesOnMaster(conf) && !isSystemTablesOnlyOnMaster(conf); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java index 1de6a241c02..ba655d0763c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java @@ -1041,7 +1041,14 @@ public abstract class BaseLoadBalancer implements LoadBalancer { protected ClusterMetrics clusterStatus = null; protected ServerName masterServerName; protected MasterServices services; + + /** + * @deprecated since 2.4.0, will be removed in 3.0.0. + * @see HBASE-15549 + */ + @Deprecated protected boolean onlySystemTablesOnMaster; + protected boolean maintenanceMode; @Override @@ -1074,7 +1081,11 @@ public abstract class BaseLoadBalancer implements LoadBalancer { /** * Check if a region belongs to some system table. * If so, the primary replica may be expected to be put on the master regionserver. + * + * @deprecated since 2.4.0, will be removed in 3.0.0. + * @see HBASE-15549 */ + @Deprecated public boolean shouldBeOnMaster(RegionInfo region) { return (this.maintenanceMode || this.onlySystemTablesOnMaster) && region.getTable().isSystemTable(); @@ -1082,7 +1093,11 @@ public abstract class BaseLoadBalancer implements LoadBalancer { /** * Balance the regions that should be on master regionserver. + * + * @deprecated since 2.4.0, will be removed in 3.0.0. + * @see HBASE-15549 */ + @Deprecated protected List balanceMasterRegions(Map> clusterMap) { if (masterServerName == null || clusterMap == null || clusterMap.size() <= 1) return null; List plans = null; @@ -1131,7 +1146,11 @@ public abstract class BaseLoadBalancer implements LoadBalancer { /** * If master is configured to carry system tables only, in here is * where we figure what to assign it. + * + * @deprecated since 2.4.0, will be removed in 3.0.0. + * @see HBASE-15549 */ + @Deprecated @NonNull protected Map> assignMasterSystemRegions( Collection regions, List servers) {