feat(http): opt-in request timeouts and Resize (shrink/split/clone) action#33
Merged
Conversation
Read http.connection_timeout / http.socket_timeout (both default 0 = unlimited) and apply them via curl4j CurlRequest.timeout(int,int) in getPlainCurlRequest, covering every request and failover retry. When both are 0 the request-build path is unchanged.
resizeIndex() previously compiled but threw UnsupportedOperationException at runtime because no action was registered. Add HttpResizeAction (POST /<source>/_<type>/<target>, body via ResizeRequest.toXContent, response via ResizeResponse.fromXContent) and register it. Works on all supported engines (no gate); copy_settings intentionally not emitted.
Clone a write-blocked source index and assert the target carries the docs, on OpenSearch 1/2/3 and Elasticsearch 7/8. Uses unique index names and best-effort cleanup of both indices to avoid cross-test state.
Delete source and target indices independently in the five integration test_resize finally blocks so a clone failure before the target index exists no longer leaks the write-blocked source index. Add unit test coverage for connect-only HTTP timeouts and for the resize action's timeout/master_timeout query params, and fix the shrink import block ordering in HttpClient.java to sort alphabetically after settings.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two independent improvements to the HTTP client:
Request timeouts (opt-in)
http.connection_timeout/http.socket_timeout(milliseconds,both default
0= unlimited), applied via curl4jCurlRequest.timeout(int, int)in
getPlainCurlRequest— covering every request and each failover retry.operations (reindex
wait_for_completion, force merge, snapshot, long scroll)are never capped unless a caller opts in.
Resize action (shrink/split/clone)
resizeIndex()previously compiled but threwUnsupportedOperationExceptionbecause no action was registered. Adds
HttpResizeAction(
POST /<source>/_<type>/<target>, body viaResizeRequest.toXContent,response via
ResizeResponse.fromXContent) and registers it.gate.
copy_settingsis intentionally not emitted (only ever true, matches theserver default, and avoids unrecognized-parameter errors).
Tests
path left unset) and per-type Resize request/response (endpoint, params, body,
parse success + error-body-throws).
_clonesmoke on all five engines, using a write-blocked source,asserting the target carries the documents, with independent best-effort cleanup
of both indices. Verified locally on Docker for all five.