[
https://issues.apache.org/jira/browse/HDDS-17910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150041#comment-18150041
]
Aleksei Ieshin edited comment on HDDS-17910 at 11/24/26, 3:10 AM:
------------------------------------------------------------------
Hi, please have a look at the small patch submitted. [~swamirishi] [~sodonnell]
[~chihsuan] [~adoroszlai]
was (Author: JIRAUSER311863):
Hi, please have a look. [~swamirishi] [~sodonnell] [~chihsuan] [~adoroszlai]
> 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
> Assignee: Aleksei Ieshin
> Priority: Major
> Labels: pull-request-available
>
> 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.
>
> h3. Fix
>
>
>
>
>
> Randomise the second-pass rack order while keeping the filtering, which still
> matters for repairs (racks without a replica first).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]