Class NameNode.NameNodeHAContext

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.NameNode.NameNodeHAContext
All Implemented Interfaces:
HAContext
Enclosing class:
NameNode

protected class NameNode.NameNodeHAContext extends Object implements HAContext
Class used to expose NameNode as context to HAState
  • Constructor Details

    • NameNodeHAContext

      protected NameNodeHAContext()
  • Method Details

    • setState

      public void setState(HAState s)
      Description copied from interface: HAContext
      Set the state of the context to given state
      Specified by:
      setState in interface HAContext
    • getState

      public HAState getState()
      Description copied from interface: HAContext
      Get the state from the context
      Specified by:
      getState in interface HAContext
    • startActiveServices

      public void startActiveServices() throws IOException
      Description copied from interface: HAContext
      Start the services required in active state
      Specified by:
      startActiveServices in interface HAContext
      Throws:
      IOException
    • stopActiveServices

      public void stopActiveServices() throws IOException
      Description copied from interface: HAContext
      Stop the services when exiting active state
      Specified by:
      stopActiveServices in interface HAContext
      Throws:
      IOException
    • startStandbyServices

      public void startStandbyServices() throws IOException
      Description copied from interface: HAContext
      Start the services required in standby state
      Specified by:
      startStandbyServices in interface HAContext
      Throws:
      IOException
    • prepareToStopStandbyServices

      public void prepareToStopStandbyServices() throws org.apache.hadoop.ha.ServiceFailedException
      Description copied from interface: HAContext
      Prepare to exit the standby state
      Specified by:
      prepareToStopStandbyServices in interface HAContext
      Throws:
      org.apache.hadoop.ha.ServiceFailedException
    • stopStandbyServices

      public void stopStandbyServices() throws IOException
      Description copied from interface: HAContext
      Stop the services when exiting standby state
      Specified by:
      stopStandbyServices in interface HAContext
      Throws:
      IOException
    • writeLock

      public void writeLock()
      Description copied from interface: HAContext
      Take a write-lock on the underlying namesystem so that no concurrent state transitions or edits can be made.
      Specified by:
      writeLock in interface HAContext
    • writeUnlock

      public void writeUnlock()
      Description copied from interface: HAContext
      Unlock the lock taken by HAContext.writeLock()
      Specified by:
      writeUnlock in interface HAContext
    • checkOperation

      public void checkOperation(NameNode.OperationCategory op) throws org.apache.hadoop.ipc.StandbyException
      Check if an operation of given category is allowed
      Specified by:
      checkOperation in interface HAContext
      Throws:
      org.apache.hadoop.ipc.StandbyException
    • allowStaleReads

      public boolean allowStaleReads()
      Specified by:
      allowStaleReads in interface HAContext
      Returns:
      true if the node should allow stale reads (ie reads while the namespace is not up to date)