virajjasani commented on a change in pull request #3280:
URL: https://github.com/apache/hadoop/pull/3280#discussion_r688683336
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestDecommissioningStatus.java
##########
@@ -307,6 +323,59 @@ public void testDecommissionStatus() throws Exception {
AdminStatesBaseTest.cleanupFile(fileSys, file2);
}
+ protected void verifyInitialState(FSNamesystem fsn, DatanodeManager dm)
+ throws InterruptedException {
+ dm.getDatanodes().forEach(datanodeDescriptor -> {
+ try {
+ checkDecommissionStatus(datanodeDescriptor, 0, 0, 0);
+ } catch (TimeoutException | InterruptedException e) {
+ throw new AssertionError("Datanode not in good state.", e);
+ }
+ });
+ int c = 0;
+ int totalBlocks;
+ long totalReplicatedBlocks;
+ while (true) {
+ totalBlocks = fsn.getBlockManager().getTotalBlocks();
+ totalReplicatedBlocks = fsn.getBlockManager().getTotalReplicatedBlocks();
+ if (totalBlocks == 4 && totalReplicatedBlocks == 4) {
+ break;
+ } else {
+ if (c == 4) {
+ throw new AssertionError("Unexpected Total blocks " + totalBlocks
+ + " and replicated blocks " + totalReplicatedBlocks);
+ }
+ Thread.sleep(3000);
+ }
+ c++;
+ }
Review comment:
Also, keeping little complex logic of using counters (AtomicInteger as
counters inside lambda) to ensure all 8 blocks are present in all DNs (4 blocks
in each DN) would become even more complicated if we use
`GenericUtils.waitFor()` so I think keeping this way is still less complex.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]