}
} while (num.liveReplicas() != REPLICATION_FACTOR);
LOG.info("Restarting first DN");
// restart the first datanode
cluster.restartDataNode(dnprop);
cluster.waitActive(false);
// check if excessive replica is detected
LOG.info("Waiting for excess replicas to be detected");
waitForExcessReplicasToChange(namesystem, block, 2);
} finally {