-
Notifications
You must be signed in to change notification settings - Fork 594
HDDS-10593. Make client priority read from IN_SERVICE status Datanode #6449
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
ivandika3
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 the patch. LGTM +1.
sumitagrawl
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.
@xichen01 Thanks for working over this, LGTM
|
Thanks @ivandika3 and @sumitagrawl for the review. |
| } | ||
| } | ||
|
|
||
| boolean allInService = datanodeList.stream() |
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.
Change seems sensible to me. I tried to think if there was a nicer way to do this, and thought that the following was easier to follow:
Iterator<DatanodeDetails> iter = datanodeList.iterator();
List<DatanodeDetails> notInService = null;
while(iter.hasNext()) {
DatanodeDetails dn = iter.next();
if (dn.getPersistedOpState() != HddsProtos.NodeOperationalState.IN_SERVICE) {
iter.remove();
if (notInService == null) {
notInService = new ArrayList<>();
}
notInService.add(dn);
}
}
if (notInService != null) {
datanodeList.addAll(notInService);
}
It could be shorter, but I tried to avoid allocating a list for notInService unless it was really needed, as it won't be needed most of the time.
Only change this if you feel it is better - I am not insisting it should be changed.
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 your suggestion. This Implementation need to remove and readd the element, this may not bring in more benefits compare with the sort.
|
Thanks @xichen01 for the patch, @ivandika3, @sodonnel, @sumitagrawl for the review. |
(cherry picked from commit 9b248a0)
What changes were proposed in this pull request?
Make client priority read from
IN_SERVICEstatus Datanode.When Ozone client read Block form Datanode, the SCM will return all the Datanodes where the replicas are located, including the nodes in the
IN_MAINTENANCE, etc state, and the order may be random, so the client may try to access theIN_MAINTENANCEstate node first.Sometimes, we set a Datanode to
IN_MAINTENANCE, this may be due to some faults of the machine or wanting to restart a Datanode, in this scenario, that the Client does not read data form theseIN_MAINTENANCEdatanode is a good strategy.PS:
Since OM has a cache of Datanode state (expiration time 6min), the client can't get the latest state of Datanode, so we need to enhance the cache evicting mechanism.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10593
How was this patch tested?
Unit Test.