liuml07 commented on a change in pull request #2785: URL: https://github.com/apache/hadoop/pull/2785#discussion_r597410126
########## File path: hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancer.java ########## @@ -2297,7 +2297,9 @@ public void testBalancerWithSortTopNodes() throws Exception { maxUsage = Math.max(maxUsage, datanodeReport[i].getDfsUsed()); } - assertEquals(200, balancerResult.bytesAlreadyMoved); + // Either 2 blocks of 100+100 bytes or 3 blocks of 100+100+50 bytes Review comment: Could add some explanation why this would happen. The 95% usage DN will have 9 blocks of 100 bytes and 1 block of 50 byte - all for the same file. The HDFS balancer will choose a block to move from this node randomly. More likely it will be 100B block. Since that is greater than `DFS_BALANCER_MAX_SIZE_TO_MOVE_KEY` which is 99L (see above settings), it will stop here. Total bytes moved from this 95% DN will be 1 block and hence 100B. However, chances are the first block to move from this 95% DN is the 50B block. After this block being moved, the total moved size 50B is smaller than `DFS_BALANCER_MAX_SIZE_TO_MOVE_KEY` , it will try to move another block. The second block will always be 100 bytes. So total bytes moved from this 95% DN will be 2 blocks and hence 150B (100B + 50B). Please reword or rephrase this as comment before this assertion so readers can have more context without thinking too much again. 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 --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org