You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by in...@apache.org on 2019/03/15 21:04:00 UTC
[hadoop] branch branch-2.9 updated: HDFS-14366. Improve HDFS append
performance. Contributed by Chao Sun.
This is an automated email from the ASF dual-hosted git repository.
inigoiri pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-2.9 by this push:
new 1ad2613 HDFS-14366. Improve HDFS append performance. Contributed by Chao Sun.
1ad2613 is described below
commit 1ad2613f42c0e1671576f477ccbba496ef58eef2
Author: Inigo Goiri <in...@apache.org>
AuthorDate: Fri Mar 15 11:06:42 2019 -0700
HDFS-14366. Improve HDFS append performance. Contributed by Chao Sun.
(cherry picked from commit ff06ef0631cb8a0f67bbc39b5b5a1b0a81ca3b3c)
---
.../hadoop/hdfs/server/blockmanagement/BlockManager.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
index ccd5931..0d4c948 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
@@ -1256,9 +1256,13 @@ public class BlockManager implements BlockStatsMXBean {
*/
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. */
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org