From b0bfd09c41a1afa2e019f8a2482f1689a348bbde Mon Sep 17 00:00:00 2001 From: ZanderXu Date: Sun, 9 Oct 2022 18:58:09 +0800 Subject: [PATCH] HDFS-16798. HDFS-16798. SerialNumberMap should decrease current counter if the item exist. (#4987). Contributed by ZanderXu. Signed-off-by: He Xiaoqiao --- .../org/apache/hadoop/hdfs/server/namenode/SerialNumberMap.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/SerialNumberMap.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/SerialNumberMap.java index d9a41428b5..ff116b5118 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/SerialNumberMap.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/SerialNumberMap.java @@ -68,6 +68,7 @@ public int get(T t) { } Integer old = t2i.putIfAbsent(t, sn); if (old != null) { + current.getAndDecrement(); return old; } i2t.put(sn, t);