Affects Version/s: None
Fix Version/s: None
I often found that the testcase TestDecommissioningStatus failed sometimes. And I looked the test failed report, it always show these error infos:
And I know the reason is that the under-replicated num is not correct in method checkDecommissionStatus of TestDecommissioningStatus#testDecommissionStatus.
In this testcase, each datanode should have 4 blocks(2 for decommission.dat, 2 for decommission.dat1)The expect num 3 on first node is because the lastBlock of uc blockCollection can not be replicated if its numlive just more than blockManager minReplication(in this case is 1). And before decommed second datanode, it has already one live replication for the uc blockCollection' lastBlock in this node.
So in this failed case, the first node's under-replicat changes to 4 indicated that the uc blockCollection lastBlock's livenum is already 0 before the second datanode decommed. So I think there are two possibilitys will lead to it.
- The second datanode was already decommed before node one.
- Creating file decommission.dat1 failed that lead that the second datanode has no this block.
And I read the code, it has checked the decommission-in-progress nodes here
So it seems the second possibility are more likely the reason. And in addition, it hasn't did a block number check when finished the creating file. So we could do a check and retry operatons here if block number is not correct as expected.