[ 
https://issues.apache.org/jira/browse/HDFS-7891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14366860#comment-14366860
 ] 

Walter Su commented on HDFS-7891:
---------------------------------

I upload a new patch {{HDFS-7891.003.patch}}. It use random policy with 
{{maxNodesPerRack}} .

*Design*
R = total racks in cluster
X = total expected replicas
Q=Math.floor(X/R)
T=X%R

if X<R, X racks have 1 replica.
if X>R && T==0, R racks have Q replicas.
if X>R && T!=0,, X-T racks have Q replicas. T racks have Q+1 replicas.

*Coding*
1. Add a function getMaxNodesPerRack(..)
2. Call getMaxNodesPerRack(..) before every choosing

*Defects*
I copy a lot of code from {{BlockPlacementPolicyDefault}} . If I didn't do 
this, I have to modify {{BlockPlacementPolicyDefault}} so it can call an empty 
getMaxNodesPerRack(..) before every choosing, and I can overide it on child 
class.

> A block placement policy with best fault tolerance
> --------------------------------------------------
>
>                 Key: HDFS-7891
>                 URL: https://issues.apache.org/jira/browse/HDFS-7891
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Walter Su
>            Assignee: Walter Su
>         Attachments: HDFS-7891.002.patch, HDFS-7891.003.patch, 
> HDFS-7891.patch, PlacementPolicyBenchmark.txt, testresult.txt
>
>
> a block placement policy tries its best to place replicas to most racks.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to