Re: [PR] Address comments in HBASE-29081 [hbase]
anmolnar merged PR #8115: URL: https://github.com/apache/hbase/pull/8115 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Address comments in HBASE-29081 [hbase]
anmolnar commented on code in PR #8115:
URL: https://github.com/apache/hbase/pull/8115#discussion_r3140963016
##
hbase-server/src/main/java/org/apache/hadoop/hbase/util/CoprocessorConfigurationUtil.java:
##
@@ -45,13 +47,14 @@
public final class CoprocessorConfigurationUtil {
private static final Logger LOG =
LoggerFactory.getLogger(CoprocessorConfigurationUtil.class);
- public static List MASTER_READONLY_CONTROLLER_COPROCESSORS =
-List.of(MasterReadOnlyController.class.getName());
- public static List REGIONSERVER_READONLY_CONTROLLER_COPROCESSORS =
-List.of(RegionServerReadOnlyController.class.getName());
- public static List REGION_READONLY_CONTROLLER_COPROCESSORS =
-List.of(RegionReadOnlyController.class.getName(),
BulkLoadReadOnlyController.class.getName(),
- EndpointReadOnlyController.class.getName());
+ public static ImmutableMap> READONLY_COPROCESSORS =
Review Comment:
Why public?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] Address comments in HBASE-29081 [hbase]
anmolnar commented on code in PR #8115:
URL: https://github.com/apache/hbase/pull/8115#discussion_r3139879868
##
hbase-server/src/main/java/org/apache/hadoop/hbase/util/CoprocessorConfigurationUtil.java:
##
@@ -46,13 +45,21 @@
public final class CoprocessorConfigurationUtil {
private static final Logger LOG =
LoggerFactory.getLogger(CoprocessorConfigurationUtil.class);
+ public static List MASTER_READONLY_CONTROLLER_COPROCESSORS =
+List.of(MasterReadOnlyController.class.getName());
Review Comment:
Use `ImmutableMap` and `ImmutableList` please.
```java
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList;
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap;
private static final Map> RO_COPROCS =
ImmutableMap.of(
CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
ImmutableList.of(MasterReadOnlyController.class.getName()), ...
);
```
And the lookup:
```java
private static List getReadOnlyCoprocessors(String
configurationKey) {
return RO_COPROCS.get(configurationKey);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] Address comments in HBASE-29081 [hbase]
kgeisz commented on code in PR #8115:
URL: https://github.com/apache/hbase/pull/8115#discussion_r3139121308
##
hbase-server/src/main/java/org/apache/hadoop/hbase/util/CoprocessorConfigurationUtil.java:
##
@@ -182,13 +181,14 @@ private static List
getReadOnlyCoprocessors(String configurationKey) {
/**
* This method adds or removes relevant ReadOnlyController coprocessors to
the provided
- * configuration based on whether read-only mode is enabled.
+ * configuration based on whether read-only mode is enabled in the provided
Configuration.
* @param conf The up-to-date configuration used to determine
how to handle
* coprocessors
* @param coprocessorConfKey The configuration key name
*/
public static void syncReadOnlyConfigurations(Configuration conf, String
coprocessorConfKey) {
-boolean isReadOnlyModeEnabled =
ConfigurationUtil.isReadOnlyModeEnabled(conf);
+boolean isReadOnlyModeEnabled =
conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
Review Comment:
Yes, definitely. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] Address comments in HBASE-29081 [hbase]
anmolnar commented on code in PR #8115:
URL: https://github.com/apache/hbase/pull/8115#discussion_r3138445569
##
hbase-server/src/main/java/org/apache/hadoop/hbase/util/CoprocessorConfigurationUtil.java:
##
@@ -182,13 +181,14 @@ private static List
getReadOnlyCoprocessors(String configurationKey) {
/**
* This method adds or removes relevant ReadOnlyController coprocessors to
the provided
- * configuration based on whether read-only mode is enabled.
+ * configuration based on whether read-only mode is enabled in the provided
Configuration.
* @param conf The up-to-date configuration used to determine
how to handle
* coprocessors
* @param coprocessorConfKey The configuration key name
*/
public static void syncReadOnlyConfigurations(Configuration conf, String
coprocessorConfKey) {
-boolean isReadOnlyModeEnabled =
ConfigurationUtil.isReadOnlyModeEnabled(conf);
+boolean isReadOnlyModeEnabled =
conf.getBoolean(HConstants.HBASE_GLOBAL_READONLY_ENABLED_KEY,
Review Comment:
It should be just a rename to `isReadOnlyModeEnabledInConf`, shouldn't it?
##
hbase-server/src/main/java/org/apache/hadoop/hbase/util/CoprocessorConfigurationUtil.java:
##
@@ -198,6 +198,58 @@ public static void
syncReadOnlyConfigurations(Configuration conf, String coproce
}
}
+ /**
+ * Check whether ReadOnlyController coprocessors have been loaded in the
provided configuration.
+ * @param conf the configuration we are checking
+ * @param coprocessorConfKey configuration key used for setting master,
region server, or region
+ * coprocessors
+ * @return true if the ReadOnlyCoprocessors are loaded in the configuration;
false otherwise
+ */
+ public static boolean areReadOnlyCoprocessorsLoaded(Configuration conf,
+String coprocessorConfKey) {
+// Using a HashSet will improve performance when searching for read-only
coprocessors
+HashSet allCoprocessors =
+ new HashSet<>(getCoprocessorsFromConfig(conf, coprocessorConfKey));
+List readOnlyCoprocessors =
getReadOnlyCoprocessors(coprocessorConfKey);
Review Comment:
This call builds the same list every time based on the configuration key.
We could make it a static map of this class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] Address comments in HBASE-29081 [hbase]
kgeisz commented on code in PR #8115:
URL: https://github.com/apache/hbase/pull/8115#discussion_r3132446368
##
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java:
##
@@ -8993,11 +8987,16 @@ IOException throwOnInterrupt(Throwable t) {
public void onConfigurationChange(Configuration newConf) {
this.storeHotnessProtector.update(newConf);
-CoprocessorConfigurationUtil.maybeUpdateCoprocessors(newConf,
this.isGlobalReadOnlyEnabled,
+boolean originalIsReadOnlyEnabled = CoprocessorConfigurationUtil
+ .areReadOnlyCoprocessorsLoaded(this.conf,
CoprocessorHost.REGION_COPROCESSOR_CONF_KEY);
+
+CoprocessorConfigurationUtil.maybeUpdateCoprocessors(newConf,
originalIsReadOnlyEnabled,
this.coprocessorHost, CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,
false, this.toString(),
- val -> this.isGlobalReadOnlyEnabled = val, conf -> {
+ conf -> {
decorateRegionConfiguration(conf);
-this.coprocessorHost = new RegionCoprocessorHost(this, rsServices,
newConf);
+this.coprocessorHost = new RegionCoprocessorHost(this, rsServices,
conf);
+CoprocessorConfigurationUtil.updateCoprocessorListInConf(this.conf,
conf,
+ CoprocessorHost.REGION_COPROCESSOR_CONF_KEY);
Review Comment:
I added this to satisfy a unit test in
`TestReadOnlyControllerCoprocessorLoading`. The dynamic configuration worked
as expected without this in local deployments or in a docker container setup.
##
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java:
##
@@ -3493,10 +3482,16 @@ public void onConfigurationChange(Configuration
newConf) {
LOG.warn("Failed to initialize SuperUsers on reloading of the
configuration");
}
-CoprocessorConfigurationUtil.maybeUpdateCoprocessors(newConf,
this.isGlobalReadOnlyEnabled,
+boolean originalIsReadOnlyEnabled = CoprocessorConfigurationUtil
+ .areReadOnlyCoprocessorsLoaded(this.conf,
CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY);
+
+CoprocessorConfigurationUtil.maybeUpdateCoprocessors(newConf,
originalIsReadOnlyEnabled,
this.rsHost, CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, false,
this.toString(),
- val -> this.isGlobalReadOnlyEnabled = val,
- conf -> this.rsHost = new RegionServerCoprocessorHost(this, newConf));
+ conf -> {
+this.rsHost = new RegionServerCoprocessorHost(this, conf);
+CoprocessorConfigurationUtil.updateCoprocessorListInConf(this.conf,
conf,
+ CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY);
Review Comment:
I added this to satisfy a unit test in
`TestReadOnlyControllerCoprocessorLoading`. The dynamic configuration worked
as expected without this in local deployments or in a docker container setup.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] Address comments in HBASE-29081 [hbase]
kgeisz commented on code in PR #8115:
URL: https://github.com/apache/hbase/pull/8115#discussion_r3132445297
##
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java:
##
@@ -4506,15 +4495,22 @@ public void onConfigurationChange(Configuration
newConf) {
// append the quotas observer back to the master coprocessor key
setQuotasObserver(newConf);
-boolean originalIsReadOnlyEnabled = this.isGlobalReadOnlyEnabled;
+boolean originalIsReadOnlyEnabled = CoprocessorConfigurationUtil
+ .areReadOnlyCoprocessorsLoaded(this.conf,
CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY);
-CoprocessorConfigurationUtil.maybeUpdateCoprocessors(newConf,
this.isGlobalReadOnlyEnabled,
+CoprocessorConfigurationUtil.maybeUpdateCoprocessors(newConf,
originalIsReadOnlyEnabled,
this.cpHost, CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
this.maintenanceMode,
- this.toString(), val -> this.isGlobalReadOnlyEnabled = val,
- conf -> initializeCoprocessorHost(newConf));
+ this.toString(), conf -> {
+this.initializeCoprocessorHost(conf);
+CoprocessorConfigurationUtil.updateCoprocessorListInConf(this.conf,
conf,
+ CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY);
Review Comment:
I added this to satisfy a unit test in
`TestReadOnlyControllerCoprocessorLoading`. The dynamic configuration worked
as expected without this in local deployments or in a docker container setup.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] Address comments in HBASE-29081 [hbase]
kgeisz commented on PR #8115: URL: https://github.com/apache/hbase/pull/8115#issuecomment-4306288788 The failed unit tests are not relevant. I ran them again locally and they all passed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Address comments in HBASE-29081 [hbase]
kgeisz commented on code in PR #8115:
URL: https://github.com/apache/hbase/pull/8115#discussion_r3127510662
##
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java:
##
@@ -4617,7 +4613,6 @@ private void setQuotasObserver(Configuration conf) {
private void initializeCoprocessorHost(Configuration conf) {
// initialize master side coprocessors before we start handling requests
this.cpHost = new MasterCoprocessorHost(this, conf);
-registerConfigurationObservers();
Review Comment:
This was added in PR #6931, so I am removing it again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] Address comments in HBASE-29081 [hbase]
kgeisz commented on code in PR #8115:
URL: https://github.com/apache/hbase/pull/8115#discussion_r3127502691
##
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java:
##
@@ -636,6 +624,7 @@ private void registerConfigurationObservers() {
public void run() {
try {
installShutdownHook();
+ registerConfigurationObservers();
Review Comment:
This was removed in PR #6931, so I am adding it back here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] Address comments in HBASE-29081 [hbase]
kgeisz commented on code in PR #8115:
URL: https://github.com/apache/hbase/pull/8115#discussion_r3127502691
##
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java:
##
@@ -636,6 +624,7 @@ private void registerConfigurationObservers() {
public void run() {
try {
installShutdownHook();
+ registerConfigurationObservers();
Review Comment:
This was removed in PR #6931
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Re: [PR] Address comments in HBASE-29081 [hbase]
kgeisz commented on PR #8115: URL: https://github.com/apache/hbase/pull/8115#issuecomment-4300685289 Hi @charlesconnell, I have made some changes for PR #8044 based on your review comments. Can you please take a look when you have time? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
