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 Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.slf4j.Logger
     
    private static final org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<String,List<String>>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addCoprocessors(org.apache.hadoop.conf.Configuration conf, String configurationKey, List<String> coprocessorsToAdd)
     
    static boolean
    areReadOnlyCoprocessorsLoaded(org.apache.hadoop.conf.Configuration conf, String coprocessorConfKey)
    Check whether ReadOnlyController coprocessors have been loaded in the provided configuration.
    static boolean
    checkConfigurationChange(CoprocessorHost<?,?> coprocessorHost, org.apache.hadoop.conf.Configuration conf, String... configurationKey)
    Check configuration change by comparing current loaded coprocessors with configuration values.
    static String
    getComponentName(String coprocessorConfKey)
    Gets the name of a component based on the provided coprocessor configuration key.
    private static List<String>
    getCoprocessorsFromConfig(org.apache.hadoop.conf.Configuration conf, String configurationKey)
     
    private static List<String>
    getReadOnlyCoprocessors(String configurationKey)
     
    private static boolean
    hasCoprocessorsConfigured(org.apache.hadoop.conf.Configuration conf, String... configurationKey)
    Helper method to check if there are any coprocessors configured.
    static void
    maybeUpdateCoprocessors(org.apache.hadoop.conf.Configuration updatedConf, org.apache.hadoop.conf.Configuration originalConf, 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.
    static void
    removeCoprocessors(org.apache.hadoop.conf.Configuration conf, String configurationKey, List<String> coprocessorsToRemove)
     
    private static void
    syncCoprocessorsWithConf(org.apache.hadoop.conf.Configuration srcConf, org.apache.hadoop.conf.Configuration dstConf, String coprocessorConfKey)
    Updates the coprocessors in one Configuration object to match the coprocessors in the other
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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)
    • syncCoprocessorsWithConf

      private static void syncCoprocessorsWithConf(org.apache.hadoop.conf.Configuration srcConf, org.apache.hadoop.conf.Configuration dstConf, String coprocessorConfKey)
      Updates the coprocessors in one Configuration object to match the coprocessors in the other
      Parameters:
      srcConf - the Configuration object we are getting coprocessors from
      dstConf - the Configuration object we are updating
      coprocessorConfKey - the type of coprocessors we are updating
    • 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
    • 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 updatedConf, org.apache.hadoop.conf.Configuration originalConf, 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:
      updatedConf - an updated configuration
      originalConf - the actual configuration we want to update, which may or may not be the same Configuration object as updatedConf
      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