This is an automated email from the ASF dual-hosted git repository. ferhui pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push: new ff24fe6 HDFS-16244.Add the necessary write lock in Checkpointer#doCheckpoint(). (#3497) ff24fe6 is described below commit ff24fe61972ff99486fae1822fe1a12ef3c7c846 Author: jianghuazhu <740087...@qq.com> AuthorDate: Wed Oct 13 17:21:03 2021 +0800 HDFS-16244.Add the necessary write lock in Checkpointer#doCheckpoint(). (#3497) --- .../org/apache/hadoop/hdfs/server/namenode/Checkpointer.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/Checkpointer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/Checkpointer.java index 618a372..d18d448 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/Checkpointer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/Checkpointer.java @@ -244,9 +244,14 @@ class Checkpointer extends Daemon { if(needReloadImage) { LOG.info("Loading image with txid " + sig.mostRecentCheckpointTxId); - File file = bnStorage.findImageFile(NameNodeFile.IMAGE, - sig.mostRecentCheckpointTxId); - bnImage.reloadFromImageFile(file, backupNode.getNamesystem()); + backupNode.namesystem.writeLock(); + try { + File file = bnStorage.findImageFile(NameNodeFile.IMAGE, + sig.mostRecentCheckpointTxId); + bnImage.reloadFromImageFile(file, backupNode.getNamesystem()); + } finally { + backupNode.namesystem.writeUnlock(); + } } rollForwardByApplyingLogs(manifest, bnImage, backupNode.getNamesystem()); } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org