-
Notifications
You must be signed in to change notification settings - Fork 593
HDDS-4928. Support container move in Replication Manager #2349
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
|
@ChenSammi @GlenGeng @lokeshj1703 @siddhantsangwan PATL! I will add more test case for move in additional commits of this PR |
lokeshj1703
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.
Thanks for working on this PR @JacksonYao287 ! The changes look good to me. I have few comments inline.
I was also thinking if we could simplify the logic in RM#handleOverReplicatedContainer. How about we always try to make the container over-replicated so that move can succeed. I think in handleOverReplicatedContainer if src and target are both present and container is over-replicated, delete can be sent for source.
To make sure that container is over-replicated, maybe changes can be made in ContainerReplicaCount so that move target is not included in replica count? This would make sure that finally handleOverReplicatedContainer would have an over-replicated state so that it can just delete source dn.
...p-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
Outdated
Show resolved
Hide resolved
...p-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
Show resolved
Hide resolved
...p-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
Outdated
Show resolved
Hide resolved
...p-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
Outdated
Show resolved
Hide resolved
...p-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
Outdated
Show resolved
Hide resolved
...p-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
Outdated
Show resolved
Hide resolved
...p-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
Show resolved
Hide resolved
...p-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
Outdated
Show resolved
Hide resolved
...p-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
Outdated
Show resolved
Hide resolved
...p-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
Outdated
Show resolved
Hide resolved
|
Thanks @lokeshj1703 very much for this review, i will update this PR according to your comments.
this idea seems good, but i have a little question. i think even if src and target are both present and container is over-replicated , deletion can not be definitely sent for source. if the placementPolicy is not met after src is deleted, i think we can not directly send a delete command to src. |
We can use a simple approach initially where if placement policy is not satisfied with replicas + target - src, we fail the move future. |
|
i have updated the PR , @lokeshj1703 PTAL! if there is no more logic problem , i will add unit test for move |
| if (isTargetDnInReplicaSet) { | ||
| if (isSourceDnInReplicaSet) { | ||
| // if the target is present, and source disappears somehow, | ||
| // we can consider move is successful. | ||
| inflightMoveFuture.get(id).complete(MoveResult.COMPLETED); | ||
| inflightMove.remove(id); | ||
| inflightMoveFuture.remove(id); | ||
| } else { | ||
| // if the container is in inflightMove and target datanode is | ||
| // included in the replicas, then swap the source datanode to | ||
| // first of the replica list if exists, so the source datanode | ||
| // will be first removed if possible. | ||
| eligibleReplicas.add(0, eligibleReplicas.remove(sourceDnPos)); | ||
| } |
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.
Can you please explain this part? If both target and source are present in replicas, then source should be swapped with the first node in replicas list so it can be deleted, right? And move completes if source is absent while target is present. It seems the logic of if and else parts is opposite.
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.
yea, thanks @siddhantsangwan for pointing out this! I explained the logic in the comment, which is just what you said, but i made a mistake in the code. i will fix this , thanks!
|
@JacksonYao287 Thanks for updating the PR! The logic looks good to me. |
|
@JacksonYao287 There is one optimization which we can use for move. If placement policy was initially not satisfied then deletion for source can be sent provided placement count remains same after deletion. I think it would be a good idea to abstract out logic here |
yea, looks good, i will make this change and add some unit tests for move. by the way , i think |
lokeshj1703
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.
@JacksonYao287 Thanks for updating the PR! The UTs look really good.
I would suggest adding a UT to make sure RM does not delete replica if placement policy is not satisfied.
...p-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
Show resolved
Hide resolved
|
@lokeshj1703 Thanks for the review
i will add this UT |
|
@ChenSammi @siddhantsangwan PTAL! |
lokeshj1703
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.
@JacksonYao287 Thanks for updating the PR! The changes look good to me. +1.
I have a minor comment inline.
What changes were proposed in this pull request?
add a move API in replication manager , and it will be used by container balancer
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-4928
How was this patch tested?
add unit test