Description
In server.namenode.TestBlocksWithNotEnoughRacks.testSufficientlyReplicatedBlocksWithNotEnoughRacks
assert fails at curReplicas == REPLICATION_FACTOR, but it seems that it should go higher initially, and if the test doesn't wait for it to go back down, it will fail false positive.
Attachments
Attachments
Issue Links
- is related to
-
HDFS-1562 Add rack policy tests
- Closed
At line 79, it waits
while ( (numRacks < 2) || (curReplicas < REPLICATION_FACTOR) || (neededReplicationSize > 0))
But at line 95 it asserts
assertTrue(curReplicas == REPLICATION_FACTOR)
I believe that under the circumstances of the test, curReplicas will in fact be REPLICATION_FACTOR + 1, transiently. Changed the "while" to wait for the desired equality, i.e.,
while (curReplicas != REPLICATION_FACTOR).
Also changed the wait from infinite to a 20sec timeout with useful status output on failure.
Similar code in the other test case under TestBlocksWithNotEnoughRacks does not have the same problem, but still changed the wait from infinite to bounded.
Finally, added additional log messages useful for debugging if future problems.