From 99f6e064d4d080ea220c7934ce190d87573576c0 Mon Sep 17 00:00:00 2001 From: hunshenshi <289517357@qq.com> Date: Tue, 12 Mar 2019 17:28:28 +0800 Subject: [PATCH] HDFS-14361:SNN will always upload fsimage --- .../hadoop/hdfs/server/namenode/ha/StandbyCheckpointer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/StandbyCheckpointer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/StandbyCheckpointer.java index 6f8ce91ee4c19..6f61e14de7135 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/StandbyCheckpointer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/StandbyCheckpointer.java @@ -165,6 +165,8 @@ private void doCheckpoint(boolean sendCheckpoint) throws InterruptedException, I // Acquire cpLock to make sure no one is modifying the name system. // It does not need the full namesystem write lock, since the only thing // that modifies namesystem on standby node is edit log replaying. + // checkpoint是namespace的一个快照,所以在dump快照的时候需要锁,避免修改namespace的内容, + // 这也是checkpoint要在snn上执行的一个原因 namesystem.cpLockInterruptibly(); try { assert namesystem.getEditLog().isOpenForRead() : @@ -265,8 +267,8 @@ public TransferFsImage.TransferResult call() //Update only when response from remote about success or lastUploadTime = monotonicNow(); // we are primary if we successfully updated the ANN - this.isPrimaryCheckPointer = success; } + this.isPrimaryCheckPointer = success; // cleaner than copying code for multiple catch statements and better than catching all // exceptions, so we just handle the ones we expect. if (ie != null || ioe != null) {