From a38b9e137e67571d2df83a7a9505b66cffefa7c8 Mon Sep 17 00:00:00 2001 From: hunshenshi <289517357@qq.com> Date: Sat, 17 Aug 2019 05:53:06 +0800 Subject: [PATCH] HDFS-14456:HAState#prepareToEnterState neednt a lock (#770) Contributed by hunshenshi. --- .../java/org/apache/hadoop/hdfs/server/namenode/NameNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java index c3107d5317f..15108394914 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java @@ -982,9 +982,9 @@ public class NameNode extends ReconfigurableBase implements try { initializeGenericKeys(conf, nsId, namenodeId); initialize(getConf()); + state.prepareToEnterState(haContext); try { haContext.writeLock(); - state.prepareToEnterState(haContext); state.enterState(haContext); } finally { haContext.writeUnlock();