Class SystemOptionManager
- All Implemented Interfaces:
AutoCloseable
,Iterable<OptionValue>
,OptionManager
,OptionSet
OptionManager
that holds options within
DrillbitContext
. Only one instance of
this class exists per drillbit. Options set at the system level affect the
entire system and persist between restarts.
All the system options are externalized into conf file. While adding a new system option a validator should be added and the default value for the option should be set in the conf files(example : drill-module.conf) under the namespace drill.exec.options.
The SystemOptionManager loads all the validators and the default values for the options are fetched from the config. The validators are populated with the default values fetched from the config. If the option is not set in the conf files config option is missing exception will be thrown.
If the option is set using ALTER, the value that is set will be returned. Else the default value that is loaded into validator from the config will be returned.
-
Constructor Summary
ConstructorDescriptionSystemOptionManager
(DrillConfig bootConfig) Test-only, in-memory version of the system option manager.SystemOptionManager
(LogicalPlanPersistence lpPersistence, PersistentStoreProvider provider, DrillConfig bootConfig) SystemOptionManager
(LogicalPlanPersistence lpPersistence, PersistentStoreProvider provider, DrillConfig bootConfig, CaseInsensitiveMap<OptionDefinition> definitions) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static CaseInsensitiveMap<OptionDefinition>
Creates theOptionDefinitions
to be registered with theSystemOptionManager
.void
Deletes all options.void
deleteLocalOption
(String name) Deletes the option.getDefault
(String optionName) Gets the default value for the specified option.Gets the option value for the given option name.getOptionDefinition
(String name) Gets theOptionDefinition
associated with the name.Gets the list of options managed this manager.protected OptionValue.OptionScope
getScope()
init()
Initializes this option manager.iterator()
protected void
setLocalOptionHelper
(OptionValue value) Methods inherited from class org.apache.drill.exec.server.options.BaseOptionManager
getBoolean, getDouble, getInt, getInternalOptionList, getLong, getOption, getOption, getOption, getOption, getPublicOptionList, getString, setLocalOption, setLocalOption, setLocalOption, setLocalOption, setLocalOption, setLocalOption
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SystemOptionManager
public SystemOptionManager(LogicalPlanPersistence lpPersistence, PersistentStoreProvider provider, DrillConfig bootConfig) -
SystemOptionManager
public SystemOptionManager(LogicalPlanPersistence lpPersistence, PersistentStoreProvider provider, DrillConfig bootConfig, CaseInsensitiveMap<OptionDefinition> definitions) -
SystemOptionManager
Test-only, in-memory version of the system option manager.- Parameters:
bootConfig
- Drill config
-
-
Method Details
-
createDefaultOptionDefinitions
Creates theOptionDefinitions
to be registered with theSystemOptionManager
.- Returns:
- A map
-
init
Initializes this option manager.- Returns:
- this option manager
- Throws:
Exception
- if unable to initialize option manager
-
iterator
- Specified by:
iterator
in interfaceIterable<OptionValue>
-
getOption
Description copied from interface:OptionSet
Gets the option value for the given option name. This interface also provides convenient methods to get typed option values:OptionSet.getOption(TypeValidators.BooleanValidator validator)
,OptionSet.getOption(TypeValidators.DoubleValidator validator)
,OptionSet.getOption(TypeValidators.LongValidator validator)
, andOptionSet.getOption(TypeValidators.StringValidator validator)
. -
getDefault
Description copied from interface:OptionSet
Gets the default value for the specified option.- Specified by:
getDefault
in interfaceOptionSet
- Parameters:
optionName
- The option to retrieve the default value for.- Returns:
- The default value for the option.
-
setLocalOptionHelper
- Specified by:
setLocalOptionHelper
in classBaseOptionManager
-
getScope
- Specified by:
getScope
in classBaseOptionManager
-
deleteLocalOption
Description copied from interface:OptionManager
Deletes the option. If the option name is valid (exists in the set of validators produced bycreateDefaultOptionDefinitions()
), but the option was not set within this manager, calling this method should be a no-op.- Specified by:
deleteLocalOption
in interfaceOptionManager
- Parameters:
name
- option name
-
deleteAllLocalOptions
public void deleteAllLocalOptions()Description copied from interface:OptionManager
Deletes all options. If no options are set, calling this method should be no-op.- Specified by:
deleteAllLocalOptions
in interfaceOptionManager
-
getOptionDefinition
Gets theOptionDefinition
associated with the name.- Specified by:
getOptionDefinition
in interfaceOptionManager
- Parameters:
name
- name of the option- Returns:
- the associated option definition
- Throws:
UserException
- - if the definition is not found
-
getOptionList
Description copied from interface:OptionManager
Gets the list of options managed this manager.- Specified by:
getOptionList
in interfaceOptionManager
- Returns:
- the list of options
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-