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