This is an automated email from the ASF dual-hosted git repository.
diwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-flink-connector.git
The following commit(s) were added to refs/heads/master by this push:
new e548b4e5 [fix] Fix doris backend connection via http does not take
effect (#461)
e548b4e5 is described below
commit e548b4e5053084202f737b00a5d3a372f8928356
Author: wudongliang <[email protected]>
AuthorDate: Thu Aug 15 15:26:48 2024 +0800
[fix] Fix doris backend connection via http does not take effect (#461)
---
.../org/apache/doris/flink/sink/BackendUtil.java | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git
a/flink-doris-connector/src/main/java/org/apache/doris/flink/sink/BackendUtil.java
b/flink-doris-connector/src/main/java/org/apache/doris/flink/sink/BackendUtil.java
index e043788b..987ec9a1 100644
---
a/flink-doris-connector/src/main/java/org/apache/doris/flink/sink/BackendUtil.java
+++
b/flink-doris-connector/src/main/java/org/apache/doris/flink/sink/BackendUtil.java
@@ -56,6 +56,7 @@ public class BackendUtil {
nodes.forEach(
node -> {
if (tryHttpConnection(node)) {
+ LOG.info("{} backend http connection success.", node);
node = node.trim();
String[] ipAndPort = node.split(":");
BackendRowV2 backendRowV2 = new BackendRowV2();
@@ -100,11 +101,22 @@ public class BackendUtil {
LOG.debug("try to connect host {}", host);
host = "http://" + host;
URL url = new URL(host);
- HttpURLConnection co = (HttpURLConnection) url.openConnection();
- co.setConnectTimeout(60000);
- co.connect();
- co.disconnect();
- return true;
+ HttpURLConnection connection = (HttpURLConnection)
url.openConnection();
+ connection.setRequestMethod("GET");
+ connection.setConnectTimeout(60000);
+ connection.setReadTimeout(60000);
+ int responseCode = connection.getResponseCode();
+ String responseMessage = connection.getResponseMessage();
+ connection.disconnect();
+ if (200 == responseCode) {
+ return true;
+ }
+ LOG.warn(
+ "Failed to connect host {}, responseCode={}, msg={}",
+ host,
+ responseCode,
+ responseMessage);
+ return false;
} catch (Exception ex) {
LOG.warn("Failed to connect to host:{}", host, ex);
return false;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]