java.io.Closeable, java.lang.AutoCloseable, org.apache.hadoop.service.Service@Private @Unstable public class ZKRMStateStore extends RMStateStore
RMStateStore implementation backed by ZooKeeper.
The znode structure is as follows:
ROOT_DIR_PATH
|--- VERSION_INFO
|--- EPOCH_NODE
|--- RM_ZK_FENCING_LOCK
|--- RM_APP_ROOT
| |----- HIERARCHIES
| | |----- 1
| | | |----- (#ApplicationId barring last character)
| | | | |----- (#Last character of ApplicationId)
| | | | | |----- (#ApplicationAttemptIds)
| | | ....
| | |
| | |----- 2
| | | |----- (#ApplicationId barring last 2 characters)
| | | | |----- (#Last 2 characters of ApplicationId)
| | | | | |----- (#ApplicationAttemptIds)
| | | ....
| | |
| | |----- 3
| | | |----- (#ApplicationId barring last 3 characters)
| | | | |----- (#Last 3 characters of ApplicationId)
| | | | | |----- (#ApplicationAttemptIds)
| | | ....
| | |
| | |----- 4
| | | |----- (#ApplicationId barring last 4 characters)
| | | | |----- (#Last 4 characters of ApplicationId)
| | | | | |----- (#ApplicationAttemptIds)
| | | ....
| | |
| |----- (#ApplicationId1)
| | |----- (#ApplicationAttemptIds)
| |
| |----- (#ApplicationId2)
| | |----- (#ApplicationAttemptIds)
| ....
|
|--- RM_DT_SECRET_MANAGER_ROOT
|----- RM_DT_SEQUENTIAL_NUMBER_ZNODE_NAME
|----- RM_DELEGATION_TOKENS_ROOT_ZNODE_NAME
| |----- 1
| | |----- (#TokenId barring last character)
| | | |----- (#Last character of TokenId)
| | ....
| |----- 2
| | |----- (#TokenId barring last 2 characters)
| | | |----- (#Last 2 characters of TokenId)
| | ....
| |----- 3
| | |----- (#TokenId barring last 3 characters)
| | | |----- (#Last 3 characters of TokenId)
| | ....
| |----- 4
| | |----- (#TokenId barring last 4 characters)
| | | |----- (#Last 4 characters of TokenId)
| | ....
| |----- Token_1
| |----- Token_2
| ....
|
|----- RM_DT_MASTER_KEYS_ROOT_ZNODE_NAME
| |----- Key_1
| |----- Key_2
....
|--- AMRMTOKEN_SECRET_MANAGER_ROOT
|----- currentMasterKey
|----- nextMasterKey
|-- RESERVATION_SYSTEM_ROOT
|------PLAN_1
| |------ RESERVATION_1
| |------ RESERVATION_2
| ....
|------PLAN_2
....
|-- PROXY_CA_ROOT
|----- caCert
|----- caPrivateKey
Note: Changes from 1.1 to 1.2 - AMRMTokenSecretManager state has been saved
separately. The currentMasterkey and nextMasterkey have been stored.
Also, AMRMToken has been removed from ApplicationAttemptState.
Changes from 1.2 to 1.3, Addition of ReservationSystem state.
Changes from 1.3 to 1.4 - Change the structure of application znode by
splitting it in 2 parts, depending on a configurable split index. This limits
the number of application znodes returned in a single call while loading
app state.
Changes from 1.4 to 1.5 - Change the structure of delegation token znode by
splitting it in 2 parts, depending on a configurable split index. This limits
the number of delegation token znodes returned in a single call while loading
tokens state.RMStateStore.ProxyCAState, RMStateStore.RMDTSecretManagerState, RMStateStore.RMState, RMStateStore.RMStateStoreState| Modifier and Type | Field | Description |
|---|---|---|
protected static org.apache.hadoop.yarn.server.records.Version |
CURRENT_VERSION_INFO |
|
protected int |
delegationTokenNodeSplitIndex |
|
protected ZKRMStateStoreOpDurations |
opDurations |
|
static java.lang.String |
RM_APP_ROOT_HIERARCHIES |
|
static java.lang.String |
ROOT_ZNODE_NAME |
|
protected java.lang.String |
znodeWorkingPath |
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_DT_SECRET_MANAGER_ROOT, rmStateStoreEventHandler, VERSION_NODE| Constructor | Description |
|---|---|
ZKRMStateStore() |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
closeInternal() |
Derived classes close themselves using this method.
|
protected java.util.List<org.apache.zookeeper.data.ACL> |
constructZkRootNodeACL(org.apache.hadoop.conf.Configuration conf,
java.util.List<org.apache.zookeeper.data.ACL> sourceACLs) |
Given the
Configuration and ACLs used (sourceACLs) for
ZooKeeper access, construct the ACLs for the store's root node. |
void |
deleteStore() |
Derived classes must implement this method to delete the state store.
|
long |
getAndIncrementEpoch() |
Get the current epoch of RM and increment the value.
|
protected org.apache.hadoop.yarn.server.records.Version |
getCurrentVersion() |
Get the current version of the underlying state store.
|
void |
initInternal(org.apache.hadoop.conf.Configuration conf) |
Derived classes initialize themselves using this method.
|
RMStateStore.RMState |
loadState() |
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.Version |
loadVersion() |
Derived class use this method to load the version information from state
store.
|
void |
removeApplication(org.apache.hadoop.yarn.api.records.ApplicationId removeAppId) |
Derived classes must implement this method to remove application from the
state store.
|
protected void |
removeApplicationAttemptInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId) |
Blocking API
Derived classes must implement this method to remove the state of specified
attempt.
|
protected void |
removeApplicationStateInternal(ApplicationStateData appState) |
Blocking API
Derived classes must implement this method to remove the state of an
application and its attempts.
|
protected void |
removeReservationState(java.lang.String planName,
java.lang.String reservationIdName) |
Blocking API
Derived classes must implement this method to remove the state of
a reservation allocation.
|
protected void |
removeRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDTIdentifier) |
Blocking API
Derived classes must implement this method to remove the state of RMDelegationToken.
|
protected void |
removeRMDTMasterKeyState(org.apache.hadoop.security.token.delegation.DelegationKey delegationKey) |
Blocking API
Derived classes must implement this method to remove the state of
DelegationToken Master Key.
|
void |
startInternal() |
Derived classes start themselves using this method.
|
protected void |
storeApplicationAttemptStateInternal(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.
|
void |
storeApplicationStateInternal(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.
|
protected void |
storeOrUpdateAMRMTokenSecretManagerState(AMRMTokenSecretManagerState amrmTokenSecretManagerState,
boolean isUpdate) |
Blocking API Derived classes must implement this method to store or update
the state of AMRMToken Master Key.
|
protected void |
storeProxyCACertState(java.security.cert.X509Certificate caCert,
java.security.PrivateKey caPrivateKey) |
Blocking API
Derived classes must implement this method to store the CA Certificate
and Private Key.
|
protected void |
storeReservationState(org.apache.hadoop.yarn.proto.YarnProtos.ReservationAllocationStateProto reservationAllocation,
java.lang.String planName,
java.lang.String reservationIdName) |
Blocking API
Derived classes must implement this method to store the state of
a reservation allocation.
|
protected void |
storeRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDTIdentifier,
java.lang.Long renewDate) |
Blocking API
Derived classes must implement this method to store the state of
RMDelegationToken and sequence number.
|
protected void |
storeRMDTMasterKeyState(org.apache.hadoop.security.token.delegation.DelegationKey delegationKey) |
Blocking API
Derived classes must implement this method to store the state of
DelegationToken Master Key.
|
protected void |
storeVersion() |
Derived class use this method to store the version information.
|
protected void |
updateApplicationAttemptStateInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId,
ApplicationAttemptStateData attemptStateDataPB) |
|
protected void |
updateApplicationStateInternal(org.apache.hadoop.yarn.api.records.ApplicationId appId,
ApplicationStateData appStateDataPB) |
|
protected void |
updateRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDTIdentifier,
java.lang.Long renewDate) |
Blocking API
Derived classes must implement this method to update the state of
RMDelegationToken and sequence number.
|
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, updateRMDelegationTokenclose, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop@VisibleForTesting public static final java.lang.String ROOT_ZNODE_NAME
protected static final org.apache.hadoop.yarn.server.records.Version CURRENT_VERSION_INFO
@VisibleForTesting public static final java.lang.String RM_APP_ROOT_HIERARCHIES
@VisibleForTesting protected java.lang.String znodeWorkingPath
@VisibleForTesting protected int delegationTokenNodeSplitIndex
@VisibleForTesting protected ZKRMStateStoreOpDurations opDurations
@VisibleForTesting
@Private
@Unstable
protected java.util.List<org.apache.zookeeper.data.ACL> constructZkRootNodeACL(org.apache.hadoop.conf.Configuration conf,
java.util.List<org.apache.zookeeper.data.ACL> sourceACLs)
throws java.security.NoSuchAlgorithmException
Configuration and ACLs used (sourceACLs) for
ZooKeeper access, construct the ACLs for the store's root node.
In the constructed ACL, all the users allowed by sourceACLs are
given read-write-admin access, while the current RM has exclusive
create-delete access.
To be called only when HA is enabled and the configuration doesn't set an
ACL for the root node.conf - the configurationsourceACLs - the source ACLsjava.security.NoSuchAlgorithmException - thrown if the digest
algorithm used by Zookeeper cannot be foundpublic void initInternal(org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException,
java.security.NoSuchAlgorithmException
RMStateStoreinitInternal in class RMStateStoreconf - Configuration.java.io.IOExceptionjava.security.NoSuchAlgorithmExceptionpublic void startInternal()
throws java.lang.Exception
RMStateStorestartInternal in class RMStateStorejava.lang.Exception - error occur.protected void closeInternal()
throws java.lang.Exception
RMStateStorecloseInternal in class RMStateStorejava.lang.Exception - error occur.protected org.apache.hadoop.yarn.server.records.Version getCurrentVersion()
RMStateStoregetCurrentVersion in class RMStateStoreprotected void storeVersion()
throws java.lang.Exception
RMStateStorestoreVersion in class RMStateStorejava.lang.Exception - error occur.protected org.apache.hadoop.yarn.server.records.Version loadVersion()
throws java.lang.Exception
RMStateStoreloadVersion in class RMStateStorejava.lang.Exception - error occur.public long getAndIncrementEpoch()
throws java.lang.Exception
RMStateStoregetAndIncrementEpoch in class RMStateStorejava.lang.Exception - error occur.public RMStateStore.RMState loadState() throws java.lang.Exception
RMStateStoreloadState in class RMStateStorejava.lang.Exception - error occur.public void storeApplicationStateInternal(org.apache.hadoop.yarn.api.records.ApplicationId appId,
ApplicationStateData appStateDataPB)
throws java.lang.Exception
RMStateStorestoreApplicationStateInternal in class RMStateStoreappId - application Id.appStateDataPB - application StateData.java.lang.Exception - error occur.protected void updateApplicationStateInternal(org.apache.hadoop.yarn.api.records.ApplicationId appId,
ApplicationStateData appStateDataPB)
throws java.lang.Exception
updateApplicationStateInternal in class RMStateStorejava.lang.Exceptionprotected void storeApplicationAttemptStateInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId,
ApplicationAttemptStateData attemptStateDataPB)
throws java.lang.Exception
RMStateStorestoreApplicationAttemptStateInternal in class RMStateStoreappAttemptId - Application AttemptId.attemptStateDataPB - Application AttemptStateData.java.lang.Exception - error occur.protected void updateApplicationAttemptStateInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId,
ApplicationAttemptStateData attemptStateDataPB)
throws java.lang.Exception
updateApplicationAttemptStateInternal in class RMStateStorejava.lang.Exceptionprotected void removeApplicationAttemptInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId)
throws java.lang.Exception
RMStateStoreremoveApplicationAttemptInternal in class RMStateStoreappAttemptId - application attempt id.java.lang.Exception - exception occurs.protected void removeApplicationStateInternal(ApplicationStateData appState) throws java.lang.Exception
RMStateStoreremoveApplicationStateInternal in class RMStateStoreappState - ApplicationStateData.java.lang.Exception - error occurs.protected void storeRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDTIdentifier,
java.lang.Long renewDate)
throws java.lang.Exception
RMStateStorestoreRMDelegationTokenState in class RMStateStorermDTIdentifier - RMDelegationTokenIdentifier.renewDate - token renew date.java.lang.Exception - error occur.protected void removeRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDTIdentifier)
throws java.lang.Exception
RMStateStoreremoveRMDelegationTokenState in class RMStateStorermDTIdentifier - RMDelegationTokenIdentifier.java.lang.Exception - error occurs.protected void updateRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDTIdentifier,
java.lang.Long renewDate)
throws java.lang.Exception
RMStateStoreupdateRMDelegationTokenState in class RMStateStorermDTIdentifier - RMDelegationTokenIdentifier.renewDate - token renew date.java.lang.Exception - error occurs.protected void storeRMDTMasterKeyState(org.apache.hadoop.security.token.delegation.DelegationKey delegationKey)
throws java.lang.Exception
RMStateStorestoreRMDTMasterKeyState in class RMStateStoredelegationKey - DelegationToken Master Key.java.lang.Exception - error occur.protected void removeRMDTMasterKeyState(org.apache.hadoop.security.token.delegation.DelegationKey delegationKey)
throws java.lang.Exception
RMStateStoreremoveRMDTMasterKeyState in class RMStateStoredelegationKey - DelegationKey.java.lang.Exception - exception occurs.public void deleteStore()
throws java.lang.Exception
RMStateStoredeleteStore in class RMStateStorejava.lang.Exception - exception occurs.public void removeApplication(org.apache.hadoop.yarn.api.records.ApplicationId removeAppId)
throws java.lang.Exception
RMStateStoreremoveApplication in class RMStateStoreremoveAppId - application Id.java.lang.Exception - exception occurs.protected void storeOrUpdateAMRMTokenSecretManagerState(AMRMTokenSecretManagerState amrmTokenSecretManagerState, boolean isUpdate) throws java.lang.Exception
RMStateStorestoreOrUpdateAMRMTokenSecretManagerState in class RMStateStoreamrmTokenSecretManagerState - amrmTokenSecretManagerState.isUpdate - true, update; otherwise not update.java.lang.Exception - exception occurs.protected void removeReservationState(java.lang.String planName,
java.lang.String reservationIdName)
throws java.lang.Exception
RMStateStoreremoveReservationState in class RMStateStoreplanName - plan Name.reservationIdName - reservationId Name.java.lang.Exception - exception occurs.protected void storeReservationState(org.apache.hadoop.yarn.proto.YarnProtos.ReservationAllocationStateProto reservationAllocation,
java.lang.String planName,
java.lang.String reservationIdName)
throws java.lang.Exception
RMStateStorestoreReservationState in class RMStateStorereservationAllocation - reservation Allocation.planName - plan Name.reservationIdName - reservationId Name.java.lang.Exception - error occurs.protected void storeProxyCACertState(java.security.cert.X509Certificate caCert,
java.security.PrivateKey caPrivateKey)
throws java.lang.Exception
RMStateStorestoreProxyCACertState in class RMStateStorecaCert - X509Certificate.caPrivateKey - PrivateKey.java.lang.Exception - error occurs.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.