Current rule of default block placement policy:
The replica placement strategy is that if the writer is on a datanode,
the 1st replica is placed on the local machine,
otherwise a random datanode. The 2nd replica is placed on a datanode
that is on a different rack. The 3rd replica is placed on a datanode
which is on a different node of the rack as the second replica.
if the writer is on a datanode, the 1st replica is placed on the local machine, actually this can be decided by the hdfs client. The client can pass CreateFlag#NO_LOCAL_WRITE that request to not put a block replica on the local datanode. But subsequent replicas will still follow default block placement policy.