java.lang.Object
org.apache.hadoop.hdfs.server.diskbalancer.planner.MoveStep
All Implemented Interfaces:
Step

public class MoveStep extends Object implements Step
Ignore fields with default values. In most cases Throughtput, diskErrors tolerancePercent and bandwidth will be the system defaults. So we will avoid serializing them into JSON.
  • Constructor Details

    • MoveStep

      public MoveStep(DiskBalancerVolume sourceVolume, double idealStorage, DiskBalancerVolume destinationVolume, long bytesToMove, String volumeSetID)
      Constructs a MoveStep for the volume set.
      Parameters:
      sourceVolume - - Source Disk
      idealStorage - - Ideal Storage Value for this disk set
      destinationVolume - - Destination dis
      bytesToMove - - number of bytes to move
      volumeSetID - - a diskBalancer generated id.
    • MoveStep

      public MoveStep()
      Empty Constructor for JSON serialization.
  • Method Details

    • getBytesToMove

      public long getBytesToMove()
      Returns number of bytes to move.
      Specified by:
      getBytesToMove in interface Step
      Returns:
      - long
    • getDestinationVolume

      public DiskBalancerVolume getDestinationVolume()
      Gets the destination volume.
      Specified by:
      getDestinationVolume in interface Step
      Returns:
      - volume
    • getIdealStorage

      public double getIdealStorage()
      Gets the IdealStorage.
      Specified by:
      getIdealStorage in interface Step
      Returns:
      float
    • getSourceVolume

      public DiskBalancerVolume getSourceVolume()
      Gets Source Volume.
      Specified by:
      getSourceVolume in interface Step
      Returns:
      -- Source Volume
    • getVolumeSetID

      public String getVolumeSetID()
      Gets a volume Set ID.
      Specified by:
      getVolumeSetID in interface Step
      Returns:
      String
    • setSourceVolume

      public void setSourceVolume(DiskBalancerVolume sourceVolume)
      Set source volume.
      Parameters:
      sourceVolume - - volume
    • setDestinationVolume

      public void setDestinationVolume(DiskBalancerVolume destinationVolume)
      Sets destination volume.
      Parameters:
      destinationVolume - - volume
    • setIdealStorage

      public void setIdealStorage(double idealStorage)
      Sets Ideal Storage.
      Parameters:
      idealStorage - - ideal Storage
    • setBytesToMove

      public void setBytesToMove(long bytesToMove)
      Sets bytes to move.
      Parameters:
      bytesToMove - - number of bytes
    • setVolumeSetID

      public void setVolumeSetID(String volumeSetID)
      Sets volume id.
      Parameters:
      volumeSetID - - volume ID
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.
    • getSizeString

      public String getSizeString(long size)
      Returns human readable move sizes.
      Specified by:
      getSizeString in interface Step
      Parameters:
      size - - bytes being moved.
      Returns:
      String
    • getMaxDiskErrors

      public long getMaxDiskErrors()
      Gets Maximum numbers of errors to be tolerated before this move operation is aborted.
      Specified by:
      getMaxDiskErrors in interface Step
      Returns:
      long.
    • setMaxDiskErrors

      public void setMaxDiskErrors(long maxDiskErrors)
      Sets the maximum numbers of Errors to be tolerated before this step is aborted.
      Specified by:
      setMaxDiskErrors in interface Step
      Parameters:
      maxDiskErrors - - long
    • getTolerancePercent

      public long getTolerancePercent()
      Tolerance Percentage indicates when a move operation is considered good enough. This is a percentage of deviation from ideal that is considered fine. For example : if the ideal amount on each disk was 1 TB and the tolerance was 10%, then getting to 900 GB on the destination disk is considered good enough.
      Specified by:
      getTolerancePercent in interface Step
      Returns:
      tolerance percentage.
    • setTolerancePercent

      public void setTolerancePercent(long tolerancePercent)
      Sets the tolerance percentage.
      Specified by:
      setTolerancePercent in interface Step
      Parameters:
      tolerancePercent - - long
    • getBandwidth

      public long getBandwidth()
      Gets the disk Bandwidth. That is the MB/Sec to copied. We will max out on this amount of throughput. This is useful to prevent too much I/O on datanode while data node is in use.
      Specified by:
      getBandwidth in interface Step
      Returns:
      long.
    • setBandwidth

      public void setBandwidth(long bandwidth)
      Sets the maximum disk bandwidth per sec to use for this step.
      Specified by:
      setBandwidth in interface Step
      Parameters:
      bandwidth - - Long, MB / Sec of data to be moved between source and destinatin volume.