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));