Repository navigation
MLE-32970 Prevent retries of multipart streaming requests - #1979
Open
rjdew-progress wants to merge 2 commits into
Open
rjdew-progress wants to merge 2 commits into
rjdew-progress wants to merge 2 commits into
Conversation
rjdew-progress
requested review from
RitaChen609,
jonmille,
ngodugu-marklogic and
rjrudin
as code owners
September 22, 2026 23:04
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Multipart bodies wrapping InputStreamHandle may still be replayed because one-shot status is not propagated through ObjectRequestBody.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Prevents retries of multipart requests containing one-shot streaming bodies.
Changes:
- Marks
StreamingOutputImplas one-shot. - Honors OkHttp’s
isOneShot()contract in retry handling. - Adds multipart streaming regression coverage.
| File | Reviewed change |
|---|---|
marklogic-client-api/src/test/java/com/marklogic/client/impl/StreamingOutputImplTest.java |
Tests one-shot multipart behavior. |
marklogic-client-api/src/main/java/com/marklogic/client/impl/StreamingOutputImpl.java |
Declares streaming bodies as one-shot. |
marklogic-client-api/src/main/java/com/marklogic/client/impl/okhttp/RetryIOExceptionInterceptor.java |
Avoids retries for one-shot request bodies. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
rjdew-progress
marked this pull request as draft
September 23, 2026 20:34
rjdew-progress
force-pushed
the
MLE-32953
branch
from
September 24, 2026 01:07
af0a197 to
c634447
Compare
rjdew-progress
force-pushed
the
MLE-32953
branch
from
September 24, 2026 01:11
c634447 to
3c26e65
Compare
…ndability StreamingOutputImpl previously hardcoded isRetryable()=false / isOneShot()=true for every wrapped OutputStreamSender, even when the originating write handle was fully buffered and resendable (e.g. JacksonHandle, StringHandle). This meant any request body built from such a handle -- including Row Manager plan execution, document writes, and Data Services parameters -- was needlessly blocked from being retried by RetryIOExceptionInterceptor after a transient connection error, even though the content could safely be written again. Thread each call site's already-known isResendable()/handleBase.isResendable() value into StreamingOutputImpl instead of assuming non-resendable: - writeDocumentImpl-style document writes - putPostValueImpl - postResource / putResource (used by RowManagerImpl for Optic plan execution) - postIteratedResourceImpl (multipart-mixed eval/invoke style resources) - addParts multipart builder - makeRequestBodyForContent and BaseProxy's makeRequestBody (Data Services single-node parameters) Call sites without an existing resendable concept (structured query search, alert match) keep the prior conservative false/one-shot default via new 3-arg doPost/doPut overloads, so behavior is unchanged where resendability was never determined. Added StreamingOutputImplTest cases covering: a resendable body being retried after a simulated connection failure, and a non-resendable part inside a MultipartBody still propagating isOneShot()=true so it is never retried. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rjdew-progress
marked this pull request as ready for review
October 8, 2026 18:51
rjdew-progress
requested review from
NiteshMehta,
adganta,
ashokrprogress,
hmadala001,
prgs-rsingh and
vishwach
as code owners
October 8, 2026 18:51
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.

Why
A Data Services request with streaming multipart input can fail with
Stream closedafter a preceding gzipped Row Manager response. The IOException retry interceptor sees only the outerMultipartBody, so it can retry the request even though a nestedStreamingOutputImplhas already consumed and closed its source.Approach
StreamingOutputImplas one-shot using OkHttp's nativeRequestBody.isOneShot()contract.isOneShot()in addition to the Java Client'sRetryableRequestBodycontract.MultipartBodyand prevents a second request attempt.Validation
./gradlew marklogic-client-api:test --tests com.marklogic.client.impl.StreamingOutputImplTestlocalhost:8012.