StarRocks / starrocks-connector-for-apache-flink

Apache License 2.0
189 stars 152 forks source link

[BUG] Error occurred in DefaultStreamLoader#getAvailableHost while trying to load a URL due to configuration issues. #367

Open xumanbu opened 2 months ago

xumanbu commented 2 months ago

When configuring the load URL value, I mistakenly used a comma instead of a semicolon, like this : 10.x.x.1:8030,10.x.x.2:8030,10.x.x.3:8030.

except: throw an exception while flink start failed acture: only log error, flink application is running available

I found two point can be optimized.

  1. DefaultStreamLoader#testHttpConnection catched all Exception at now, wo can catch MalformedURLException and throw an IllegalArgumentException.
  2. StarRocksSinkOptions#validateStreamLoadUrl should be enhance.
Failed to connect to address:http://10.x.x.1:8030,10.x.x.2:8030,10.x.x.3:8030
java.net.MalformedURLException: For input string: "8030,10.x.x.2:8030,10.x.x.3:8030"
    at java.net.URL.<init>(URL.java:645) ~[?:1.8.0_262]
    at java.net.URL.<init>(URL.java:508) ~[?:1.8.0_262]
    at java.net.URL.<init>(URL.java:457) ~[?:1.8.0_262]
    at com.starrocks.data.load.stream.DefaultStreamLoader.testHttpConnection(DefaultStreamLoader.java:302) ~[flink-connector-starrocks-2.5_flink-1.15.2-vip.jar:?]
    at com.starrocks.data.load.stream.DefaultStreamLoader.getAvailableHost(DefaultStreamLoader.java:290) ~[flink-connector-starrocks-2.5_flink-1.15.2-vip.jar:?]
    at com.starrocks.data.load.stream.DefaultStreamLoader.send(DefaultStreamLoader.java:225) ~[flink-connector-starrocks-2.5_flink-1.15.2-vip.jar:?]
    at com.starrocks.data.load.stream.DefaultStreamLoader.lambda$send$2(DefaultStreamLoader.java:113) ~[flink-connector-starrocks-2.5_flink-1.15.2-vip.jar:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_262]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_262]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_262]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]
Caused by: java.lang.NumberFormatException: For input string: "8030,gd17-bigdata-starrocks-120-179-42.idc.vip.com:8030,gd17-bigdata-starrocks-120-204-34.idc.vip.com:8030"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.8.0_262]
    at java.lang.Integer.parseInt(Integer.java:580) ~[?:1.8.0_262]
    at java.lang.Integer.parseInt(Integer.java:615) ~[?:1.8.0_262]
    at java.net.URLStreamHandler.parseURL(URLStreamHandler.java:222) ~[?:1.8.0_262]
    at java.net.URL.<init>(URL.java:640) ~[?:1.8.0_262]
    ... 10 more