[MINOR] fix(dashboard): Fix NPE while without targetAddress for api/server/nodes
What changes were proposed in this pull request?
I use rest api without given targetAddress, the NPE encountered.
â ~ curl 'http://localhost:19988/api/server/nodes?status=active'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /api/server/nodes. Reason:
<pre> java.lang.NullPointerException</pre></p>
<hr /><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.3.24.v20180605</a><hr/>
</body>
</html>
Why are the changes needed?
Fix the NPE.
Does this PR introduce any user-facing change?
Without NPE through.
How was this patch tested?
curl 'http://localhost:19988/api/server/nodes?status=active'
We should not request the dashboard API directly. You can request the rest api of the coordinator.
Test Results
2 652 files - 5 2 652 suites - 5 5h 24m 44s :stopwatch: - 6m 48s 946 tests ±0 944 :white_check_mark: - 1 1 :zzz: ±0 0 :x: ±0 1 :fire: +1 11 794 runs +5 11 778 :white_check_mark: +4 15 :zzz: ±0 0 :x: ±0 1 :fire: +1
For more details on these errors, see this check.
Results for commit bc92dba9. ± Comparison against base commit d32542ba.
This pull request removes 2 and adds 2 tests. Note that renamed tests count towards both.
org.apache.uniffle.shuffle.manager.RssShuffleManagerBaseTest ‑ testGetAttemptIdBits
org.apache.uniffle.shuffle.manager.RssShuffleManagerBaseTest ‑ testGetMaxAttemptNo
org.apache.uniffle.client.ClientUtilsTest ‑ testGetMaxAttemptNo
org.apache.uniffle.client.ClientUtilsTest ‑ testGetNumberOfSignificantBits
:recycle: This comment has been updated with latest results.
@xianjingfeng Thanks for your reply. I'd like to request coordinator directly, but sometimes we could export 8080 port as outside port, others are forbid to be accessed, so we can access coordinator or shuffle server rest api by dashboard api, normally, we have to specific targetAddress, and do you think it is not good enough to throw a NPE while targetAddress is not specified?
@xianjingfeng Thanks for your reply. I'd like to request coordinator directly, but sometimes we could export 8080 port as outside port, others are forbid to be accessed, so we can access coordinator or shuffle server rest api by dashboard api, normally, we have to specific
targetAddress, and do you think it is not good enough to throw a NPE whiletargetAddressis not specified?
If targetAddress is null, we can randomly choose a coordinator.
@xianjingfeng This is a good idea
@rickyma Thanks for you suggestion, I've added log, PTAL.
@xianjingfeng PTAL
Merged to master. Thanks @maobaolong @xianjingfeng
Thanks for your review! @rickyma @xianjingfeng