Skip to content

Conversation

@swamirishi
Copy link
Contributor

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

@adoroszlai
Copy link
Contributor

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-ozone/dev-support/checks/checkstyle.sh

for (ContainerReplica replica:replicas) {
Integer replicaId = replica.getReplicaIndex();
Node placementGroup = getPlacementGroup(replica.getDatanodeDetails());
if (!replicaIdMap.containsKey(replicaId)) {
Copy link
Contributor

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.

replicaIdMap.get(replicaId).add(replica);
Map<Integer, Set<ContainerReplica>> placementGroupReplicaIDMap =
placementGroupReplicaIdMap.get(placementGroup);
placementGroupReplicaIDMap.compute(replicaId,
Copy link
Contributor

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
Copy link
Contributor

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.

@sodonnel
Copy link
Contributor

sodonnel commented Jan 9, 2023

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.

Copy link
Contributor

@sodonnel sodonnel left a 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.

@sodonnel sodonnel merged commit ed7c60c into apache:master Jan 9, 2023
jojochuang pushed a commit to jojochuang/ozone that referenced this pull request Feb 6, 2023
…on (apache#4014)

(cherry picked from commit ed7c60c)
Change-Id: Ie04cd0f671cacd2335658b891dbeba0ee7f71f28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants