[ https://issues.apache.org/jira/browse/HDFS-16039?focusedWorklogId=609560&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-609560 ]
ASF GitHub Bot logged work on HDFS-16039: ----------------------------------------- Author: ASF GitHub Bot Created on: 10/Jun/21 08:32 Start Date: 10/Jun/21 08:32 Worklog Time Spent: 10m Work Description: zhuxiangyi commented on a change in pull request #3086: URL: https://github.com/apache/hadoop/pull/3086#discussion_r648969521 ########## File path: hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/RBFMetrics.java ########## @@ -372,12 +420,69 @@ private static void setStateStoreVersions( @Override public long getTotalCapacity() { - return getNameserviceAggregatedLong(MembershipStats::getTotalSpace); + return getNameserviceAggregatedLong( + DatanodeReportType.LIVE, DatanodeInfo::getCapacity); + } + + public LoadingCache<DatanodeReportType, DatanodeInfo[]> getDnCache() { + return dnCache; + } + + /** + * Get the aggregated value for a DatanodeReportType and + * a method for all nameservices. + * @param type a DatanodeReportType + * @param f Method reference + * @return Aggregated long. + */ + public long getNameserviceAggregatedLong( + DatanodeReportType type, ToLongFunction<DatanodeInfo> f){ + long size = 0; + try { + size = Arrays.stream(dnCache.get(type)).mapToLong(f).sum(); Review comment: Thank you for your reminder. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 609560) Time Spent: 40m (was: 0.5h) > RBF: Some indicators of RBFMetrics count inaccurately > ------------------------------------------------------ > > Key: HDFS-16039 > URL: https://issues.apache.org/jira/browse/HDFS-16039 > Project: Hadoop HDFS > Issue Type: Bug > Components: rbf > Affects Versions: 3.4.0 > Reporter: Xiangyi Zhu > Assignee: Xiangyi Zhu > Priority: Major > Labels: pull-request-available > Time Spent: 40m > Remaining Estimate: 0h > > RBFMetrics#getNumLiveNodes, getNumNamenodes, getTotalCapacity > The current statistical algorithm is to accumulate all Nn indicators, which > will lead to inaccurate counting. I think that the same ClusterID only needs > to take one Max and then do the accumulation. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org