Class CoprocessorConfigurationUtil

java.lang.Object
org.apache.hadoop.hbase.util.CoprocessorConfigurationUtil

@Private public final class CoprocessorConfigurationUtil extends Object
Helper class for coprocessor host when configuration changes.
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
    • READONLY_COPROCESSORS

      private static final org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<String,List<String>> READONLY_COPROCESSORS
  • Constructor Details

  • Method Details

    • checkConfigurationChange

      public static boolean checkConfigurationChange(CoprocessorHost<?,?> coprocessorHost, org.apache.hadoop.conf.Configuration conf, String... configurationKey)
      Check configuration change by comparing current loaded coprocessors with configuration values. This method is useful when the configuration object has been updated, but we need to determine if the coprocessor configuration has actually changed compared to what's currently loaded.

      Note: This method only detects changes in the set of coprocessor class names. It does not detect changes to priority or path for coprocessors that are already loaded with the same class name. If you need to update the priority or path of an existing coprocessor, you must restart the region/regionserver/master.

      Parameters:
      coprocessorHost - the coprocessor host to check current loaded coprocessors (can be null)
      conf - the configuration to check
      configurationKey - the configuration keys to check
      Returns:
      true if configuration has changed, false otherwise
    • hasCoprocessorsConfigured

      private static boolean hasCoprocessorsConfigured(org.apache.hadoop.conf.Configuration conf, String... configurationKey)
      Helper method to check if there are any coprocessors configured.
    • getCoprocessorsFromConfig

      private static List<String> getCoprocessorsFromConfig(org.apache.hadoop.conf.Configuration conf, String configurationKey)
    • addCoprocessors

      public static void addCoprocessors(org.apache.hadoop.conf.Configuration conf, String configurationKey, List<String> coprocessorsToAdd)
    • removeCoprocessors

      public static void removeCoprocessors(org.apache.hadoop.conf.Configuration conf, String configurationKey, List<String> coprocessorsToRemove)
    • getReadOnlyCoprocessors

      private static List<String> getReadOnlyCoprocessors(String configurationKey)
    • syncReadOnlyConfigurations

      public static void syncReadOnlyConfigurations(org.apache.hadoop.conf.Configuration conf, String coprocessorConfKey)
      This method adds or removes relevant ReadOnlyController coprocessors to the provided configuration based on whether read-only mode is enabled in the provided Configuration.
      Parameters:
      conf - The up-to-date configuration used to determine how to handle coprocessors
      coprocessorConfKey - The configuration key name
    • areReadOnlyCoprocessorsLoaded

      public static boolean areReadOnlyCoprocessorsLoaded(org.apache.hadoop.conf.Configuration conf, String coprocessorConfKey)
      Check whether ReadOnlyController coprocessors have been loaded in the provided configuration.
      Parameters:
      conf - the configuration we are checking
      coprocessorConfKey - configuration key used for setting master, region server, or region coprocessors
      Returns:
      true if the ReadOnlyCoprocessors are loaded in the configuration; false otherwise
    • updateCoprocessorListInConf

      public static void updateCoprocessorListInConf(org.apache.hadoop.conf.Configuration currentConf, org.apache.hadoop.conf.Configuration updatedConf, String coprocessorConfKey)
      Takes an updated configuration and updates the coprocessors for that configuration key in the current configuration.
      Parameters:
      currentConf - the configuration currently used by the master, region server, or region
      updatedConf - the updated version of the configuration whose coprocessors we want to copy
      coprocessorConfKey - configuration key used for setting master, region server, or region coprocessors
    • getComponentName

      public static String getComponentName(String coprocessorConfKey)
      Gets the name of a component based on the provided coprocessor configuration key.
      Parameters:
      coprocessorConfKey - configuration key used for setting master, region server, or region coprocessors
      Returns:
      the component type - Master, Region Server, or Region
    • maybeUpdateCoprocessors

      public static void maybeUpdateCoprocessors(org.apache.hadoop.conf.Configuration newConf, boolean originalIsReadOnlyEnabled, CoprocessorHost<?,?> coprocessorHost, String coprocessorConfKey, boolean isMaintenanceMode, String instance, CoprocessorReloadTask reloadTask)
      This method updates the coprocessors on the master, region server, or region if a change has been detected. Detected changes include changes in coprocessors or changes in read-only mode configuration. If a change is detected, then new coprocessors are loaded using the provided reload method. The new value for the read-only config variable is updated as well.
      Parameters:
      newConf - an updated configuration
      originalIsReadOnlyEnabled - the original value for "hbase.global.readonly.enabled"
      coprocessorHost - the coprocessor host for HMaster, HRegionServer, or HRegion
      coprocessorConfKey - configuration key used for setting master, region server, or region coprocessors
      isMaintenanceMode - whether maintenance mode is active (mainly for HMaster)
      instance - string value of the instance calling this method (mainly helps with tracking region logging)
      reloadTask - lambda function that reloads coprocessors on the master, region server, or region