Class DiskBalancerWorkItem

java.lang.Object
org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkItem

@Private @Unstable public class DiskBalancerWorkItem extends Object
Keeps track of how much work has finished.
  • Constructor Details

    • DiskBalancerWorkItem

      public DiskBalancerWorkItem()
      Empty constructor for Json serialization.
    • DiskBalancerWorkItem

      public DiskBalancerWorkItem(long bytesToCopy, long bytesCopied)
      Constructs a DiskBalancerWorkItem.
      Parameters:
      bytesToCopy - - Total bytes to copy from a disk
      bytesCopied - - Copied So far.
  • Method Details

    • parseJson

      public static DiskBalancerWorkItem parseJson(String json) throws IOException
      Reads a DiskBalancerWorkItem Object from a Json String.
      Parameters:
      json - - Json String.
      Returns:
      DiskBalancerWorkItem Object
      Throws:
      IOException
    • getErrMsg

      public String getErrMsg()
      Gets the error message.
    • setErrMsg

      public void setErrMsg(String errMsg)
      Sets the error message.
      Parameters:
      errMsg - - Msg.
    • getErrorCount

      public long getErrorCount()
      Returns the number of errors encountered.
      Returns:
      long
    • incErrorCount

      public void incErrorCount()
      Incs Error Count.
    • getBytesCopied

      public long getBytesCopied()
      Returns bytes copied so far.
      Returns:
      long
    • setBytesCopied

      public void setBytesCopied(long bytesCopied)
      Sets bytes copied so far.
      Parameters:
      bytesCopied - - long
    • incCopiedSoFar

      public void incCopiedSoFar(long delta)
      Increments bytesCopied by delta.
      Parameters:
      delta - - long
    • getBytesToCopy

      public long getBytesToCopy()
      Returns bytes to copy.
      Returns:
      - long
    • getBlocksCopied

      public long getBlocksCopied()
      Returns number of blocks copied for this DiskBalancerWorkItem.
      Returns:
      long count of blocks.
    • incBlocksCopied

      public void incBlocksCopied()
      increments the number of blocks copied.
    • toJson

      public String toJson() throws IOException
      returns a serialized json string.
      Returns:
      String - json
      Throws:
      IOException
    • setErrorCount

      public void setErrorCount(long errorCount)
      Sets the Error counts for this step.
      Parameters:
      errorCount - long.
    • setBlocksCopied

      public void setBlocksCopied(long blocksCopied)
      Number of blocks copied so far.
      Parameters:
      blocksCopied - Blocks copied.
    • getMaxDiskErrors

      public long getMaxDiskErrors()
      Gets maximum disk errors to tolerate before we fail this copy step.
      Returns:
      long.
    • setMaxDiskErrors

      public void setMaxDiskErrors(long maxDiskErrors)
      Sets maximum disk errors to tolerate before we fail this copy step.
      Parameters:
      maxDiskErrors - long
    • getTolerancePercent

      public long getTolerancePercent()
      Allowed deviation from ideal storage in percentage.
      Returns:
      long
    • setTolerancePercent

      public void setTolerancePercent(long tolerancePercent)
      Sets the tolerance percentage.
      Parameters:
      tolerancePercent - - tolerance.
    • getBandwidth

      public long getBandwidth()
      Max disk bandwidth to use. MB per second.
      Returns:
      - long.
    • setBandwidth

      public void setBandwidth(long bandwidth)
      Sets max disk bandwidth to use, in MBs per second.
      Parameters:
      bandwidth - - long.
    • getStartTime

      public long getStartTime()
      Records the Start time of execution.
      Returns:
      startTime
    • setStartTime

      public void setStartTime(long startTime)
      Sets the Start time.
      Parameters:
      startTime - - Time stamp for start of execution.
    • getSecondsElapsed

      public long getSecondsElapsed()
      Gets the number of seconds elapsed from the start time. The reason why we have this is of time skews. The client's current time may not match with the server time stamp, hence the elapsed second cannot be computed from only startTime.
      Returns:
      seconds elapsed from start time.
    • setSecondsElapsed

      public void setSecondsElapsed(long secondsElapsed)
      Sets number of seconds elapsed. This is updated whenever we update the other counters.
      Parameters:
      secondsElapsed - - seconds elapsed.