Class StandbyState

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.ha.HAState
org.apache.hadoop.hdfs.server.namenode.ha.StandbyState

@Private public class StandbyState extends HAState
Namenode standby state. In this state the namenode acts as warm standby and keeps the following updated:
  • Namespace by getting the edits.
  • Block location information by receiving block reports and blocks received from the datanodes.
It does not handle read/write/checkpoint operations.
  • Constructor Details

    • StandbyState

      public StandbyState()
    • StandbyState

      public StandbyState(boolean isObserver)
  • Method Details

    • setState

      public void setState(HAContext context, HAState s) throws org.apache.hadoop.ha.ServiceFailedException
      Description copied from class: HAState
      Move from the existing state to a new state
      Overrides:
      setState in class HAState
      Parameters:
      context - HA context
      s - new state
      Throws:
      org.apache.hadoop.ha.ServiceFailedException - on failure to transition to new state.
    • enterState

      public void enterState(HAContext context) throws org.apache.hadoop.ha.ServiceFailedException
      Description copied from class: HAState
      Method to be overridden by subclasses to perform steps necessary for entering a state.
      Specified by:
      enterState in class HAState
      Parameters:
      context - HA context
      Throws:
      org.apache.hadoop.ha.ServiceFailedException - on failure to enter the state.
    • prepareToExitState

      public void prepareToExitState(HAContext context) throws org.apache.hadoop.ha.ServiceFailedException
      Description copied from class: HAState
      Method to be overridden by subclasses to prepare to exit a state. This method is called without the context being locked. This is used by the standby state to cancel any checkpoints that are going on. It can also be used to check any preconditions for the state transition. This method should not make any destructive changes to the state (eg stopping threads) since HAState.prepareToEnterState(HAContext) may subsequently cancel the state transition.
      Overrides:
      prepareToExitState in class HAState
      Parameters:
      context - HA context
      Throws:
      org.apache.hadoop.ha.ServiceFailedException - on precondition failure
    • exitState

      public void exitState(HAContext context) throws org.apache.hadoop.ha.ServiceFailedException
      Description copied from class: HAState
      Method to be overridden by subclasses to perform steps necessary for exiting a state.
      Specified by:
      exitState in class HAState
      Parameters:
      context - HA context
      Throws:
      org.apache.hadoop.ha.ServiceFailedException - on failure to enter the state.
    • checkOperation

      public void checkOperation(HAContext context, NameNode.OperationCategory op) throws org.apache.hadoop.ipc.StandbyException
      Description copied from class: HAState
      Check if an operation is supported in a given state.
      Specified by:
      checkOperation in class HAState
      Parameters:
      context - HA context
      op - Type of the operation.
      Throws:
      org.apache.hadoop.ipc.StandbyException - if a given type of operation is not supported in standby state
    • shouldPopulateReplQueues

      public boolean shouldPopulateReplQueues()
      Specified by:
      shouldPopulateReplQueues in class HAState
    • toString

      public String toString()
      Overrides:
      toString in class HAState
      Returns:
      String representation of the service state.