[ https://issues.apache.org/jira/browse/HDFS-15810?focusedWorklogId=591960&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-591960 ]
ASF GitHub Bot logged work on HDFS-15810: ----------------------------------------- Author: ASF GitHub Bot Created on: 02/May/21 06:06 Start Date: 02/May/21 06:06 Worklog Time Spent: 10m Work Description: fengnanli commented on a change in pull request #2910: URL: https://github.com/apache/hadoop/pull/2910#discussion_r624637196 ########## File path: hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/metrics/TestRBFMetrics.java ########## @@ -348,4 +352,34 @@ private void validateClusterStatsRouterBean(RouterMBean bean) { assertTrue(bean.getHostAndPort().length() > 0); assertFalse(bean.isSecurityEnabled()); } + + private void testCapacity(FederationMBean bean) throws IOException { + List<MembershipState> memberships = getActiveMemberships(); + assertTrue(memberships.size() > 1); + + BigInteger availableCapacity = BigInteger.valueOf(0); + BigInteger totalCapacity = BigInteger.valueOf(0); + BigInteger unitCapacity = BigInteger.valueOf(Long.MAX_VALUE); + for (MembershipState mock : memberships) { + MembershipStats stats = mock.getStats(); + stats.setTotalSpace(Long.MAX_VALUE); + stats.setAvailableSpace(Long.MAX_VALUE); + // reset stats to make the new value persistent + mock.setStats(stats); + // write back the new namenode information to state store + assertTrue(refreshNamenodeRegistration( + NamenodeHeartbeatRequest.newInstance(mock))); + totalCapacity = totalCapacity.add(unitCapacity); + availableCapacity = availableCapacity.add(unitCapacity); + } + + // for local cache update + assertEquals(bean.getTotalCapacityBigInt(), totalCapacity); + // not equal since overflow happened. + assertNotEquals(BigInteger.valueOf(bean.getTotalCapacity()), totalCapacity); + assertEquals(bean.getRemainingCapacityBigInt(), availableCapacity); + // not equal since overflow happened. + assertNotEquals( + BigInteger.valueOf(bean.getRemainingCapacity()), availableCapacity); Review comment: Changed. Thanks! -- 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: 591960) Time Spent: 3h 40m (was: 3.5h) > RBF: RBFMetrics's TotalCapacity out of bounds > --------------------------------------------- > > Key: HDFS-15810 > URL: https://issues.apache.org/jira/browse/HDFS-15810 > Project: Hadoop HDFS > Issue Type: Bug > Reporter: Xiaoxing Wei > Assignee: Fengnan Li > Priority: Major > Labels: pull-request-available > Attachments: Screen Shot 2021-04-26 at 5.25.12 PM.png, > image-2021-02-02-10-59-17-113.png > > Time Spent: 3h 40m > Remaining Estimate: 0h > > The Long type fields TotalCapacity,UsedCapacity and RemainingCapacity in > RBFMetrics maybe ** out of bounds. > !image-2021-02-02-10-59-17-113.png! -- 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