Class StoragePolicySatisfyManager

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.sps.StoragePolicySatisfyManager

public class StoragePolicySatisfyManager extends Object
This manages satisfy storage policy invoked path ids and expose methods to process these path ids. It maintains sps mode(EXTERNAL/NONE) configured by the administrator.

If the configured mode is HdfsConstants.StoragePolicySatisfierMode.EXTERNAL, then it won't do anything, just maintains the sps invoked path ids. Administrator requires to start external sps service explicitly, to fetch the sps invoked path ids from namenode, then do necessary computations and block movement in order to satisfy the storage policy. Please refer ExternalStoragePolicySatisfier class to understand more about the external sps service functionality.

If the configured mode is HdfsConstants.StoragePolicySatisfierMode.NONE, then it will disable the sps feature completely by clearing all queued up sps path's hint. This class is instantiated by the BlockManager.

  • Constructor Details

    • StoragePolicySatisfyManager

      public StoragePolicySatisfyManager(org.apache.hadoop.conf.Configuration conf, Namesystem namesystem)
  • Method Details

    • start

      public void start()
      This function will do following logic based on the configured sps mode:

      If the configured mode is HdfsConstants.StoragePolicySatisfierMode.EXTERNAL, then it won't do anything. Administrator requires to start external sps service explicitly.

      If the configured mode is HdfsConstants.StoragePolicySatisfierMode.NONE, then the service is disabled and won't do any action.

    • stop

      public void stop()
      This function will do following logic based on the configured sps mode:

      If the configured mode is HdfsConstants.StoragePolicySatisfierMode.EXTERNAL, then it won't do anything. Administrator requires to stop external sps service explicitly, if needed.

      If the configured mode is HdfsConstants.StoragePolicySatisfierMode.NONE, then the service is disabled and won't do any action.

    • changeModeEvent

      public void changeModeEvent(org.apache.hadoop.hdfs.protocol.HdfsConstants.StoragePolicySatisfierMode newMode)
      Sets new sps mode. If the new mode is none, then it will disable the sps feature completely by clearing all queued up sps path's hint.
    • isSatisfierRunning

      @VisibleForTesting public boolean isSatisfierRunning()
      Returns:
      true if the internal storage policy satisfier daemon is running, false otherwise.
    • getNextPathId

      public Long getNextPathId()
      Returns:
      the next SPS path id, on which path users has invoked to satisfy storages.
    • verifyOutstandingPathQLimit

      public void verifyOutstandingPathQLimit() throws IOException
      Verify that satisfier queue limit exceeds allowed outstanding limit.
      Throws:
      IOException
    • removeAllPathIds

      public void removeAllPathIds()
      Clean up all sps path ids.
    • addPathId

      public void addPathId(long id)
      Adds the sps path to SPSPathIds list.
      Parameters:
      id -
    • isEnabled

      public boolean isEnabled()
      Returns:
      true if sps is configured as an external service, false otherwise.
    • getMode

      public org.apache.hadoop.hdfs.protocol.HdfsConstants.StoragePolicySatisfierMode getMode()
      Returns:
      sps service mode.
    • getPendingSPSPaths

      public int getPendingSPSPaths()
      Returns:
      the number of paths to be processed by storage policy satisfier.