Repository: hadoop Updated Branches: refs/heads/branch-3.1 dd445e036 -> 665036c5f
HDFS-13962. Add null check for add-replica pool to avoid lock acquiring. Contributed by Surendra Singh Lilhore. (cherry picked from commit 1043795f7fe44c98a34f8ea3cea708c801c3043b) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/665036c5 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/665036c5 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/665036c5 Branch: refs/heads/branch-3.1 Commit: 665036c5f71f6ce7ea331706ae1deb56da0fd0eb Parents: dd445e0 Author: Yiqun Lin <yq...@apache.org> Authored: Tue Oct 9 10:33:13 2018 +0800 Committer: Yiqun Lin <yq...@apache.org> Committed: Tue Oct 9 10:36:45 2018 +0800 ---------------------------------------------------------------------- .../hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java | 6 ++++-- .../hadoop/hdfs/server/datanode/fsdataset/impl/ReplicaMap.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/665036c5/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java index d7e56fd..e725834 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/BlockPoolSlice.java @@ -183,8 +183,10 @@ class BlockPoolSlice { .setConf(conf) .setInitialUsed(loadDfsUsed()) .build(); - // initialize add replica fork join pool - initializeAddReplicaPool(conf); + if (addReplicaThreadPool == null) { + // initialize add replica fork join pool + initializeAddReplicaPool(conf); + } // Make the dfs usage to be saved during shutdown. shutdownHook = new Runnable() { @Override http://git-wip-us.apache.org/repos/asf/hadoop/blob/665036c5/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/ReplicaMap.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/ReplicaMap.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/ReplicaMap.java index c630b95..73d3c60 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/ReplicaMap.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/ReplicaMap.java @@ -154,7 +154,7 @@ class ReplicaMap { if (oldReplicaInfo != null) { return oldReplicaInfo; } else { - set.add(replicaInfo); + set.addOrReplace(replicaInfo); } return replicaInfo; } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org