Uh oh!
There was an error while loading. Please reload this page.
HBASE-28775 Change the output of DatanodeInfo in the log to the hostname of the datanode - #6148
Conversation
Apache-HBase
commented
Aug 9, 2024
💔 -1 overall
This message was automatically generated. |
Apache-HBase
commented
Aug 9, 2024
🎊 +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.
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.
Apache-HBase
commented
Aug 13, 2024
💔 -1 overall
This message was automatically generated. |
Apache9
commented
Aug 25, 2024
Please fix the spoltess issue? |
wangxin97-02
commented
Aug 26, 2024
It is ok. Next time, I'll pay attention. Thanks. |
Apache-HBase
commented
Aug 26, 2024
🎊 +1 overall
This message was automatically generated. |
| } | ||
| } | ||
| public static String getDataNodeInfo(Set<DatanodeInfo> datanodeInfos) { |
There was a problem hiding this comment.
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.
OK, It has been changed to Collection
Apache-HBase
commented
Aug 26, 2024
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Aug 27, 2024
🎊 +1 overall
This message was automatically generated. |
Uh oh!
There was an error while loading. Please reload this page.
Apache-HBase
commented
Aug 27, 2024
💔 -1 overall
This message was automatically generated. |
Apache-HBase
commented
Aug 28, 2024
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Aug 28, 2024
🎊 +1 overall
This message was automatically generated. |
guluo2016
commented
Sep 3, 2024
@1458451310 I don't have the permission either. Let's wait for Duo to have a look when he has free time. |
vineet4008
commented
Sep 3, 2024
I also do not have permission either. |
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| public static String getDataNodeInfo(Collection<DatanodeInfo> datanodeInfos) { | ||
| if (datanodeInfos.isEmpty()) return "[]"; |
There was a problem hiding this comment.
This will introduce a checkstyle error, please always use {} even if there is only a single statement.
There was a problem hiding this comment.
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.
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.
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
64b3abcCompareApache-HBase
commented
Sep 5, 2024
🎊 +1 overall
This message was automatically generated. |
Apache-HBase
commented
Sep 5, 2024
🎊 +1 overall
This message was automatically generated. |
…ame of the datanode (#6148) Co-authored-by: wangxin <wangxin9702@gmail.com> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Nihal Jain <nihaljain@apache.org> Reviewed-by: Vineet Kumar Maheshwari <vineet.4008@gmail.com> Reviewed-by: guluo <lupeng_nwpu@qq.com> (cherry picked from commit 241bbaf)
…ame of the datanode (apache#6148) Co-authored-by: wangxin <wangxin9702@gmail.com> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Nihal Jain <nihaljain@apache.org> Reviewed-by: Vineet Kumar Maheshwari <vineet.4008@gmail.com> Reviewed-by: guluo <lupeng_nwpu@qq.com> (cherry picked from commit 241bbaf)
…ame of the datanode (#6148) (#6212) Co-authored-by: wangxin <wangxin9702@gmail.com> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Nihal Jain <nihaljain@apache.org> Reviewed-by: Vineet Kumar Maheshwari <vineet.4008@gmail.com> Reviewed-by: guluo <lupeng_nwpu@qq.com> (cherry picked from commit 241bbaf) Co-authored-by: WangXin <1458451310@qq.com>
…ame of the datanode (#6148) (#6212) Co-authored-by: wangxin <wangxin9702@gmail.com> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Nihal Jain <nihaljain@apache.org> Reviewed-by: Vineet Kumar Maheshwari <vineet.4008@gmail.com> Reviewed-by: guluo <lupeng_nwpu@qq.com> (cherry picked from commit 241bbaf) Co-authored-by: WangXin <1458451310@qq.com> (cherry picked from commit f4a1904)
…ame of the datanode (#6148) (#6212) Co-authored-by: wangxin <wangxin9702@gmail.com> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Nihal Jain <nihaljain@apache.org> Reviewed-by: Vineet Kumar Maheshwari <vineet.4008@gmail.com> Reviewed-by: guluo <lupeng_nwpu@qq.com> (cherry picked from commit 241bbaf) Co-authored-by: WangXin <1458451310@qq.com> (cherry picked from commit f4a1904)
…ame of the datanode (apache#6148) (apache#6212) Co-authored-by: wangxin <wangxin9702@gmail.com> Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Nihal Jain <nihaljain@apache.org> Reviewed-by: Vineet Kumar Maheshwari <vineet.4008@gmail.com> Reviewed-by: guluo <lupeng_nwpu@qq.com> (cherry picked from commit 241bbaf) Co-authored-by: WangXin <1458451310@qq.com> (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.