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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]