Skip to content

Commit 6bbb918

Browse files
authored
[Fix] remove the socket timeout configuration of httpclient (#563)
1 parent ab9412d commit 6bbb918

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

flink-doris-connector/src/main/java/org/apache/doris/flink/sink/HttpUtil.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,30 @@
2828
import org.apache.http.protocol.RequestContent;
2929

3030
import static org.apache.doris.flink.cfg.ConfigurationOptions.DORIS_REQUEST_CONNECT_TIMEOUT_MS_DEFAULT;
31-
import static org.apache.doris.flink.cfg.ConfigurationOptions.DORIS_REQUEST_READ_TIMEOUT_MS_DEFAULT;
3231

3332
/** util to build http client. */
3433
public class HttpUtil {
3534
private final int connectTimeout;
36-
private final int socketTimeout;
35+
private final int waitForContinueTimeout;
3736
private HttpClientBuilder httpClientBuilder;
3837

3938
public HttpUtil() {
4039
this.connectTimeout = DORIS_REQUEST_CONNECT_TIMEOUT_MS_DEFAULT;
41-
this.socketTimeout = DORIS_REQUEST_READ_TIMEOUT_MS_DEFAULT;
40+
this.waitForContinueTimeout = DORIS_REQUEST_CONNECT_TIMEOUT_MS_DEFAULT;
4241
settingStreamHttpClientBuilder();
4342
}
4443

4544
public HttpUtil(DorisReadOptions readOptions) {
4645
this.connectTimeout = readOptions.getRequestConnectTimeoutMs();
47-
this.socketTimeout = readOptions.getRequestReadTimeoutMs();
46+
this.waitForContinueTimeout = readOptions.getRequestConnectTimeoutMs();
4847
settingStreamHttpClientBuilder();
4948
}
5049

5150
private void settingStreamHttpClientBuilder() {
5251
this.httpClientBuilder =
5352
HttpClients.custom()
5453
// default timeout 3s, maybe report 307 error when fe busy
55-
.setRequestExecutor(new HttpRequestExecutor(socketTimeout))
54+
.setRequestExecutor(new HttpRequestExecutor(waitForContinueTimeout))
5655
.setRedirectStrategy(
5756
new DefaultRedirectStrategy() {
5857
@Override
@@ -97,7 +96,9 @@ protected boolean isRedirectable(String method) {
9796
RequestConfig.custom()
9897
.setConnectTimeout(connectTimeout)
9998
.setConnectionRequestTimeout(connectTimeout)
100-
.setSocketTimeout(socketTimeout)
99+
// todo: Need to be extracted to DorisExecutionOption
100+
// default checkpoint timeout is 10min
101+
.setSocketTimeout(9 * 60 * 1000)
101102
.build());
102103
}
103104

@@ -108,7 +109,9 @@ public HttpClientBuilder getHttpClientBuilderForCopyBatch() {
108109
RequestConfig.custom()
109110
.setConnectTimeout(connectTimeout)
110111
.setConnectionRequestTimeout(connectTimeout)
111-
.setSocketTimeout(socketTimeout)
112+
// todo: Need to be extracted to DorisExecutionOption
113+
// default checkpoint timeout is 10min
114+
.setSocketTimeout(9 * 60 * 1000)
112115
.build());
113116
}
114117
}

0 commit comments

Comments
 (0)