HDFS-14366. Improve HDFS append performance. Contributed by Chao Sun.
This commit is contained in:
parent
d1afa03804
commit
ff06ef0631
@ -1484,9 +1484,13 @@ public void verifyReplication(String src,
|
||||
*/
|
||||
public boolean isSufficientlyReplicated(BlockInfo b) {
|
||||
// Compare against the lesser of the minReplication and number of live DNs.
|
||||
final int replication =
|
||||
Math.min(minReplication, getDatanodeManager().getNumLiveDataNodes());
|
||||
return countNodes(b).liveReplicas() >= replication;
|
||||
final int liveReplicas = countNodes(b).liveReplicas();
|
||||
if (liveReplicas >= minReplication) {
|
||||
return true;
|
||||
}
|
||||
// getNumLiveDataNodes() is very expensive and we minimize its use by
|
||||
// comparing with minReplication first.
|
||||
return liveReplicas >= getDatanodeManager().getNumLiveDataNodes();
|
||||
}
|
||||
|
||||
/** Get all blocks with location information from a datanode. */
|
||||
|
Loading…
Reference in New Issue
Block a user