Class FileSystemRMStateStore
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore
org.apache.hadoop.yarn.server.resourcemanager.recovery.FileSystemRMStateStore
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore
RMStateStore.ProxyCAState, RMStateStore.RMDTSecretManagerState, RMStateStore.RMState, RMStateStore.RMStateStoreStateNested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final org.apache.hadoop.yarn.server.records.Versionprotected org.apache.hadoop.fs.FileSystemprotected org.apache.hadoop.conf.Configurationstatic final org.slf4j.Loggerprotected static final StringFields inherited from class org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore
AM_CLIENT_TOKEN_MASTER_KEY_NAME, AM_RM_TOKEN_SERVICE, AMRMTOKEN_SECRET_MANAGER_ROOT, baseEpoch, DELEGATION_KEY_PREFIX, DELEGATION_TOKEN_PREFIX, DELEGATION_TOKEN_SEQUENCE_NUMBER_PREFIX, EPOCH_NODE, PROXY_CA_CERT_NODE, PROXY_CA_PRIVATE_KEY_NODE, PROXY_CA_ROOT, RESERVATION_SYSTEM_ROOT, resourceManager, RM_APP_ROOT, RM_DELEGATION_TOKENS_ROOT_ZNODE_NAME, RM_DT_SECRET_MANAGER_ROOT, rmStateStoreEventHandler, VERSION_NODE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidDerived classes close themselves using this method.voidDerived classes must implement this method to delete the state store.longGet the current epoch of RM and increment the value.protected org.apache.hadoop.fs.PathgetAppAttemptDir(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttId) protected org.apache.hadoop.fs.PathgetAppDir(org.apache.hadoop.yarn.api.records.ApplicationId appId) protected org.apache.hadoop.yarn.server.records.VersionGet the current version of the underlying state store.intlongvoidinitInternal(org.apache.hadoop.conf.Configuration conf) Derived classes initialize themselves using this method.Blocking API The derived class must recover state from the store and return a new RMState object populated with that state This must not be called on the dispatcher thread.protected org.apache.hadoop.yarn.server.records.VersionDerived class use this method to load the version information from state store.voidremoveApplication(org.apache.hadoop.yarn.api.records.ApplicationId removeAppId) Derived classes must implement this method to remove application from the state store.voidremoveApplicationAttemptInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId) Blocking API Derived classes must implement this method to remove the state of specified attempt.voidBlocking API Derived classes must implement this method to remove the state of an application and its attempts.protected voidremoveReservationState(String planName, String reservationIdName) Blocking API Derived classes must implement this method to remove the state of a reservation allocation.voidremoveRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier) Blocking API Derived classes must implement this method to remove the state of RMDelegationToken.voidremoveRMDTMasterKeyState(org.apache.hadoop.security.token.delegation.DelegationKey masterKey) Blocking API Derived classes must implement this method to remove the state of DelegationToken Master Key.protected voidreplaceFile(org.apache.hadoop.fs.Path srcPath, org.apache.hadoop.fs.Path dstPath) protected voidDerived classes start themselves using this method.voidstoreApplicationAttemptStateInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, ApplicationAttemptStateData attemptStateDataPB) Blocking API Derived classes must implement this method to store the state of an application attempt.voidstoreApplicationStateInternal(org.apache.hadoop.yarn.api.records.ApplicationId appId, ApplicationStateData appStateDataPB) Blocking API Derived classes must implement this method to store the state of an application.voidstoreOrUpdateAMRMTokenSecretManagerState(AMRMTokenSecretManagerState amrmTokenSecretManagerState, boolean isUpdate) Blocking API Derived classes must implement this method to store or update the state of AMRMToken Master Key.protected voidstoreProxyCACertState(X509Certificate caCert, PrivateKey caPrivateKey) Blocking API Derived classes must implement this method to store the CA Certificate and Private Key.protected voidstoreReservationState(org.apache.hadoop.yarn.proto.YarnProtos.ReservationAllocationStateProto reservationAllocation, String planName, String reservationIdName) Blocking API Derived classes must implement this method to store the state of a reservation allocation.voidstoreRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier, Long renewDate) Blocking API Derived classes must implement this method to store the state of RMDelegationToken and sequence number.voidstoreRMDTMasterKeyState(org.apache.hadoop.security.token.delegation.DelegationKey masterKey) Blocking API Derived classes must implement this method to store the state of DelegationToken Master Key.protected voidDerived class use this method to store the version information.voidupdateApplicationAttemptStateInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, ApplicationAttemptStateData attemptStateDataPB) voidupdateApplicationStateInternal(org.apache.hadoop.yarn.api.records.ApplicationId appId, ApplicationStateData appStateDataPB) protected voidupdateFile(org.apache.hadoop.fs.Path outputPath, byte[] data, boolean makeUnreadableByAdmin) protected voidupdateRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDTIdentifier, Long renewDate) Blocking API Derived classes must implement this method to update the state of RMDelegationToken and sequence number.protected voidwriteFile(org.apache.hadoop.fs.Path outputPath, byte[] data, boolean makeUnreadableByAdmin) Methods inherited from class org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore
checkVersion, getCredentialsFromAppAttempt, getRMStateStoreEventHandler, getRMStateStoreState, handleStoreEvent, isFencedState, nextEpoch, notifyStoreOperationFailed, removeApplication, removeApplicationAttempt, removeReservation, removeRMDelegationToken, removeRMDTMasterKey, serviceInit, serviceStart, serviceStop, setResourceManager, setRMDispatcher, storeNewApplication, storeNewApplicationAttempt, storeNewReservation, storeOrUpdateAMRMTokenSecretManager, storeProxyCACert, storeRMDelegationToken, storeRMDTMasterKey, updateApplicationAttemptState, updateApplicationState, updateApplicationState, updateApplicationStateSynchronously, updateFencedState, updateRMDelegationTokenMethods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG -
ROOT_DIR_NAME
- See Also:
-
CURRENT_VERSION_INFO
protected static final org.apache.hadoop.yarn.server.records.Version CURRENT_VERSION_INFO -
AMRMTOKEN_SECRET_MANAGER_NODE
- See Also:
-
fs
protected org.apache.hadoop.fs.FileSystem fs -
fsConf
@VisibleForTesting protected org.apache.hadoop.conf.Configuration fsConf
-
-
Constructor Details
-
FileSystemRMStateStore
public FileSystemRMStateStore()
-
-
Method Details
-
initInternal
Description copied from class:RMStateStoreDerived classes initialize themselves using this method.- Specified by:
initInternalin classRMStateStore- Parameters:
conf- Configuration.- Throws:
Exception- error occur.
-
startInternal
Description copied from class:RMStateStoreDerived classes start themselves using this method. The base class is started and the event dispatcher is ready to use at this point.- Specified by:
startInternalin classRMStateStore- Throws:
Exception- error occur.
-
closeInternal
Description copied from class:RMStateStoreDerived classes close themselves using this method. The base class will be closed and the event dispatcher will be shutdown after this.- Specified by:
closeInternalin classRMStateStore- Throws:
Exception- error occur.
-
getCurrentVersion
protected org.apache.hadoop.yarn.server.records.Version getCurrentVersion()Description copied from class:RMStateStoreGet the current version of the underlying state store.- Specified by:
getCurrentVersionin classRMStateStore- Returns:
- current version.
-
loadVersion
Description copied from class:RMStateStoreDerived class use this method to load the version information from state store.- Specified by:
loadVersionin classRMStateStore- Returns:
- current version.
- Throws:
Exception- error occur.
-
storeVersion
Description copied from class:RMStateStoreDerived class use this method to store the version information.- Specified by:
storeVersionin classRMStateStore- Throws:
Exception- error occur.
-
getAndIncrementEpoch
Description copied from class:RMStateStoreGet the current epoch of RM and increment the value.- Specified by:
getAndIncrementEpochin classRMStateStore- Returns:
- current epoch.
- Throws:
Exception- error occur.
-
loadState
Description copied from class:RMStateStoreBlocking API The derived class must recover state from the store and return a new RMState object populated with that state This must not be called on the dispatcher thread.- Specified by:
loadStatein classRMStateStore- Returns:
- RMState.
- Throws:
Exception- error occur.
-
storeApplicationStateInternal
public void storeApplicationStateInternal(org.apache.hadoop.yarn.api.records.ApplicationId appId, ApplicationStateData appStateDataPB) throws Exception Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to store the state of an application.- Specified by:
storeApplicationStateInternalin classRMStateStore- Parameters:
appId- application Id.appStateDataPB- application StateData.- Throws:
Exception- error occur.
-
updateApplicationStateInternal
public void updateApplicationStateInternal(org.apache.hadoop.yarn.api.records.ApplicationId appId, ApplicationStateData appStateDataPB) throws Exception - Specified by:
updateApplicationStateInternalin classRMStateStore- Throws:
Exception
-
storeApplicationAttemptStateInternal
public void storeApplicationAttemptStateInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, ApplicationAttemptStateData attemptStateDataPB) throws Exception Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to store the state of an application attempt.- Specified by:
storeApplicationAttemptStateInternalin classRMStateStore- Parameters:
appAttemptId- Application AttemptId.attemptStateDataPB- Application AttemptStateData.- Throws:
Exception- error occur.
-
updateApplicationAttemptStateInternal
public void updateApplicationAttemptStateInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, ApplicationAttemptStateData attemptStateDataPB) throws Exception - Specified by:
updateApplicationAttemptStateInternalin classRMStateStore- Throws:
Exception
-
removeApplicationAttemptInternal
public void removeApplicationAttemptInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId) throws Exception Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to remove the state of specified attempt.- Specified by:
removeApplicationAttemptInternalin classRMStateStore- Parameters:
appAttemptId- application attempt id.- Throws:
Exception- exception occurs.
-
removeApplicationStateInternal
Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to remove the state of an application and its attempts.- Specified by:
removeApplicationStateInternalin classRMStateStore- Parameters:
appState- ApplicationStateData.- Throws:
Exception- error occurs.
-
storeRMDelegationTokenState
public void storeRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier, Long renewDate) throws Exception Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to store the state of RMDelegationToken and sequence number.- Specified by:
storeRMDelegationTokenStatein classRMStateStore- Parameters:
identifier- RMDelegationTokenIdentifier.renewDate- token renew date.- Throws:
Exception- error occur.
-
removeRMDelegationTokenState
public void removeRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier) throws Exception Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to remove the state of RMDelegationToken.- Specified by:
removeRMDelegationTokenStatein classRMStateStore- Parameters:
identifier- RMDelegationTokenIdentifier.- Throws:
Exception- error occurs.
-
updateRMDelegationTokenState
protected void updateRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDTIdentifier, Long renewDate) throws Exception Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to update the state of RMDelegationToken and sequence number.- Specified by:
updateRMDelegationTokenStatein classRMStateStore- Parameters:
rmDTIdentifier- RMDelegationTokenIdentifier.renewDate- token renew date.- Throws:
Exception- error occurs.
-
storeRMDTMasterKeyState
public void storeRMDTMasterKeyState(org.apache.hadoop.security.token.delegation.DelegationKey masterKey) throws Exception Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to store the state of DelegationToken Master Key.- Specified by:
storeRMDTMasterKeyStatein classRMStateStore- Parameters:
masterKey- DelegationToken Master Key.- Throws:
Exception- error occur.
-
removeRMDTMasterKeyState
public void removeRMDTMasterKeyState(org.apache.hadoop.security.token.delegation.DelegationKey masterKey) throws Exception Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to remove the state of DelegationToken Master Key.- Specified by:
removeRMDTMasterKeyStatein classRMStateStore- Parameters:
masterKey- DelegationKey.- Throws:
Exception- exception occurs.
-
deleteStore
Description copied from class:RMStateStoreDerived classes must implement this method to delete the state store.- Specified by:
deleteStorein classRMStateStore- Throws:
Exception- exception occurs.
-
removeApplication
public void removeApplication(org.apache.hadoop.yarn.api.records.ApplicationId removeAppId) throws Exception Description copied from class:RMStateStoreDerived classes must implement this method to remove application from the state store.- Specified by:
removeApplicationin classRMStateStore- Parameters:
removeAppId- application Id.- Throws:
Exception- exception occurs.
-
storeProxyCACertState
protected void storeProxyCACertState(X509Certificate caCert, PrivateKey caPrivateKey) throws Exception Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to store the CA Certificate and Private Key.- Specified by:
storeProxyCACertStatein classRMStateStore- Parameters:
caCert- X509Certificate.caPrivateKey- PrivateKey.- Throws:
Exception- error occurs.
-
getAppDir
@VisibleForTesting protected org.apache.hadoop.fs.Path getAppDir(org.apache.hadoop.yarn.api.records.ApplicationId appId) -
getAppAttemptDir
@VisibleForTesting protected org.apache.hadoop.fs.Path getAppAttemptDir(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttId) -
writeFile
protected void writeFile(org.apache.hadoop.fs.Path outputPath, byte[] data, boolean makeUnreadableByAdmin) throws Exception - Throws:
Exception
-
updateFile
protected void updateFile(org.apache.hadoop.fs.Path outputPath, byte[] data, boolean makeUnreadableByAdmin) throws Exception - Throws:
Exception
-
replaceFile
protected void replaceFile(org.apache.hadoop.fs.Path srcPath, org.apache.hadoop.fs.Path dstPath) throws Exception - Throws:
Exception
-
storeOrUpdateAMRMTokenSecretManagerState
public void storeOrUpdateAMRMTokenSecretManagerState(AMRMTokenSecretManagerState amrmTokenSecretManagerState, boolean isUpdate) throws Exception Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to store or update the state of AMRMToken Master Key.- Specified by:
storeOrUpdateAMRMTokenSecretManagerStatein classRMStateStore- Parameters:
amrmTokenSecretManagerState- amrmTokenSecretManagerState.isUpdate- true, update; otherwise not update.- Throws:
Exception- exception occurs.
-
storeReservationState
protected void storeReservationState(org.apache.hadoop.yarn.proto.YarnProtos.ReservationAllocationStateProto reservationAllocation, String planName, String reservationIdName) throws Exception Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to store the state of a reservation allocation.- Specified by:
storeReservationStatein classRMStateStore- Parameters:
reservationAllocation- reservation Allocation.planName- plan Name.reservationIdName- reservationId Name.- Throws:
Exception- error occurs.
-
removeReservationState
Description copied from class:RMStateStoreBlocking API Derived classes must implement this method to remove the state of a reservation allocation.- Specified by:
removeReservationStatein classRMStateStore- Parameters:
planName- plan Name.reservationIdName- reservationId Name.- Throws:
Exception- exception occurs.
-
getNumRetries
@VisibleForTesting public int getNumRetries() -
getRetryInterval
@VisibleForTesting public long getRetryInterval()
-