Class DiskBalancer.DiskBalancerMover
java.lang.Object
org.apache.hadoop.hdfs.server.datanode.DiskBalancer.DiskBalancerMover
- All Implemented Interfaces:
DiskBalancer.BlockMover
- Enclosing class:
- DiskBalancer
public static class DiskBalancer.DiskBalancerMover
extends Object
implements DiskBalancer.BlockMover
Actual DataMover class for DiskBalancer.
-
Constructor Summary
ConstructorsConstructorDescriptionDiskBalancerMover(FsDatasetSpi dataset, org.apache.hadoop.conf.Configuration conf) Constructs diskBalancerMover. -
Method Summary
Modifier and TypeMethodDescriptionlongcomputeDelay(long bytesCopied, long timeUsed, org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkItem item) Computes sleep delay needed based on the block that just got copied. we copy using a burst mode, that is we let the copy proceed in full throttle.voidcopyBlocks(DiskBalancer.VolumePair pair, org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkItem item) Copies blocks from a set of volumes.Returns a pointer to the current dataset we are operating against.longNumber of seconds elapsed.longReturns time when this plan started executing.voidSignals copy block to exit.voidSets Diskmover copyblocks into runnable state.booleanReturns the shouldRun boolean flag.
-
Constructor Details
-
DiskBalancerMover
Constructs diskBalancerMover.- Parameters:
dataset- Datasetconf- Configuration
-
-
Method Details
-
setRunnable
public void setRunnable()Sets Diskmover copyblocks into runnable state.- Specified by:
setRunnablein interfaceDiskBalancer.BlockMover
-
setExitFlag
public void setExitFlag()Signals copy block to exit.- Specified by:
setExitFlagin interfaceDiskBalancer.BlockMover
-
shouldRun
public boolean shouldRun()Returns the shouldRun boolean flag. -
computeDelay
@VisibleForTesting public long computeDelay(long bytesCopied, long timeUsed, org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkItem item) Computes sleep delay needed based on the block that just got copied. we copy using a burst mode, that is we let the copy proceed in full throttle. Once a copy is done, we compute how many bytes have been transferred and try to average it over the user specified bandwidth. In other words, This code implements a poor man's token bucket algorithm for traffic shaping.- Parameters:
bytesCopied- - byteCopied.timeUsed- in millisecondsitem- DiskBalancerWorkItem- Returns:
- sleep delay in Milliseconds.
-
copyBlocks
public void copyBlocks(DiskBalancer.VolumePair pair, org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkItem item) Copies blocks from a set of volumes.- Specified by:
copyBlocksin interfaceDiskBalancer.BlockMover- Parameters:
pair- - Source and Destination Volumes.item- - Number of bytes to move from volumes.
-
getDataset
Returns a pointer to the current dataset we are operating against.- Specified by:
getDatasetin interfaceDiskBalancer.BlockMover- Returns:
- FsDatasetSpi
-
getStartTime
public long getStartTime()Returns time when this plan started executing.- Specified by:
getStartTimein interfaceDiskBalancer.BlockMover- Returns:
- Start time in milliseconds.
-
getElapsedSeconds
public long getElapsedSeconds()Number of seconds elapsed.- Specified by:
getElapsedSecondsin interfaceDiskBalancer.BlockMover- Returns:
- time in seconds
-