Class NMStateStoreService
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.nodemanager.recovery.NMStateStoreService
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
- Direct Known Subclasses:
NMLeveldbStateStoreService,NMNullStateStoreService
@Private
@Unstable
public abstract class NMStateStoreService
extends org.apache.hadoop.service.AbstractService
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classRecovered states for AMRMProxy.static classstatic classstatic enumstatic classstatic enumType of post recovery action.static classstatic classstatic classstatic classstatic classNested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected abstract voidabstract voidfinishResourceLocalization(String user, org.apache.hadoop.yarn.api.records.ApplicationId appId, org.apache.hadoop.yarn.proto.YarnServerNodemanagerRecoveryProtos.LocalizedResourceProto proto) Record the completion of a resource localizationget the Recovered Container State Iteratorprotected NodeStatusUpdaterprotected abstract voidinitStorage(org.apache.hadoop.conf.Configuration conf) booleanLoad the state of AMRMProxy.Load the state of applications.Load the state of container tokensLoad the state of the deletion serviceLoad the state of localized resourcesLoad the state of log deletersLoad the state of NM tokensvoidreleaseAssignedResources(org.apache.hadoop.yarn.api.records.ContainerId containerId, String resourceType) Delete the assigned resources of a container of specific resourceType.abstract voidremoveAMRMProxyAppContext(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attempt) Remove the entire context map for an application attempt in AMRMProxyService.abstract voidremoveAMRMProxyAppContextEntry(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attempt, String key) Remove a context entry for an application attempt in AMRMProxyService.abstract voidremoveApplication(org.apache.hadoop.yarn.api.records.ApplicationId appId) Remove records corresponding to an applicationabstract voidremoveContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId) Remove records corresponding to a containerabstract voidremoveContainerPaused(org.apache.hadoop.yarn.api.records.ContainerId containerId) Record that a container has been resumed at the NM by removing the fact that it has be paused.abstract voidremoveContainerToken(org.apache.hadoop.yarn.api.records.ContainerId containerId) Remove records for a container tokenabstract voidremoveDeletionTask(int taskId) Remove records corresponding to a deletion taskabstract voidremoveLocalizedResource(String user, org.apache.hadoop.yarn.api.records.ApplicationId appId, org.apache.hadoop.fs.Path localPath) Remove records related to a resource localizationabstract voidremoveLogDeleter(org.apache.hadoop.yarn.api.records.ApplicationId appId) Remove the state of a log deleterabstract voidremoveNMTokenApplicationMasterKey(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attempt) Remove a master key corresponding to an applicationvoidserviceInit(org.apache.hadoop.conf.Configuration conf) Initialize the state storagevoidStart the state storage for usevoidShutdown the state storage.voidsetNodeStatusUpdater(NodeStatusUpdater nodeStatusUpdater) abstract voidstartResourceLocalization(String user, org.apache.hadoop.yarn.api.records.ApplicationId appId, org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceProto proto, org.apache.hadoop.fs.Path localPath) Record the start of localization for a resourceprotected abstract voidabstract voidstoreAMRMProxyAppContextEntry(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attempt, String key, byte[] data) Add a context entry for an application attempt in AMRMProxyService.abstract voidstoreAMRMProxyCurrentMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) Record the current AMRMProxyTokenSecretManager master key.abstract voidstoreAMRMProxyNextMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) Record the next AMRMProxyTokenSecretManager master key.abstract voidstoreApplication(org.apache.hadoop.yarn.api.records.ApplicationId appId, org.apache.hadoop.yarn.proto.YarnServerNodemanagerRecoveryProtos.ContainerManagerApplicationProto p) Record the start of an applicationabstract voidstoreAssignedResources(Container container, String resourceType, List<Serializable> assignedResources) Store the assigned resources to a container.abstract voidstoreContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId, int containerVersion, long startTime, org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest startRequest) Record a container start requestabstract voidstoreContainerCompleted(org.apache.hadoop.yarn.api.records.ContainerId containerId, int exitCode) Record that a container has completedabstract voidstoreContainerDiagnostics(org.apache.hadoop.yarn.api.records.ContainerId containerId, StringBuilder diagnostics) Record diagnostics for a containerabstract voidstoreContainerKilled(org.apache.hadoop.yarn.api.records.ContainerId containerId) Record a request to kill a containerabstract voidstoreContainerLaunched(org.apache.hadoop.yarn.api.records.ContainerId containerId) Record that a container has been launchedabstract voidstoreContainerLogDir(org.apache.hadoop.yarn.api.records.ContainerId containerId, String logDir) Record log directory for a container.abstract voidstoreContainerPaused(org.apache.hadoop.yarn.api.records.ContainerId containerId) Record that a container has been paused at the NM.abstract voidstoreContainerQueued(org.apache.hadoop.yarn.api.records.ContainerId containerId) Record that a container has been queued at the NMabstract voidstoreContainerRemainingRetryAttempts(org.apache.hadoop.yarn.api.records.ContainerId containerId, int remainingRetryAttempts) Record remaining retry attempts for a container.abstract voidstoreContainerRestartTimes(org.apache.hadoop.yarn.api.records.ContainerId containerId, List<Long> restartTimes) Record restart times for a container.abstract voidstoreContainerToken(org.apache.hadoop.yarn.api.records.ContainerId containerId, Long expirationTime) Record the expiration time for a container tokenabstract voidstoreContainerTokenCurrentMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) Record the current container token master keyabstract voidstoreContainerTokenPreviousMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) Record the previous container token master keyabstract voidstoreContainerUpdateToken(org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.yarn.security.ContainerTokenIdentifier containerTokenIdentifier) Record that a container has been updatedabstract voidstoreContainerWorkDir(org.apache.hadoop.yarn.api.records.ContainerId containerId, String workDir) Record working directory for a container.abstract voidstoreDeletionTask(int taskId, org.apache.hadoop.yarn.proto.YarnServerNodemanagerRecoveryProtos.DeletionServiceDeleteTaskProto taskProto) Record a deletion taskabstract voidstoreLogDeleter(org.apache.hadoop.yarn.api.records.ApplicationId appId, org.apache.hadoop.yarn.proto.YarnServerNodemanagerRecoveryProtos.LogDeleterProto proto) Store the state of a log deleterabstract voidstoreNMTokenApplicationMasterKey(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attempt, org.apache.hadoop.yarn.server.api.records.MasterKey key) Record a master key corresponding to an applicationabstract voidstoreNMTokenCurrentMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) Record the current NM token master keyabstract voidstoreNMTokenPreviousMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) Record the previous NM token master keyprotected voidupdateContainerResourceMapping(Container container, String resourceType, List<Serializable> assignedResources) Methods 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
-
Constructor Details
-
NMStateStoreService
-
-
Method Details
-
getNodeStatusUpdater
-
setNodeStatusUpdater
-
serviceInit
Initialize the state storage- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
IOException
-
serviceStart
Start the state storage for use- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
IOException
-
serviceStop
Shutdown the state storage.- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService- Throws:
IOException
-
canRecover
public boolean canRecover() -
isNewlyCreated
public boolean isNewlyCreated() -
loadApplicationsState
public abstract NMStateStoreService.RecoveredApplicationsState loadApplicationsState() throws IOExceptionLoad the state of applications.- Returns:
- recovered state for applications.
- Throws:
IOException- IO Exception.
-
storeApplication
public abstract void storeApplication(org.apache.hadoop.yarn.api.records.ApplicationId appId, org.apache.hadoop.yarn.proto.YarnServerNodemanagerRecoveryProtos.ContainerManagerApplicationProto p) throws IOException Record the start of an application- Parameters:
appId- the application IDp- state to store for the application- Throws:
IOException
-
removeApplication
public abstract void removeApplication(org.apache.hadoop.yarn.api.records.ApplicationId appId) throws IOException Remove records corresponding to an application- Parameters:
appId- the application ID- Throws:
IOException
-
getContainerStateIterator
public abstract RecoveryIterator<NMStateStoreService.RecoveredContainerState> getContainerStateIterator() throws IOExceptionget the Recovered Container State Iterator- Returns:
- recovery iterator
- Throws:
IOException
-
storeContainer
public abstract void storeContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId, int containerVersion, long startTime, org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest startRequest) throws IOException Record a container start request- Parameters:
containerId- the container IDcontainerVersion- the container VersionstartTime- container start timestartRequest- the container start request- Throws:
IOException
-
storeContainerQueued
public abstract void storeContainerQueued(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws IOException Record that a container has been queued at the NM- Parameters:
containerId- the container ID- Throws:
IOException
-
storeContainerPaused
public abstract void storeContainerPaused(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws IOException Record that a container has been paused at the NM.- Parameters:
containerId- the container ID.- Throws:
IOException- IO Exception.
-
removeContainerPaused
public abstract void removeContainerPaused(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws IOException Record that a container has been resumed at the NM by removing the fact that it has be paused.- Parameters:
containerId- the container ID.- Throws:
IOException- IO Exception.
-
storeContainerLaunched
public abstract void storeContainerLaunched(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws IOException Record that a container has been launched- Parameters:
containerId- the container ID- Throws:
IOException
-
storeContainerUpdateToken
public abstract void storeContainerUpdateToken(org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.yarn.security.ContainerTokenIdentifier containerTokenIdentifier) throws IOException Record that a container has been updated- Parameters:
containerId- the container IDcontainerTokenIdentifier- container token identifier- Throws:
IOException
-
storeContainerCompleted
public abstract void storeContainerCompleted(org.apache.hadoop.yarn.api.records.ContainerId containerId, int exitCode) throws IOException Record that a container has completed- Parameters:
containerId- the container IDexitCode- the exit code from the container- Throws:
IOException
-
storeContainerKilled
public abstract void storeContainerKilled(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws IOException Record a request to kill a container- Parameters:
containerId- the container ID- Throws:
IOException
-
storeContainerDiagnostics
public abstract void storeContainerDiagnostics(org.apache.hadoop.yarn.api.records.ContainerId containerId, StringBuilder diagnostics) throws IOException Record diagnostics for a container- Parameters:
containerId- the container IDdiagnostics- the container diagnostics- Throws:
IOException
-
storeContainerRemainingRetryAttempts
public abstract void storeContainerRemainingRetryAttempts(org.apache.hadoop.yarn.api.records.ContainerId containerId, int remainingRetryAttempts) throws IOException Record remaining retry attempts for a container.- Parameters:
containerId- the container IDremainingRetryAttempts- the remain retry times when container fails to run- Throws:
IOException
-
storeContainerRestartTimes
public abstract void storeContainerRestartTimes(org.apache.hadoop.yarn.api.records.ContainerId containerId, List<Long> restartTimes) throws IOException Record restart times for a container.- Parameters:
containerId-restartTimes-- Throws:
IOException
-
storeContainerWorkDir
public abstract void storeContainerWorkDir(org.apache.hadoop.yarn.api.records.ContainerId containerId, String workDir) throws IOException Record working directory for a container.- Parameters:
containerId- the container IDworkDir- the working directory- Throws:
IOException
-
storeContainerLogDir
public abstract void storeContainerLogDir(org.apache.hadoop.yarn.api.records.ContainerId containerId, String logDir) throws IOException Record log directory for a container.- Parameters:
containerId- the container IDlogDir- the log directory- Throws:
IOException
-
removeContainer
public abstract void removeContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws IOException Remove records corresponding to a container- Parameters:
containerId- the container ID- Throws:
IOException
-
loadLocalizationState
public abstract NMStateStoreService.RecoveredLocalizationState loadLocalizationState() throws IOExceptionLoad the state of localized resources- Returns:
- recovered localized resource state
- Throws:
IOException
-
startResourceLocalization
public abstract void startResourceLocalization(String user, org.apache.hadoop.yarn.api.records.ApplicationId appId, org.apache.hadoop.yarn.proto.YarnProtos.LocalResourceProto proto, org.apache.hadoop.fs.Path localPath) throws IOException Record the start of localization for a resource- Parameters:
user- the username or null if the resource is publicappId- the application ID if the resource is app-specific or nullproto- the resource requestlocalPath- local filesystem path where the resource will be stored- Throws:
IOException
-
finishResourceLocalization
public abstract void finishResourceLocalization(String user, org.apache.hadoop.yarn.api.records.ApplicationId appId, org.apache.hadoop.yarn.proto.YarnServerNodemanagerRecoveryProtos.LocalizedResourceProto proto) throws IOException Record the completion of a resource localization- Parameters:
user- the username or null if the resource is publicappId- the application ID if the resource is app-specific or nullproto- the serialized localized resource- Throws:
IOException
-
removeLocalizedResource
public abstract void removeLocalizedResource(String user, org.apache.hadoop.yarn.api.records.ApplicationId appId, org.apache.hadoop.fs.Path localPath) throws IOException Remove records related to a resource localization- Parameters:
user- the username or null if the resource is publicappId- the application ID if the resource is app-specific or nulllocalPath- local filesystem path where the resource will be stored- Throws:
IOException
-
loadDeletionServiceState
public abstract NMStateStoreService.RecoveredDeletionServiceState loadDeletionServiceState() throws IOExceptionLoad the state of the deletion service- Returns:
- recovered deletion service state
- Throws:
IOException
-
storeDeletionTask
public abstract void storeDeletionTask(int taskId, org.apache.hadoop.yarn.proto.YarnServerNodemanagerRecoveryProtos.DeletionServiceDeleteTaskProto taskProto) throws IOException Record a deletion task- Parameters:
taskId- the deletion task IDtaskProto- the deletion task protobuf- Throws:
IOException
-
removeDeletionTask
Remove records corresponding to a deletion task- Parameters:
taskId- the deletion task ID- Throws:
IOException
-
loadNMTokensState
Load the state of NM tokens- Returns:
- recovered state of NM tokens
- Throws:
IOException
-
storeNMTokenCurrentMasterKey
public abstract void storeNMTokenCurrentMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) throws IOException Record the current NM token master key- Parameters:
key- the master key- Throws:
IOException
-
storeNMTokenPreviousMasterKey
public abstract void storeNMTokenPreviousMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) throws IOException Record the previous NM token master key- Parameters:
key- the previous master key- Throws:
IOException
-
storeNMTokenApplicationMasterKey
public abstract void storeNMTokenApplicationMasterKey(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attempt, org.apache.hadoop.yarn.server.api.records.MasterKey key) throws IOException Record a master key corresponding to an application- Parameters:
attempt- the application attempt IDkey- the master key- Throws:
IOException
-
removeNMTokenApplicationMasterKey
public abstract void removeNMTokenApplicationMasterKey(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attempt) throws IOException Remove a master key corresponding to an application- Parameters:
attempt- the application attempt ID- Throws:
IOException
-
loadContainerTokensState
public abstract NMStateStoreService.RecoveredContainerTokensState loadContainerTokensState() throws IOExceptionLoad the state of container tokens- Returns:
- recovered state of container tokens
- Throws:
IOException
-
storeContainerTokenCurrentMasterKey
public abstract void storeContainerTokenCurrentMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) throws IOException Record the current container token master key- Parameters:
key- the master key- Throws:
IOException
-
storeContainerTokenPreviousMasterKey
public abstract void storeContainerTokenPreviousMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) throws IOException Record the previous container token master key- Parameters:
key- the previous master key- Throws:
IOException
-
storeContainerToken
public abstract void storeContainerToken(org.apache.hadoop.yarn.api.records.ContainerId containerId, Long expirationTime) throws IOException Record the expiration time for a container token- Parameters:
containerId- the container IDexpirationTime- the container token expiration time- Throws:
IOException
-
removeContainerToken
public abstract void removeContainerToken(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws IOException Remove records for a container token- Parameters:
containerId- the container ID- Throws:
IOException
-
loadLogDeleterState
public abstract NMStateStoreService.RecoveredLogDeleterState loadLogDeleterState() throws IOExceptionLoad the state of log deleters- Returns:
- recovered log deleter state
- Throws:
IOException
-
storeLogDeleter
public abstract void storeLogDeleter(org.apache.hadoop.yarn.api.records.ApplicationId appId, org.apache.hadoop.yarn.proto.YarnServerNodemanagerRecoveryProtos.LogDeleterProto proto) throws IOException Store the state of a log deleter- Parameters:
appId- the application ID for the log deleterproto- the serialized state of the log deleter- Throws:
IOException
-
removeLogDeleter
public abstract void removeLogDeleter(org.apache.hadoop.yarn.api.records.ApplicationId appId) throws IOException Remove the state of a log deleter- Parameters:
appId- the application ID for the log deleter- Throws:
IOException
-
loadAMRMProxyState
Load the state of AMRMProxy.- Returns:
- recovered state of AMRMProxy
- Throws:
IOException- if fails
-
storeAMRMProxyCurrentMasterKey
public abstract void storeAMRMProxyCurrentMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) throws IOException Record the current AMRMProxyTokenSecretManager master key.- Parameters:
key- the current master key- Throws:
IOException- if fails
-
storeAMRMProxyNextMasterKey
public abstract void storeAMRMProxyNextMasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey key) throws IOException Record the next AMRMProxyTokenSecretManager master key.- Parameters:
key- the next master key- Throws:
IOException- if fails
-
storeAMRMProxyAppContextEntry
public abstract void storeAMRMProxyAppContextEntry(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attempt, String key, byte[] data) throws IOException Add a context entry for an application attempt in AMRMProxyService.- Parameters:
attempt- app attempt IDkey- key stringdata- state data to store- Throws:
IOException- if fails
-
removeAMRMProxyAppContextEntry
public abstract void removeAMRMProxyAppContextEntry(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attempt, String key) throws IOException Remove a context entry for an application attempt in AMRMProxyService.- Parameters:
attempt- attempt IDkey- key string- Throws:
IOException- if fails
-
removeAMRMProxyAppContext
public abstract void removeAMRMProxyAppContext(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attempt) throws IOException Remove the entire context map for an application attempt in AMRMProxyService.- Parameters:
attempt- attempt ID- Throws:
IOException- if fails
-
storeAssignedResources
public abstract void storeAssignedResources(Container container, String resourceType, List<Serializable> assignedResources) throws IOException Store the assigned resources to a container.- Parameters:
container- NMContainerresourceType- Resource TypeassignedResources- Assigned resources- Throws:
IOException- if fails
-
releaseAssignedResources
public void releaseAssignedResources(org.apache.hadoop.yarn.api.records.ContainerId containerId, String resourceType) throws IOException Delete the assigned resources of a container of specific resourceType.- Parameters:
containerId- Container IdresourceType- resource Type- Throws:
IOException- while releasing resources
-
initStorage
- Throws:
IOException
-
startStorage
- Throws:
IOException
-
closeStorage
- Throws:
IOException
-
updateContainerResourceMapping
protected void updateContainerResourceMapping(Container container, String resourceType, List<Serializable> assignedResources)
-