GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [fix][broker] Preserve unacked backpressure for stale redelivery requests by Denovo1998 · Pull Request #26910 · apache/pulsar

Conversation

@Denovo1998

@Denovo1998 Denovo1998 commented Oct 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Follow-up to #26797.

Motivation

A persistent Shared or Key_Shared consumer can reach its unacknowledged-message limit and become blocked. A selective-redelivery request containing only stale IDs or zero-count pending positions can clear the blocked state and transfer deferred flow permits without removing any unacknowledged messages. However, a zero remaining count does not prove that all batch indexes are acknowledged: a rejected conflicting transactional ACK can leave an untouched index that still needs replay. Such requests must preserve backpressure while retaining the replay path for matching positions.

Modifications

  • Preserve unacked backpressure and deferred flow permits when a selective-redelivery request removes zero unacknowledged messages.
  • Keep matching zero-count pending positions eligible for replay: a rejected transactional batch ACK can leave unacknowledged indexes at such a position. Release backpressure only when the request removes unacknowledged messages.
  • Add regression coverage for Shared and Key_Shared consumers using real client, broker, and BookKeeper fixtures.

Verifying this change

  • Make sure that the change passes the CI checks.

Added ConsumerRedeliveryTest.testStaleSelectiveRedeliveryDoesNotUnblockConsumer, testZeroCountSelectiveRedeliveryPreservesBackpressure, and testSelectiveRedeliveryAfterConflictingTransactionalBatchAck.

The tests verify that stale IDs and zero-count requests preserve unacked backpressure, and that a rejected conflicting transactional ACK does not prevent selective redelivery of untouched batch indexes. The conflict cases cover zero-count-only and mixed requests for Shared and Key_Shared consumers. The zero-count backpressure cases pause the transaction executor while a real batch-index ACK updates consumer accounting, keeping the pending entry present until the transaction ACK completes.

The four conflict variants pass on the original broker logic, fail with the zero-count replay filter, and pass after this fix.

./gradlew --no-parallel --max-workers=2 :pulsar-broker:test \
  -PtestMaxParallelForks=1 -PtestRetryCount=0 \
  --tests ConsumerRedeliveryTest.testStaleSelectiveRedeliveryDoesNotUnblockConsumer \
  --tests ConsumerRedeliveryTest.testZeroCountSelectiveRedeliveryPreservesBackpressure \
  --tests ConsumerRedeliveryTest.testSelectiveRedeliveryAfterConflictingTransactionalBatchAck \
  --tests ConsumerBlockedPermitAccountingTest \
  --tests SharedDispatcherPermitAccountingTest

./gradlew --no-parallel --max-workers=2 quickCheck

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Denovo1998 added 2 commits October 14, 2026 20:32
@Denovo1998
[fix][broker] Preserve unacked backpressure for stale redelivery requ…
ba05f73
…ests
@Denovo1998
[fix][broker] Preserve unacked backpressure for stale redelivery requ…
9314cd4
…ests
codelipenghui
codelipenghui requested changes Oct 15, 2026
View reviewed changes

@codelipenghui codelipenghui left a comment

Copy link
Copy Markdown
Contributor

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.

Reviewed head: 9314cd405c8084ff6ee7ad710c788cd873e5513f.

The stale-request backpressure fix is appropriately scoped, but the new zero-count replay filter relies on an invariant that the current transactional ACK path does not guarantee. Requesting changes for the inline P2 finding: a rejected duplicate transactional batch ACK can reduce the remaining count to zero while another batch index is still unacknowledged, and this change discards its previously viable selective-redelivery path.

Please address that accounting/replay interaction and add a regression covering a conflicting transactional ACK followed by selective redelivery of the untouched batch index. The added zero-count test covers ACKs of different indexes that eventually succeed, not this rejected-ACK case.

Validation limitation: the finding is source-traced, not runtime-reproduced. Local focused validation encountered an out-of-worktree Kotlin daemon write denied with Operation not permitted; all validation launches were stopped. There are no independently verified test passes or assertion failures, and the unpatched baseline and the conflict scenario were not run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Denovo1998
[fix][broker] Preserve unacked backpressure for stale redelivery requ…
cc3508f
…ests
@Denovo1998
Denovo1998 requested a review from codelipenghui October 15, 2026 12:57
codelipenghui
codelipenghui approved these changes Oct 15, 2026
View reviewed changes

@codelipenghui codelipenghui left a comment

Copy link
Copy Markdown
Contributor

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.

Re-reviewed cc3508f55005c6fd21b56c4bc03973ad5a7109d6 against the previously reviewed 9314cd405c8084ff6ee7ad710c788cd873e5513f.

The previous P2 is addressed. Matching zero-count positions remain eligible for replay, while a request that removes no unacknowledged messages no longer clears the blocked state or releases deferred permits. This preserves the recovery path without expanding the change into transactional accounting redesign.

No actionable findings identified within the reviewed scope.

Validation:

  • All 8 targeted cases actually ran and passed on the current head: stale selective redelivery (2), zero-count backpressure (2), and conflicting transactional batch ACK replay (4).
  • As a negative control, I temporarily restored only the previous production logic while retaining the new tests. The Shared/zero-count conflict case failed as expected because the untouched batch index was not redelivered. The run stopped at that first failure; the other baseline variants were not independently executed.
  • The source was fully restored and verified against the current head. The final Gradle check succeeded using cached test results, so it is not counted as a second independent test execution.
  • The full suite was not run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@codelipenghui codelipenghui assigned Denovo1998 Oct 16, 2026
@codelipenghui codelipenghui added this to the 5.1.0 milestone Oct 16, 2026
@codelipenghui
codelipenghui merged commit 90f174d into apache:master Oct 16, 2026
44 of 45 checks passed

Uh oh!

There was an error while loading. Please reload this page.

lhotari pushed a commit that referenced this pull request Oct 16, 2026
@Denovo1998 @lhotari
[fix][broker] Preserve unacked backpressure for stale redelivery requ…
acde3cd
…ests (#26910)

(cherry picked from commit 90f174d)
@lhotari lhotari added release/5.0.1 cherry-picked/branch-5.0 release/4.2.6 release/4.0.15 labels Oct 16, 2026
lhotari pushed a commit that referenced this pull request Oct 16, 2026
@Denovo1998 @lhotari
[fix][broker] Preserve unacked backpressure for stale redelivery requ…
502de9c
…ests (#26910)

(cherry picked from commit 90f174d)
lhotari pushed a commit that referenced this pull request Oct 16, 2026
@Denovo1998 @lhotari
[fix][broker] Preserve unacked backpressure for stale redelivery requ…
5e745d5
…ests (#26910)

(cherry picked from commit 90f174d)
@lhotari lhotari added cherry-picked/branch-4.2 cherry-picked/branch-4.0 labels Oct 17, 2026
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Nov 16, 2026
@Denovo1998 @nodece
[fix][broker] Preserve unacked backpressure for stale redelivery requ…
9c31ada
…ests (apache#26910)

(cherry picked from commit 90f174d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@codelipenghui codelipenghui codelipenghui approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@Denovo1998 Denovo1998

Labels

cherry-picked/branch-4.0 cherry-picked/branch-4.2 cherry-picked/branch-5.0 release/4.0.15 release/4.2.6 release/5.0.1

Projects

None yet

Milestone

5.1.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Denovo1998 @codelipenghui @lhotari
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.