Skip to content

[fix][broker] Prevent partition expansion from inheriting delayed-delivery bucket state#26179

Open
void-ptr974 wants to merge 1 commit into
apache:masterfrom
void-ptr974:fix/partition-expansion-delayed-bucket-state
Open

[fix][broker] Prevent partition expansion from inheriting delayed-delivery bucket state#26179
void-ptr974 wants to merge 1 commit into
apache:masterfrom
void-ptr974:fix/partition-expansion-delayed-bucket-state

Conversation

@void-ptr974

Copy link
Copy Markdown
Contributor

Fixes #26178

Motivation

When increasing partitions, Pulsar copies durable subscription properties from
partition-0 to new partitions.

Bucket delayed delivery stores cursor-local snapshot metadata as
#pulsar.internal.delayed.bucket*. Copying that state makes a new partition
recover delayed-message indexes that belong to partition-0, which can result in
incorrect delayed-delivery state and invalid replay attempts.

Modifications

Filter #pulsar.internal.* properties before creating subscriptions on new
partitions. User-defined subscription properties are still copied.

Existing cursor-property and stats exposure is unchanged.

Verifying this change

  • Added partition-expansion coverage for internal cursor properties.
  • Added bucket delayed-delivery coverage that activates the new partition's
    tracker and verifies it recovers zero delayed messages.
  • ./gradlew --no-daemon --console=plain :pulsar-broker:test --tests org.apache.pulsar.broker.admin.IncrementPartitionsTest --tests org.apache.pulsar.broker.service.persistent.BucketDelayedDeliveryTest
  • ./gradlew --no-daemon --console=plain :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

@void-ptr974 void-ptr974 force-pushed the fix/partition-expansion-delayed-bucket-state branch from 3613eb5 to 6fc0a4b Compare July 11, 2026 06:22
Comment on lines +464 to +466
Map<String, String> subscriptionProperties =
filterSubscriptionPropertiesForPartitionExpansion(
entry.getValue().getSubscriptionProperties());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filtering here addresses partition expansion, but since #26159, the Admin getSubscriptionProperties endpoint returns raw cursor properties, including #pulsar.internal.*, while updateSubscriptionProperties delegates to ManagedCursorImpl#setCursorProperties, which rejects maps containing that prefix. Consequently, a GET → modify → PUT cycle can fail once bucket state exists. Should we note a follow-up to restore the user/internal property boundary for instance, by exposing filtered user properties through the Admin API while keeping raw cursor properties accessible only to broker internals?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Partition expansion copies delayed-delivery bucket state to new partitions

2 participants