Package org.apache.hadoop.hbase.util
Class CoprocessorConfigurationUtil
java.lang.Object
org.apache.hadoop.hbase.util.CoprocessorConfigurationUtil
Helper class for coprocessor host when configuration changes.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddCoprocessors(org.apache.hadoop.conf.Configuration conf, String configurationKey, List<String> coprocessorsToAdd) static booleanareReadOnlyCoprocessorsLoaded(org.apache.hadoop.conf.Configuration conf, String coprocessorConfKey) Check whether ReadOnlyController coprocessors have been loaded in the provided configuration.static booleancheckConfigurationChange(CoprocessorHost<?, ?> coprocessorHost, org.apache.hadoop.conf.Configuration conf, String... configurationKey) Check configuration change by comparing current loaded coprocessors with configuration values.static StringgetComponentName(String coprocessorConfKey) Gets the name of a component based on the provided coprocessor configuration key.getCoprocessorsFromConfig(org.apache.hadoop.conf.Configuration conf, String configurationKey) getReadOnlyCoprocessors(String configurationKey) private static booleanhasCoprocessorsConfigured(org.apache.hadoop.conf.Configuration conf, String... configurationKey) Helper method to check if there are any coprocessors configured.static voidmaybeUpdateCoprocessors(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.static voidremoveCoprocessors(org.apache.hadoop.conf.Configuration conf, String configurationKey, List<String> coprocessorsToRemove) static voidsyncReadOnlyConfigurations(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.static voidupdateCoprocessorListInConf(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.
-
Field Details
-
LOG
-
READONLY_COPROCESSORS
private static final org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<String,List<String>> READONLY_COPROCESSORS
-
-
Constructor Details
-
CoprocessorConfigurationUtil
private CoprocessorConfigurationUtil()
-
-
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 checkconfigurationKey- 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
-
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 coprocessorscoprocessorConfKey- 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 checkingcoprocessorConfKey- 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 regionupdatedConf- the updated version of the configuration whose coprocessors we want to copycoprocessorConfKey- configuration key used for setting master, region server, or region coprocessors
-
getComponentName
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 configurationoriginalIsReadOnlyEnabled- the original value for "hbase.global.readonly.enabled"coprocessorHost- the coprocessor host for HMaster, HRegionServer, or HRegioncoprocessorConfKey- configuration key used for setting master, region server, or region coprocessorsisMaintenanceMode- 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
-