Class DiskBalancerWorkItem
java.lang.Object
org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkItem
Keeps track of how much work has finished.
-
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor for Json serialization.DiskBalancerWorkItem(long bytesToCopy, long bytesCopied) Constructs a DiskBalancerWorkItem. -
Method Summary
Modifier and TypeMethodDescriptionlongMax disk bandwidth to use.longReturns number of blocks copied for this DiskBalancerWorkItem.longReturns bytes copied so far.longReturns bytes to copy.Gets the error message.longReturns the number of errors encountered.longGets maximum disk errors to tolerate before we fail this copy step.longGets the number of seconds elapsed from the start time.longRecords the Start time of execution.longAllowed deviation from ideal storage in percentage.voidincrements the number of blocks copied.voidincCopiedSoFar(long delta) Increments bytesCopied by delta.voidIncs Error Count.static DiskBalancerWorkItemReads a DiskBalancerWorkItem Object from a Json String.voidsetBandwidth(long bandwidth) Sets max disk bandwidth to use, in MBs per second.voidsetBlocksCopied(long blocksCopied) Number of blocks copied so far.voidsetBytesCopied(long bytesCopied) Sets bytes copied so far.voidSets the error message.voidsetErrorCount(long errorCount) Sets the Error counts for this step.voidsetMaxDiskErrors(long maxDiskErrors) Sets maximum disk errors to tolerate before we fail this copy step.voidsetSecondsElapsed(long secondsElapsed) Sets number of seconds elapsed.voidsetStartTime(long startTime) Sets the Start time.voidsetTolerancePercent(long tolerancePercent) Sets the tolerance percentage.toJson()returns a serialized json string.
-
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 diskbytesCopied- - Copied So far.
-
-
Method Details
-
parseJson
Reads a DiskBalancerWorkItem Object from a Json String.- Parameters:
json- - Json String.- Returns:
- DiskBalancerWorkItem Object
- Throws:
IOException
-
getErrMsg
Gets the error message. -
setErrMsg
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
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.
-