Thanks Lei (Eddy) Xu for the great input! Here is the updated patch.
We can make class members in ... to be private final.
Fixed BlockPlacementStatusWithUpgradeDomain. BlockPlacementPolicyWithUpgradeDomain's class members can't be final as they are inited during initialize call.
Since we are using JDK7 now, we can use type inference ...
Fixed. Also updated other modified files in the patch.
Can you make some adjustments on the comments for ...
Good point. I have updated the comment to explain the algorithm better as you suggest.
Regarding of #3, what is the typical relationship between rack and upgrade domains
In our deployment, we use machine position within the rack as upgrade domain id. But it is possible to config the cluster to have the same upgrade domain cover more than one machine position; for example, machines at position
within any rack have upgrade domain 1,
have upgrade domain 2, etc.
what kind of implication it will have to the current data availability model?
Great point. I have updated the description for the method to explain the correctness of the approach. In short, upgrade domain policy will keep "any block should be on at least two racks" policy.