From 9c9d747fbc1ff61df6408af9fb961f67aeb6e5be Mon Sep 17 00:00:00 2001 From: Sungdong Kim Date: Sat, 21 Dec 2024 23:45:49 +0900 Subject: [PATCH] pass counter to each fsimage loading threads --- .../hadoop/hdfs/server/namenode/FSImageFormatPBINode.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatPBINode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatPBINode.java index 08fd39f481d10..8a91917745ece 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatPBINode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormatPBINode.java @@ -423,6 +423,7 @@ void loadINodeSectionInParallel(ExecutorService service, CountDownLatch latch = new CountDownLatch(sections.size()); AtomicInteger totalLoaded = new AtomicInteger(0); final List exceptions = Collections.synchronizedList(new ArrayList<>()); + Counter counter = prog.getCounter(Phase.LOADING_FSIMAGE, currentStep); for (int i=0; i < sections.size(); i++) { FileSummary.Section s = sections.get(i); @@ -433,9 +434,7 @@ void loadINodeSectionInParallel(ExecutorService service, } service.submit(() -> { try { - totalLoaded.addAndGet(loadINodesInSection(ins, null)); - prog.setCount(Phase.LOADING_FSIMAGE, currentStep, - totalLoaded.get()); + totalLoaded.addAndGet(loadINodesInSection(ins, counter)); } catch (Exception e) { LOG.error("An exception occurred loading INodes in parallel", e); exceptions.add(new IOException(e));