-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: Backpressure
-
None
-
Java Drivers
-
None
-
None
-
None
-
None
-
None
-
None
ClientBulkWriteOperation currently uses an onNotTryingToStartTransaction(...) hook to clear transaction-starting state before inner commands such as getMore are encoded.
A more general approach would be to introduce a wire-level success notification on SessionContext and call it from the common command execution path.
For example:
void notifyMessageProcessedSuccessfully();
The notification would be called from CommandProtocolImpl on the success path only, for both sync and async execution. ok:0 responses already throw before this point via ProtocolHelper.getCommandFailureException(...), so failure and retry handling would remain owned by the retry policy. The wire layer would not need to inspect error labels.
Rationale
Every command flows through the common command execution funnel:
DefaultServerConnection.command(...) -> CommandProtocolImpl -> CommandMessage
Adding the notification at this level would allow successful outer command execution to clear the relevant session flag before any inner command is encoded.
See: https://github.com/mongodb/mongo-java-driver/pull/2041#discussion_r3833967447
Related consideration:
OverloadStateSuspendedSessionContext was added to disable overload state handling for internal commands. As part of this ticket, we should decide whether to keep that shape or refactor it into the broader SessionContext notification model.
- is caused by
-
JAVA-6019 Client Backpressure: overload retry policy
-
- Development Complete
-