-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDFS-16478 Add thread id to command processor name #4016
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
Provides additional clarity in logs when debugging MiniDFSCluster with multiple in-process DataNodes.
|
|
||
| CommandProcessingThread(BPServiceActor actor) { | ||
| super("Command processor"); | ||
| setName("Command processor-" + getId()); |
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.
Why not using super()?
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.
Because the thread id is set during construction and not available to us yet.
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 @madrob for your works. I don't think getId() will get additional information.
IMO, it may be better to change like the following?
super("Command processor for " + nnAddr);
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 suggestion, but I don't think that would be an improvement. Let me explain the motivation in more detail?
The id is just the numeric Java thread id, and it's enough to differentiate the command processors between each other when there are multiple DN running in the same process like in MiniDFSCluster during unit tests.
Putting the NN address in would not disambiguate the logs because they would all be for the same NN still. It would give more information, sure, but not actually helpful information.
With my change, the log messages would have (Command processor-56) or -68 or whatever the thread was. Again, just enough to differentiate them from one another, which is what I needed for tracing their lifecycle and operation.
If there's a DN address we can use in the thread name instead, then that's good too but I don't know enough about Hadoop internals to find that.
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.
Putting the NN address in would not disambiguate the logs because they would all be for the same NN still. It would give more information, sure, but not actually helpful information.
Sorry I don't this information. IIUC, now each command processor match to block pool one by one. and actually nnAddr includes hostname/port together. I mean that it could different each other even for MiniDFSCluster framework. Right? for another way, with nnAddr, it could be helpful to dig when this thread meet issues.
Anyway, I don't disagree to add getId() also here. We could add both them to the thread name.
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 the issue here is in case of MiniDfsCluster all datanodes log at one place.Means if we spin a MiniDfsCluster with 9 datanodes, all Command processor threads will log at same place, and we can't distinguish, which thread belongs to which datanode.
DN1 will also have same name & DN2 till DN9. If we add namenode address, then also the names of the thread will stay same right? All datanodes in a single MiniDfs will be connected to same set of namenodes, right?
May be adding DN address should be a good idea?
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.
Yes, exactly, @ayushtkn. All of the DN will have the same NN and then they will log the same thread name string.
For adding DN address, I'm not sure which fields in DN are considered stable for this purpose. Maybe setName("Command processor for " + dn.getDisplayName()); will work?
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 the issue here is in case of MiniDfsCluster all datanodes log at one place.Means if we spin a MiniDfsCluster with 9 datanodes, all Command processor threads will log at same place, and we can't distinguish, which thread belongs to which datanode. DN1 will also have same name & DN2 till DN9. If we add namenode address, then also the names of the thread will stay same right? All datanodes in a single MiniDfs will be connected to same set of namenodes, right?
May be adding DN address should be a good idea?
Thanks @madrob @ayushtkn for your discussions and information. From my side, I am more concerned how to differ these threads service to which namespace when setup Federation production cluster. This may be helpful for digging issues when meet something not expected. I total agree to add dn.getDisplayName() or getId() or something else also that can improve the MiniDFSCluster log readable. IMO we should consider production env meanwhile. FYI. Of course this is not the FATAL issue, my comment is not blocker. Please feel free to go ahead if possible.
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.
Makes sense, we should handle federation setup as well. That is what will help in actual prod env.
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
tomscut
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.
If you want to distinguish threads, we might have to add nnaddr+ dn.getDisplayName, right?
I don't think that is necessary, but it could be a great addition in a future PR if you find yourself having the need for your use cases. |
|
We're closing this stale PR because it has been open for 100 days with no activity. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
Description of PR
Provides additional clarity in logs when debugging MiniDFSCluster with
multiple in-process DataNodes.
How was this patch tested?
Visual inspection of log output.
For code changes: