-
Notifications
You must be signed in to change notification settings - Fork 590
HDDS-7560. Placement Policy Interface changes to handle Overreplication #4014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Before creating a pull request please make sure that you get a green CI run in your fork. Checkstyle is fairly quick, painless to run even locally: |
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMCommonPlacementPolicy.java
Show resolved
Hide resolved
...p-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestSCMCommonPlacementPolicy.java
Show resolved
Hide resolved
| for (ContainerReplica replica:replicas) { | ||
| Integer replicaId = replica.getReplicaIndex(); | ||
| Node placementGroup = getPlacementGroup(replica.getDatanodeDetails()); | ||
| if (!replicaIdMap.containsKey(replicaId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be simplified to:
replicaIdMap.computeIfAbsent(replicaID, k -> Sets.newHashSet()).add(replica);
And then line 554 can go away too.
Similar for the one below.
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMCommonPlacementPolicy.java
Show resolved
Hide resolved
| replicaIdMap.get(replicaId).add(replica); | ||
| Map<Integer, Set<ContainerReplica>> placementGroupReplicaIDMap = | ||
| placementGroupReplicaIdMap.get(placementGroup); | ||
| placementGroupReplicaIDMap.compute(replicaId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be more concise with:
placementGroupReplicaIDMap.computeIfAbsent(replicaId, k -> Sets.newHashSet()).add(replica);
| * the count for rack is reduced. | ||
| * The set of replicas computed are then returned by the function. | ||
| * @param replicas: Map of replicas with value signifying if | ||
| * replica can be copied |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter is a Set not a map with value. I think this was copied from the earlier interface we worked on.
...p-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestSCMCommonPlacementPolicy.java
Outdated
Show resolved
Hide resolved
...p-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestSCMCommonPlacementPolicy.java
Show resolved
Hide resolved
...p-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestSCMCommonPlacementPolicy.java
Show resolved
Hide resolved
...p-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestSCMCommonPlacementPolicy.java
Show resolved
Hide resolved
|
I think the logic looks good. I have just a few comments on the tests and a couple more tests to add and then we are good I think. |
...p-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestSCMCommonPlacementPolicy.java
Show resolved
Hide resolved
sodonnel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for addressing the review comments.
…on (apache#4014) (cherry picked from commit ed7c60c) Change-Id: Ie04cd0f671cacd2335658b891dbeba0ee7f71f28
What changes were proposed in this pull request?
Placement Policy Interface changes to handle Overreplication changes
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-7560
How was this patch tested?
Unit test