Skip to content

feat(http): opt-in request timeouts and Resize (shrink/split/clone) action#33

Merged
marevol merged 4 commits into
mainfrom
feat/timeouts-and-resize
Jul 8, 2026
Merged

feat(http): opt-in request timeouts and Resize (shrink/split/clone) action#33
marevol merged 4 commits into
mainfrom
feat/timeouts-and-resize

Conversation

@marevol

@marevol marevol commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Two independent improvements to the HTTP client:

Request timeouts (opt-in)

  • New settings http.connection_timeout / http.socket_timeout (milliseconds,
    both default 0 = unlimited), applied via curl4j CurlRequest.timeout(int, int)
    in getPlainCurlRequest — covering every request and each failover retry.
  • Defaults leave the request-build path byte-identical to before, so long-running
    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 threw UnsupportedOperationException
    because no action was registered. Adds HttpResizeAction
    (POST /<source>/_<type>/<target>, body via ResizeRequest.toXContent,
    response via ResizeResponse.fromXContent) and registers it.
  • Works on all supported engines (OpenSearch 1/2/3, Elasticsearch 7/8); no engine
    gate. copy_settings is intentionally not emitted (only ever true, matches the
    server default, and avoids unrecognized-parameter errors).

Tests

  • Unit: timeout wiring (applied when configured, including connect-only; default
    path left unset) and per-type Resize request/response (endpoint, params, body,
    parse success + error-body-throws).
  • Integration: a _clone smoke 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.
  • Offline unit suite: 343 tests pass.

marevol added 4 commits July 8, 2026 23:59
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.
@marevol marevol merged commit d90ab56 into main Jul 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant