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<String> 
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<String> allCoprocessors =
+      new HashSet<>(getCoprocessorsFromConfig(conf, coprocessorConfKey));
+    List<String> 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]

Reply via email to