With enabling additional layer of "NodeGroup", the replica placement policy used in BlockPlacementPolicyWithNodeGroup is updated to following rules:
0. No more than one replica is placed within a NodeGroup
1. First replica on the local node.
2. Second and third replicas are within the same rack but remote rack with 1st replica.
3. Other replicas on random nodes with restriction that no more than two replicas are placed in the same rack, if there is enough racks.
Also, this patch abstract Replica Removal Policy from FSNameSystem to BlockPlacementPolicy and update removal policy slightly to remove duplicated replica within the same NodeGroup first when over-replicated happens.