[Broker] Skip response when producerFuture is already complete #13247
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.
Motivation
This PR fixes an issue introduced in branch-2.7 by one of my commits. @codelipenghui has some context in this PR #13245 and proposes the opposite solution.
The behavior here aligns with d12486b. Because
branch-2.7
does not have this commit, one of my tests in the cherry picked commits is failing.I think we need to update
branch-2.7
to be likemaster
and to only respond if the future is completed by this exception. From my perspective, the contract in the class is that if a thread completes the future, it should also send (or intentionally not send) a response. In the failing test case, the producer future is completed by aCloseProducer
command.Alternatively, we could update the test if we don't want to change this client behavior.
Modifications
producerFuture
is not already completed.Verifying this change
I verified this test by running the
ServerCnxTest
locally with the proposed change. It passed. This change is also already i master.Does this pull request potentially affect one of the following parts:
This change affects the binary protocol because it skips sending a response to the client. However, it only skips it when the future is already completed, and the completion implies that the
ServerCnx
has already handled the request.Documentation
no-need-doc