Skip to content

[fix][broker] Fix delayed-delivery bucket merge failures when delayedDeliveryMaxNumBuckets is 1-3 - #26242

Merged
nodece merged 3 commits into
apache:masterfrom
void-ptr974:fix/bucket-delayed-merge-selector
Jul 29, 2026
Merged

[fix][broker] Fix delayed-delivery bucket merge failures when delayedDeliveryMaxNumBuckets is 1-3#26242
nodece merged 3 commits into
apache:masterfrom
void-ptr974:fix/bucket-delayed-merge-selector

Conversation

@void-ptr974

Copy link
Copy Markdown
Contributor

Fixes #26241

Motivation

When delayedDeliveryMaxNumBuckets is set to 1, 2, or 3, the first
bucket-limit overflow contains 2, 3, or 4 immutable buckets. The merge
selector requires more than four buckets and throws IllegalArgumentException,
which fails the merge future and skips that compaction attempt.

The selector also uses an off-by-one timestamp index for the next unloaded
snapshot segment. It can throw when only one unloaded segment remains or select
a merge window using a later segment's timestamp.

Modifications

  • Select up to the available number of buckets, bounded by MAX_MERGE_NUM.
  • Preserve the existing preference for the largest eligible merge group.
  • Use the zero-based timestamp index for the next unloaded snapshot segment.
  • Add regression tests for small bucket limits, a single remaining unloaded
    segment, and merge-window timestamp selection.

Verifying this change

  • Ran focused BucketDelayedDeliveryTrackerTest merge, segment, and trim
    tests with :pulsar-broker:test -PtestRetryCount=0.
  • Ran :pulsar-broker:checkstyleMain :pulsar-broker:checkstyleTest.

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

@nodece

nodece commented Jul 28, 2026

Copy link
Copy Markdown
Member

@void-ptr974 Please check conflicts.

Resolve the delayed-delivery test conflicts.
@nodece
nodece merged commit a107d51 into apache:master Jul 29, 2026
81 of 83 checks passed
@nodece nodece added this to the 5.0.0-M2 milestone Jul 29, 2026
lhotari pushed a commit that referenced this pull request Aug 4, 2026
…DeliveryMaxNumBuckets is 1-3 (#26242)

(cherry picked from commit a107d51)
lhotari pushed a commit that referenced this pull request Aug 4, 2026
…DeliveryMaxNumBuckets is 1-3 (#26242)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Bucket delayed delivery fails to merge when setting delayedDeliveryMaxNumBuckets to 1-3

3 participants