From 03c3650cd5d57aa9144415976206494fc94582ac Mon Sep 17 00:00:00 2001 From: Bryan Beaudreault Date: Sat, 5 Feb 2022 14:06:16 -0500 Subject: [PATCH] Propagate config changes if balancer is a ConfigurationObserver --- .../hbase/ipc/BalancedQueueRpcExecutor.java | 10 ++++++++++ .../hadoop/hbase/ipc/RWQueueRpcExecutor.java | 15 +++++++++++++++ 2 files changed, 25 insertions(+) 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 cf4c35d7ae1a..ad1747ba3b1f 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 @@ -21,6 +21,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.Abortable; import org.apache.hadoop.hbase.HBaseInterfaceAudience; +import org.apache.hadoop.hbase.conf.ConfigurationObserver; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; @@ -60,4 +61,13 @@ public boolean dispatch(final CallRunner callTask) throws InterruptedException { } return queue.offer(callTask); } + + @Override + public void onConfigurationChange(Configuration conf) { + super.onConfigurationChange(conf); + + if (balancer instanceof ConfigurationObserver) { + ((ConfigurationObserver) balancer).onConfigurationChange(conf); + } + } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java index 450ac29b6a84..b2df2254130a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RWQueueRpcExecutor.java @@ -25,6 +25,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.Abortable; import org.apache.hadoop.hbase.HBaseInterfaceAudience; +import org.apache.hadoop.hbase.conf.ConfigurationObserver; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; import org.slf4j.Logger; @@ -280,4 +281,18 @@ private static int calcNumWriters(final int count, final float readShare) { private static int calcNumReaders(final int count, final float readShare) { return count - calcNumWriters(count, readShare); } + + @Override + public void onConfigurationChange(Configuration conf) { + super.onConfigurationChange(conf); + propagateBalancerConfigChange(writeBalancer, conf); + propagateBalancerConfigChange(readBalancer, conf); + propagateBalancerConfigChange(scanBalancer, conf); + } + + private void propagateBalancerConfigChange(QueueBalancer balancer, Configuration conf) { + if (balancer instanceof ConfigurationObserver) { + ((ConfigurationObserver) balancer).onConfigurationChange(conf); + } + } }