Class LeveldbConfigurationStore
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.conf.YarnConfigurationStore
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.conf.LeveldbConfigurationStore
- All Implemented Interfaces:
AutoCloseable
A LevelDB implementation of
YarnConfigurationStore.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.conf.YarnConfigurationStore
YarnConfigurationStore.LogMutation -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.apache.hadoop.yarn.server.records.Versionstatic final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the configuration store, releasing any required resources.voidconfirmMutation(YarnConfigurationStore.LogMutation pendingMutation, boolean isValid) Should be called afterlogMutation.voidformat()Format the persisted configuration.longGet the last updated config version.getConfirmedConfHistory(long fromId) Get a list of confirmed configuration mutations starting from a given id.org.apache.hadoop.yarn.server.records.VersionGet schema version of persisted conf store, for detecting compatibility issues when changing conf store schema.org.apache.hadoop.yarn.server.records.VersionGet the hard-coded schema version, for comparison against the schema version currently persisted.protected org.iq80.leveldb.DBgetDB()protected LinkedList<YarnConfigurationStore.LogMutation>getLogs()Get a list of configuration mutations.voidinitialize(org.apache.hadoop.conf.Configuration config, org.apache.hadoop.conf.Configuration schedConf, RMContext rmContext) Initialize the configuration store, with schedConf as the initial scheduler configuration.voidlogMutation(YarnConfigurationStore.LogMutation logMutation) Logs the configuration change to backing store.org.apache.hadoop.conf.Configurationretrieve()Retrieve the persisted configuration.voidPersist the hard-coded schema version to the conf store.protected voidstoreVersion(org.apache.hadoop.yarn.server.records.Version version) Methods inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.conf.YarnConfigurationStore
checkVersion
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG -
CURRENT_VERSION_INFO
@VisibleForTesting protected static final org.apache.hadoop.yarn.server.records.Version CURRENT_VERSION_INFO
-
-
Constructor Details
-
LeveldbConfigurationStore
public LeveldbConfigurationStore()
-
-
Method Details
-
initialize
public void initialize(org.apache.hadoop.conf.Configuration config, org.apache.hadoop.conf.Configuration schedConf, RMContext rmContext) throws IOException Description copied from class:YarnConfigurationStoreInitialize the configuration store, with schedConf as the initial scheduler configuration. If a persisted store already exists, use the scheduler configuration stored there, and ignore schedConf.- Specified by:
initializein classYarnConfigurationStore- Parameters:
config- configuration to initialize store withschedConf- Initial key-value scheduler configuration to persist.rmContext- RMContext for this configuration store- Throws:
IOException- if initialization fails
-
format
Description copied from class:YarnConfigurationStoreFormat the persisted configuration.- Specified by:
formatin classYarnConfigurationStore- Throws:
IOException- on failure to formatException
-
close
Description copied from class:YarnConfigurationStoreCloses the configuration store, releasing any required resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classYarnConfigurationStore- Throws:
IOException- on failure to close
-
logMutation
Description copied from class:YarnConfigurationStoreLogs the configuration change to backing store.- Specified by:
logMutationin classYarnConfigurationStore- Parameters:
logMutation- configuration change to be persisted in write ahead log- Throws:
IOException- if logging fails
-
confirmMutation
Description copied from class:YarnConfigurationStoreShould be called afterlogMutation. Gets the pending mutation last logged bylogMutationand marks the mutation as persisted (no longer pending). If isValid is true, merge the mutation with the persisted configuration.- Specified by:
confirmMutationin classYarnConfigurationStore- Parameters:
pendingMutation- the log mutation to applyisValid- if true, update persisted configuration with pending mutation.
-
retrieve
public org.apache.hadoop.conf.Configuration retrieve()Description copied from class:YarnConfigurationStoreRetrieve the persisted configuration.- Specified by:
retrievein classYarnConfigurationStore- Returns:
- configuration as key-value
-
getConfigVersion
public long getConfigVersion()Description copied from class:YarnConfigurationStoreGet the last updated config version.- Specified by:
getConfigVersionin classYarnConfigurationStore- Returns:
- Last updated config version.
-
getConfirmedConfHistory
Description copied from class:YarnConfigurationStoreGet a list of confirmed configuration mutations starting from a given id.- Specified by:
getConfirmedConfHistoryin classYarnConfigurationStore- Parameters:
fromId- id from which to start getting mutations, inclusive- Returns:
- list of configuration mutations
-
getConfStoreVersion
Description copied from class:YarnConfigurationStoreGet schema version of persisted conf store, for detecting compatibility issues when changing conf store schema.- Specified by:
getConfStoreVersionin classYarnConfigurationStore- Returns:
- Schema version currently used by the persisted configuration store.
- Throws:
Exception- On version fetch failure
-
getLogs
@VisibleForTesting protected LinkedList<YarnConfigurationStore.LogMutation> getLogs() throws ExceptionDescription copied from class:YarnConfigurationStoreGet a list of configuration mutations.- Specified by:
getLogsin classYarnConfigurationStore- Returns:
- list of configuration mutations.
- Throws:
Exception- On mutation fetch failure
-
getDB
@VisibleForTesting protected org.iq80.leveldb.DB getDB() -
storeVersion
Description copied from class:YarnConfigurationStorePersist the hard-coded schema version to the conf store.- Specified by:
storeVersionin classYarnConfigurationStore- Throws:
Exception- On storage failure
-
storeVersion
@VisibleForTesting protected void storeVersion(org.apache.hadoop.yarn.server.records.Version version) -
getCurrentVersion
public org.apache.hadoop.yarn.server.records.Version getCurrentVersion()Description copied from class:YarnConfigurationStoreGet the hard-coded schema version, for comparison against the schema version currently persisted.- Specified by:
getCurrentVersionin classYarnConfigurationStore- Returns:
- Current hard-coded schema version
-