-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Flint Index Creation Reliability by Adjusting Socket Timeout (#…
…177) * Improve Flint Index Creation Reliability by Adjusting Socket Timeout This PR addresses the issue where creating a Flint index could fail due to a socket timeout. We have increased the default socket timeout from 30 (as defined in the OpenSearch RESTful Java client) to 60 seconds. Additionally, we've made the socket timeout value configurable to ensure greater flexibility and adaptability to various network conditions. Test enhancements include: - E2E testing with simulated socket timeout to validate the robustness of index creation under constrained network scenarios. Signed-off-by: Kaituo Li <[email protected]> * rename class and remove unused code Signed-off-by: Kaituo Li <[email protected]> --------- Signed-off-by: Kaituo Li <[email protected]>
- Loading branch information
Showing
5 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
flint-core/src/main/scala/org/opensearch/flint/core/storage/RequestConfigurator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.flint.core.storage; | ||
|
||
import org.apache.http.client.config.RequestConfig; | ||
import org.opensearch.client.RestClientBuilder; | ||
import org.opensearch.flint.core.FlintOptions; | ||
|
||
/** | ||
* allows override default socket timeout in RestClientBuilder.DEFAULT_SOCKET_TIMEOUT_MILLIS | ||
*/ | ||
public class RequestConfigurator implements RestClientBuilder.RequestConfigCallback { | ||
|
||
private final FlintOptions options; | ||
|
||
public RequestConfigurator(FlintOptions options) { | ||
this.options = options; | ||
} | ||
|
||
@Override | ||
public RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder requestConfigBuilder) { | ||
// Set the socket timeout in milliseconds | ||
return requestConfigBuilder.setSocketTimeout(options.getSocketTimeoutMillis()); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters