[ 
https://issues.apache.org/jira/browse/HDDS-17910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksei Ieshin updated HDDS-17910:
----------------------------------
    Epic Link: HDDS-8926

> RackScatter fills extra EC replicas into racks in a fixed order, so the same 
> racks always hold the same EC indexes when width > rack count
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDDS-17910
>                 URL: https://issues.apache.org/jira/browse/HDDS-17910
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: SCM
>            Reporter: Aleksei Ieshin
>            Priority: Major
>
> h3. Problem
> When an EC container needs more replicas than there are racks (for example 
> rs-10-4 = 14 or rs-6-3 = 9 on 8 racks), \{{SCMContainerPlacementRackScatter}} 
> always puts the extra replicas on the same racks, in the same order, for 
> every container. Since \{{ECPipelineProvider#create}} numbers the chosen 
> nodes 1..n in the order the policy returns them, the same racks also always 
> receive the same replica indexes.
> h3. Mechanism
> {\{chooseDatanodesInternal}} picks nodes in two passes:
> # First pass: one node per rack. The rack list comes from \{{getAllRacks()}}, 
> which shuffles it, so the order is random.
> # Second pass, only when nodes are still missing: fill racks that already 
> have a replica, up to \{{maxReplicasPerRack}}.
> The second pass builds its rack list like this (master, lines ~335-338):
> {code:java}
> racks.addAll(usedRacksCntMap.keySet());
> racks = sortRackWithExcludedNodes(racks, excludedNodes, usedRacksCntMap);
> racks.addAll(usedRacksCntMap.keySet());
> {code}
> {\{sortRackWithExcludedNodes}} keeps only racks that are not in 
> \{{usedRacksCntMap}}. On a new placement the first pass has used every rack, 
> so it returns an empty list, and the second pass walks 
> \{{usedRacksCntMap.keySet()}} only. \{{usedRacksCntMap}} is a \{{HashMap}} 
> keyed by rack nodes that hash by their path (\{{NodeImpl#hashCode}} 
> =\{{toString().hashCode()}}), so this order is the same for every call and 
> across SCM restarts.
> The shuffle of the first pass is lost.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to