-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-28775 Change the output of DatanodeInfo in the log to the hostname of the datanode #6148
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
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
| for (int retry = 0;; retry++) { | ||
| LOG.debug("When create output stream for {}, exclude list is {}, retry={}", src, | ||
| toExcludeNodes, retry); | ||
| toExcludeNodes.stream().map(DatanodeInfo::getHostName).collect(Collectors.toSet()), retry); |
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.
Let's introduce a helper method to convert DatanodeInfo to the prefer text format? I think better to include both host name and ip, and also port in the output.
And since this will be kinda expensive, we'd better put this into a LOG.isDebugEnabled if condition.
accd55b to
44e2fd2
Compare
|
💔 -1 overall
This message was automatically generated. |
|
Please fix the spoltess issue? |
44e2fd2 to
7551327
Compare
It is ok. Next time, I'll pay attention. Thanks. |
|
🎊 +1 overall
This message was automatically generated. |
| } | ||
| } | ||
|
|
||
| public static String getDataNodeInfo(Set<DatanodeInfo> datanodeInfos) { |
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.
Just declare the parameter as Collection, or even use Stream, so we do not lose the order when get the string description for an array?
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.
OK, It has been changed to Collection
|
🎊 +1 overall
This message was automatically generated. |
7551327 to
8126cc0
Compare
|
🎊 +1 overall
This message was automatically generated. |
...cfs/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputHelper.java
Outdated
Show resolved
Hide resolved
|
💔 -1 overall
This message was automatically generated. |
8126cc0 to
bf3b170
Compare
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
@1458451310 I don't have the permission either. Let's wait for Duo to have a look when he has free time. |
I also do not have permission either. |
...cfs/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputHelper.java
Show resolved
Hide resolved
| } | ||
|
|
||
| public static String getDataNodeInfo(Collection<DatanodeInfo> datanodeInfos) { | ||
| if (datanodeInfos.isEmpty()) return "[]"; |
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 will introduce a checkstyle error, please always use {} even if there is only a single statement.
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 will introduce a checkstyle error, please always use {} even if there is only a single statement.
It's OK
| } | ||
|
|
||
| public static String getDataNodeInfo(Collection<DatanodeInfo> datanodeInfos) { | ||
| if (datanodeInfos.isEmpty()) return "[]"; |
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.
How about we simplify this by using Collectors.joining?. For example we could do:
public static String getDataNodeInfo(Collection<DatanodeInfo> datanodeInfos) {
return datanodeInfos.stream()
.map(datanodeInfo -> new StringBuilder().append("(")
.append(datanodeInfo.getHostName()).append("/")
.append(datanodeInfo.getInfoAddr()).append(":")
.append(datanodeInfo.getInfoPort()).append(")").toString())
.collect(Collectors.joining(",", "[", "]"));
}
Also good idea to add UTs for the utility function!
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.
How about we simplify this by using
Collectors.joining?. For example we could do:public static String getDataNodeInfo(Collection<DatanodeInfo> datanodeInfos) { return datanodeInfos.stream() .map(datanodeInfo -> new StringBuilder().append("(") .append(datanodeInfo.getHostName()).append("/") .append(datanodeInfo.getInfoAddr()).append(":") .append(datanodeInfo.getInfoPort()).append(")").toString()) .collect(Collectors.joining(",", "[", "]")); }Also good idea to add UTs for the utility function!
This is great 👍🏻
…ame of the datanode
bf3b170 to
64b3abc
Compare
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
…ame of the datanode (#6148) Co-authored-by: wangxin <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Nihal Jain <[email protected]> Reviewed-by: Vineet Kumar Maheshwari <[email protected]> Reviewed-by: guluo <[email protected]> (cherry picked from commit 241bbaf)
…ame of the datanode (apache#6148) Co-authored-by: wangxin <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Nihal Jain <[email protected]> Reviewed-by: Vineet Kumar Maheshwari <[email protected]> Reviewed-by: guluo <[email protected]> (cherry picked from commit 241bbaf)
…ame of the datanode (#6148) (#6212) Co-authored-by: wangxin <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Nihal Jain <[email protected]> Reviewed-by: Vineet Kumar Maheshwari <[email protected]> Reviewed-by: guluo <[email protected]> (cherry picked from commit 241bbaf) Co-authored-by: WangXin <[email protected]>
…ame of the datanode (#6148) (#6212) Co-authored-by: wangxin <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Nihal Jain <[email protected]> Reviewed-by: Vineet Kumar Maheshwari <[email protected]> Reviewed-by: guluo <[email protected]> (cherry picked from commit 241bbaf) Co-authored-by: WangXin <[email protected]> (cherry picked from commit f4a1904)
…ame of the datanode (#6148) (#6212) Co-authored-by: wangxin <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Nihal Jain <[email protected]> Reviewed-by: Vineet Kumar Maheshwari <[email protected]> Reviewed-by: guluo <[email protected]> (cherry picked from commit 241bbaf) Co-authored-by: WangXin <[email protected]> (cherry picked from commit f4a1904)
…ame of the datanode (apache#6148) (apache#6212) Co-authored-by: wangxin <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Nihal Jain <[email protected]> Reviewed-by: Vineet Kumar Maheshwari <[email protected]> Reviewed-by: guluo <[email protected]> (cherry picked from commit 241bbaf) Co-authored-by: WangXin <[email protected]> (cherry picked from commit f4a1904)
Now, DatanodeInfo will be output in the print log. When we are troubleshooting and searching for slow datanode nodes, we need to convert IP addresses to hostnames, which is quite cumbersome.
I think the output log should has good readability, so it would be better to output the hostname of the datanode.