Class MemoryRMStateStore

java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore
org.apache.hadoop.yarn.server.resourcemanager.recovery.MemoryRMStateStore
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hadoop.service.Service

@Private @Unstable public class MemoryRMStateStore extends RMStateStore
  • Constructor Details

    • MemoryRMStateStore

      public MemoryRMStateStore()
  • Method Details

    • getState

      @VisibleForTesting public RMStateStore.RMState getState()
    • checkVersion

      public void checkVersion() throws Exception
      Description copied from class: RMStateStore
      1) Versioning scheme: major.minor. For e.g. 1.0, 1.1, 1.2...1.25, 2.0 etc. 2) Any incompatible change of state-store is a major upgrade, and any compatible change of state-store is a minor upgrade. 3) If theres's no version, treat it as CURRENT_VERSION_INFO. 4) Within a minor upgrade, say 1.1 to 1.2: overwrite the version info and proceed as normal. 5) Within a major upgrade, say 1.2 to 2.0: throw exception and indicate user to use a separate upgrade tool to upgrade RM state.
      Overrides:
      checkVersion in class RMStateStore
      Throws:
      Exception - error occur.
    • getAndIncrementEpoch

      public long getAndIncrementEpoch() throws Exception
      Description copied from class: RMStateStore
      Get the current epoch of RM and increment the value.
      Specified by:
      getAndIncrementEpoch in class RMStateStore
      Returns:
      current epoch.
      Throws:
      Exception - error occur.
    • loadState

      public RMStateStore.RMState loadState() throws Exception
      Description copied from class: RMStateStore
      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.
      Specified by:
      loadState in class RMStateStore
      Returns:
      RMState.
      Throws:
      Exception - error occur.
    • initInternal

      public void initInternal(org.apache.hadoop.conf.Configuration conf)
      Description copied from class: RMStateStore
      Derived classes initialize themselves using this method.
      Specified by:
      initInternal in class RMStateStore
      Parameters:
      conf - Configuration.
    • startInternal

      protected void startInternal() throws Exception
      Description copied from class: RMStateStore
      Derived classes start themselves using this method. The base class is started and the event dispatcher is ready to use at this point.
      Specified by:
      startInternal in class RMStateStore
      Throws:
      Exception - error occur.
    • closeInternal

      protected void closeInternal() throws Exception
      Description copied from class: RMStateStore
      Derived classes close themselves using this method. The base class will be closed and the event dispatcher will be shutdown after this.
      Specified by:
      closeInternal in class RMStateStore
      Throws:
      Exception - error occur.
    • storeApplicationStateInternal

      public void storeApplicationStateInternal(org.apache.hadoop.yarn.api.records.ApplicationId appId, ApplicationStateData appState) throws Exception
      Description copied from class: RMStateStore
      Blocking API Derived classes must implement this method to store the state of an application.
      Specified by:
      storeApplicationStateInternal in class RMStateStore
      Parameters:
      appId - application Id.
      appState - application StateData.
      Throws:
      Exception - error occur.
    • updateApplicationStateInternal

      public void updateApplicationStateInternal(org.apache.hadoop.yarn.api.records.ApplicationId appId, ApplicationStateData appState) throws Exception
      Specified by:
      updateApplicationStateInternal in class RMStateStore
      Throws:
      Exception
    • storeApplicationAttemptStateInternal

      public void storeApplicationAttemptStateInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, ApplicationAttemptStateData attemptState) throws Exception
      Description copied from class: RMStateStore
      Blocking API Derived classes must implement this method to store the state of an application attempt.
      Specified by:
      storeApplicationAttemptStateInternal in class RMStateStore
      Parameters:
      appAttemptId - Application AttemptId.
      attemptState - Application AttemptStateData.
      Throws:
      Exception - error occur.
    • updateApplicationAttemptStateInternal

      public void updateApplicationAttemptStateInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, ApplicationAttemptStateData attemptState) throws Exception
      Specified by:
      updateApplicationAttemptStateInternal in class RMStateStore
      Throws:
      Exception
    • removeApplicationAttemptInternal

      public void removeApplicationAttemptInternal(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId) throws Exception
      Description copied from class: RMStateStore
      Blocking API Derived classes must implement this method to remove the state of specified attempt.
      Specified by:
      removeApplicationAttemptInternal in class RMStateStore
      Parameters:
      appAttemptId - application attempt id.
      Throws:
      Exception - exception occurs.
    • removeApplicationStateInternal

      public void removeApplicationStateInternal(ApplicationStateData appState) throws Exception
      Description copied from class: RMStateStore
      Blocking API Derived classes must implement this method to remove the state of an application and its attempts.
      Specified by:
      removeApplicationStateInternal in class RMStateStore
      Parameters:
      appState - ApplicationStateData.
      Throws:
      Exception - error occurs.
    • storeRMDelegationTokenState

      public void storeRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDTIdentifier, Long renewDate) throws Exception
      Description copied from class: RMStateStore
      Blocking API Derived classes must implement this method to store the state of RMDelegationToken and sequence number.
      Specified by:
      storeRMDelegationTokenState in class RMStateStore
      Parameters:
      rmDTIdentifier - RMDelegationTokenIdentifier.
      renewDate - token renew date.
      Throws:
      Exception - error occur.
    • removeRMDelegationTokenState

      public void removeRMDelegationTokenState(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDTIdentifier) throws Exception
      Description copied from class: RMStateStore
      Blocking API Derived classes must implement this method to remove the state of RMDelegationToken.
      Specified by:
      removeRMDelegationTokenState in class RMStateStore
      Parameters:
      rmDTIdentifier - 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: RMStateStore
      Blocking API Derived classes must implement this method to update the state of RMDelegationToken and sequence number.
      Specified by:
      updateRMDelegationTokenState in class RMStateStore
      Parameters:
      rmDTIdentifier - RMDelegationTokenIdentifier.
      renewDate - token renew date.
      Throws:
      Exception - error occurs.
    • storeRMDTMasterKeyState

      public void storeRMDTMasterKeyState(org.apache.hadoop.security.token.delegation.DelegationKey delegationKey) throws Exception
      Description copied from class: RMStateStore
      Blocking API Derived classes must implement this method to store the state of DelegationToken Master Key.
      Specified by:
      storeRMDTMasterKeyState in class RMStateStore
      Parameters:
      delegationKey - DelegationToken Master Key.
      Throws:
      Exception - error occur.
    • removeRMDTMasterKeyState

      public void removeRMDTMasterKeyState(org.apache.hadoop.security.token.delegation.DelegationKey delegationKey) throws Exception
      Description copied from class: RMStateStore
      Blocking API Derived classes must implement this method to remove the state of DelegationToken Master Key.
      Specified by:
      removeRMDTMasterKeyState in class RMStateStore
      Parameters:
      delegationKey - DelegationKey.
      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: RMStateStore
      Blocking API Derived classes must implement this method to store the state of a reservation allocation.
      Specified by:
      storeReservationState in class RMStateStore
      Parameters:
      reservationAllocation - reservation Allocation.
      planName - plan Name.
      reservationIdName - reservationId Name.
      Throws:
      Exception - error occurs.
    • removeReservationState

      protected void removeReservationState(String planName, String reservationIdName) throws Exception
      Description copied from class: RMStateStore
      Blocking API Derived classes must implement this method to remove the state of a reservation allocation.
      Specified by:
      removeReservationState in class RMStateStore
      Parameters:
      planName - plan Name.
      reservationIdName - reservationId Name.
      Throws:
      Exception - exception occurs.
    • storeProxyCACertState

      protected void storeProxyCACertState(X509Certificate caCert, PrivateKey caPrivateKey) throws Exception
      Description copied from class: RMStateStore
      Blocking API Derived classes must implement this method to store the CA Certificate and Private Key.
      Specified by:
      storeProxyCACertState in class RMStateStore
      Parameters:
      caCert - X509Certificate.
      caPrivateKey - PrivateKey.
      Throws:
      Exception - error occurs.
    • loadVersion

      protected org.apache.hadoop.yarn.server.records.Version loadVersion() throws Exception
      Description copied from class: RMStateStore
      Derived class use this method to load the version information from state store.
      Specified by:
      loadVersion in class RMStateStore
      Returns:
      current version.
      Throws:
      Exception - error occur.
    • storeVersion

      protected void storeVersion() throws Exception
      Description copied from class: RMStateStore
      Derived class use this method to store the version information.
      Specified by:
      storeVersion in class RMStateStore
      Throws:
      Exception - error occur.
    • getCurrentVersion

      protected org.apache.hadoop.yarn.server.records.Version getCurrentVersion()
      Description copied from class: RMStateStore
      Get the current version of the underlying state store.
      Specified by:
      getCurrentVersion in class RMStateStore
      Returns:
      current version.
    • storeOrUpdateAMRMTokenSecretManagerState

      public void storeOrUpdateAMRMTokenSecretManagerState(AMRMTokenSecretManagerState amrmTokenSecretManagerState, boolean isUpdate)
      Description copied from class: RMStateStore
      Blocking API Derived classes must implement this method to store or update the state of AMRMToken Master Key.
      Specified by:
      storeOrUpdateAMRMTokenSecretManagerState in class RMStateStore
      Parameters:
      amrmTokenSecretManagerState - amrmTokenSecretManagerState.
      isUpdate - true, update; otherwise not update.
    • deleteStore

      public void deleteStore() throws Exception
      Description copied from class: RMStateStore
      Derived classes must implement this method to delete the state store.
      Specified by:
      deleteStore in class RMStateStore
      Throws:
      Exception - exception occurs.
    • removeApplication

      public void removeApplication(org.apache.hadoop.yarn.api.records.ApplicationId removeAppId) throws Exception
      Description copied from class: RMStateStore
      Derived classes must implement this method to remove application from the state store.
      Specified by:
      removeApplication in class RMStateStore
      Parameters:
      removeAppId - application Id.
      Throws:
      Exception - exception occurs.