Block move scheduling
For each source-target pair, the HDFS Balancer chooses block replicas from the source storage groups and schedules block moves.
A block replica in a source DataNode is a good candidate if it satisfies all of the following conditions:
The storage type of the block replica in the source DataNode is the same as the target storage type.
The storage type of the block replica is not already scheduled.
The target does not already have the same block replica.
The number of racks of the block is not reduced after the move.
Logically, the HDFS Balancer schedules a block replica to be “moved” from a source storage group to a target storage group. In practice, a block usually has multiple replicas. The block move can be done by first copying the replica from a proxy, which can be any storage group containing one of the replicas of the block, to the target storage group, and then deleting the replica in the source storage group.
After a candidate block in the source DataNode is specified, the HDFS Balancer selects a storage group containing the same replica as the proxy. The HDFS Balancer selects the closest storage group as the proxy in order to minimize the network traffic.
When it is impossible to schedule a move, the HDFS Balancer terminates with a
NO_MOVE_BLOCK exit status.