|
46 | 46 | import org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorOutputStream; |
47 | 47 | import org.apache.hc.core5.concurrent.DefaultThreadFactory; |
48 | 48 | import org.apache.hc.core5.http.ClassicHttpResponse; |
| 49 | +import org.apache.hc.core5.http.ConnectionRequestTimeoutException; |
49 | 50 | import org.apache.hc.core5.http.HttpStatus; |
50 | 51 | import org.apache.hc.core5.http.NoHttpResponseException; |
51 | 52 | import org.slf4j.Logger; |
@@ -892,7 +893,7 @@ public CompletableFuture<InsertResponse> insert(String tableName, List<?> data, |
892 | 893 | metrics.operationComplete(); |
893 | 894 | metrics.setQueryId(queryId); |
894 | 895 | return new InsertResponse(metrics); |
895 | | - } catch (NoHttpResponseException e) { |
| 896 | + } catch (NoHttpResponseException | ConnectionRequestTimeoutException e) { |
896 | 897 | LOG.warn("Failed to get response. Retrying.", e); |
897 | 898 | selectedNode = getNextAliveNode(); |
898 | 899 | continue; |
@@ -1010,12 +1011,12 @@ public CompletableFuture<InsertResponse> insert(String tableName, |
1010 | 1011 | metrics.operationComplete(); |
1011 | 1012 | metrics.setQueryId(queryId); |
1012 | 1013 | return new InsertResponse(metrics); |
1013 | | - } catch (NoHttpResponseException e) { |
| 1014 | + } catch (NoHttpResponseException | ConnectionRequestTimeoutException e) { |
1014 | 1015 | if (i < maxRetries) { |
1015 | 1016 | try { |
1016 | 1017 | data.reset(); |
1017 | 1018 | } catch (IOException ioe) { |
1018 | | - throw new ClientException("Failed to get response", e); |
| 1019 | + throw new ClientException("Failed to reset stream for retry", e); |
1019 | 1020 | } |
1020 | 1021 | LOG.warn("Failed to get response. Retrying.", e); |
1021 | 1022 | selectedNode = getNextAliveNode(); |
@@ -1173,6 +1174,10 @@ public CompletableFuture<QueryResponse> query(String sqlQuery, Map<String, Objec |
1173 | 1174 | metrics.operationComplete(); |
1174 | 1175 |
|
1175 | 1176 | return new QueryResponse(httpResponse, finalSettings.getFormat(), finalSettings, metrics); |
| 1177 | + } catch (NoHttpResponseException | ConnectionRequestTimeoutException e) { |
| 1178 | + LOG.warn("Failed to get response. Retrying.", e); |
| 1179 | + selectedNode = getNextAliveNode(); |
| 1180 | + continue; |
1176 | 1181 | } catch (ClientException e) { |
1177 | 1182 | throw e; |
1178 | 1183 | } catch (Exception e) { |
|
0 commit comments