This is an automated email from the ASF dual-hosted git repository. hexiaoqiao pushed a commit to branch branch-3.3 in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.3 by this push: new 8cc57f5eb12 HDFS-16939. Fix the thread safety bug in LowRedundancyBlocks. (#5450 #5471). Contributed by Shuyan Zhang. 8cc57f5eb12 is described below commit 8cc57f5eb12b853b5d177a7e9647b0973174d1c9 Author: zhangshuyan <81411509+zhangshuy...@users.noreply.github.com> AuthorDate: Sat Mar 11 16:09:06 2023 +0800 HDFS-16939. Fix the thread safety bug in LowRedundancyBlocks. (#5450 #5471). Contributed by Shuyan Zhang. Signed-off-by: He Xiaoqiao <hexiaoq...@apache.org> --- .../hadoop/hdfs/server/blockmanagement/LowRedundancyBlocks.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/LowRedundancyBlocks.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/LowRedundancyBlocks.java index bad51ecc6c7..77480db71ed 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/LowRedundancyBlocks.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/LowRedundancyBlocks.java @@ -86,10 +86,10 @@ class LowRedundancyBlocks implements Iterable<BlockInfo> { private final List<LightWeightLinkedSet<BlockInfo>> priorityQueues = new ArrayList<>(LEVEL); - /** The number of corrupt blocks with replication factor 1 */ private final LongAdder lowRedundancyBlocks = new LongAdder(); private final LongAdder corruptBlocks = new LongAdder(); + /** The number of corrupt blocks with replication factor 1 */ private final LongAdder corruptReplicationOneBlocks = new LongAdder(); private final LongAdder lowRedundancyECBlockGroups = new LongAdder(); private final LongAdder corruptECBlockGroups = new LongAdder(); @@ -367,11 +367,11 @@ class LowRedundancyBlocks implements Iterable<BlockInfo> { * @return true if the block was found and removed from one of the priority * queues */ - boolean remove(BlockInfo block, int priLevel) { + synchronized boolean remove(BlockInfo block, int priLevel) { return remove(block, priLevel, block.getReplication()); } - boolean remove(BlockInfo block, int priLevel, int oldExpectedReplicas) { + synchronized boolean remove(BlockInfo block, int priLevel, int oldExpectedReplicas) { if(priLevel >= 0 && priLevel < LEVEL && priorityQueues.get(priLevel).remove(block)) { NameNode.blockStateChangeLog.debug( --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org