GeezerVison is showing github.com — [fix][broker] Return errors for discarded ACKs with receipts by AuroraTwinkle · Pull Request #27128 · apache/pulsar
Conversation
Fixes #23261
Motivation
With ACK receipts enabled, an acknowledgment discarded during topic transfer or after a consumer becomes unavailable receives no response. The client waits for its request timeout even though the broker already knows that it will not process the ACK.
Modifications
- Return an ACK response with
ServiceNotReady when the topic is transferring, and ConsumerNotFound when the consumer is missing or its subscription future is pending, failed or cancelled.
- Send these errors only when the ACK carries a request ID. Preserve ACK handling without receipts, the ignored-ACK counter during transfer, and the normal asynchronous completion path.
- Add protocol regressions and an end-to-end topic-unload regression using a real broker, bookie and Java client.
The end-to-end test delays an in-flight ACK, unloads its topic through the admin API, and then forwards the original ACK frame. It checks that the client ACK future fails with the correlated ConsumerNotFound response. The close-consumer notification remains delayed until a second producer successfully publishes on the same connection, ensuring that a disconnect cannot account for the failed ACK. The test covers individual and cumulative ACKs, with successful no-unload controls.
Verifying this change
- Make sure that the change passes the CI checks.
Against the original ServerCnx implementation, the two end-to-end unload cases fail while waiting for the missing ACK response; both no-unload controls pass.
With the fix, 40 tests passed, with zero failures, errors or skipped tests and retries disabled:
AckReceiptOnTopicUnloadTest: four end-to-end cases.
ServerCnxTest.testAck*: 15 protocol cases covering unavailable consumers, topic transfer, receipt mode on/off, request/consumer ID correlation, and normal asynchronous ACK success/failure.
ConsumerTest: 19 existing ACK state/completion cases.
PulsarCommandSenderImplTest: two existing serialization cases.
Repository-wide sanityCheck, including quickCheck, passed. Full CI for this revision is not yet verified.
./gradlew :pulsar-broker:test \
--tests 'org.apache.pulsar.broker.service.AckReceiptOnTopicUnloadTest' \
--tests 'org.apache.pulsar.broker.service.ServerCnxTest.testAck*' \
--tests 'org.apache.pulsar.broker.service.ConsumerTest' \
--tests 'org.apache.pulsar.broker.service.PulsarCommandSenderImplTest' \
-PtestRetryCount=0 -PtestFailFast=false -PtestMaxParallelForks=1 sanityCheck
Does this pull request potentially affect one of the following parts:
- Dependencies (add or upgrade a dependency)
- The public API
- The schema
- The default values of configurations
- The threading model
- The binary protocol
- The REST endpoints
- The admin CLI options
- The metrics
- Anything that affects deployment
Discarded ACKs that request receipts now receive an existing ACK_RESPONSE error instead of waiting for a timeout. No command, field or error code is added.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Respond to ACKs carrying a request ID when their consumer is unavailable
or their topic is transferring, instead of leaving the client waiting
for a timeout. Preserve ACK handling without receipts and transfer
statistics. Add protocol regressions and asynchronous completion controls.
Fixes apache#23261
Assisted-by: OpenAI Codex
Uh oh!
There was an error while loading. Please reload this page.
Delay an in-flight ACK until the admin API unloads its topic, then check
that the Java client's ACK future receives the correlated error response.
Cover individual and cumulative ACKs, with no-unload success controls.
Verify a second producer can still publish on the same connection while
the close notification is delayed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
danrubAtPlanview
added a commit
to danrubAtPlanview/pulsar-dotpulsar
that referenced
this pull request
Nov 1, 2026
Three fixtures hard-coded apachepulsar/pulsar:4.0.9, and the three
tests that need a broker fix that no published image has were skipped
with a static Skip. They could only run after someone edited the code.
BrokerImage reads two variables:
- DOTPULSAR_TESTS_PULSAR_IMAGE replaces the default image
- DOTPULSAR_TESTS_BROKER_FIXES lists the apache/pulsar pull requests
that the image has, for example 27128,27082
The two unload rows of ConsumerTests (apache/pulsar#27128) and the
row of TopicTransactionBufferPublishOrderTests (#27082) are skipped
unless their number is in the list, with a message that says how to
run them. Without the variables nothing changes: the same 14
integration tests are skipped. With DOTPULSAR_TESTS_BROKER_FIXES set
on the default image the two ConsumerTests rows run and fail with the
ack receipt timeout, which is the bug in that image.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Nov 21, 2026
Uh oh!
There was an error while loading. Please reload this page.
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.
|