From 88d8c3d0c88bcec5acca30aadca36b7d65c4237c Mon Sep 17 00:00:00 2001 From: langlaile1221 <35354527+langlaile1221@users.noreply.github.com> Date: Mon, 11 Oct 2021 16:11:31 +0800 Subject: [PATCH] HDFS-16241. Standby close reconstruction thread (#3493) Co-authored-by: zhanghuazong --- .../hadoop/hdfs/server/blockmanagement/BlockManager.java | 2 +- .../apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java index a0a20eeb6d..69e9ca8e7f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java @@ -3647,7 +3647,7 @@ public void run() { /* * Stop the ongoing initialisation of reconstruction queues */ - private void stopReconstructionInitializer() { + public void stopReconstructionInitializer() { if (reconstructionQueuesInitializer != null) { reconstructionQueuesInitializer.interrupt(); try { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index b01c660ff6..1fb6238c39 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -1458,8 +1458,11 @@ void stopActiveServices() { LOG.info("Stopping services started for active state"); writeLock(); try { - if (blockManager != null && blockManager.getSPSManager() != null) { - blockManager.getSPSManager().stop(); + if (blockManager != null) { + blockManager.stopReconstructionInitializer(); + if (blockManager.getSPSManager() != null) { + blockManager.getSPSManager().stop(); + } } stopSecretManager(); leaseManager.stopMonitor();