pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[improve] [broker] Handle ReplicatedSubscriptionsSnapshots when it arrives to fix issues in replicating subscription state to remote clusters

Open lhotari opened this issue 3 years ago • 9 comments

Fixes #10054

Motivation

There's a long-standing issue #10054 where replicated subscriptions were not working correctly across clusters. The test case testReplicatedSubscriptionAcrossTwoRegions demonstrate the issue:

https://github.com/apache/pulsar/blob/a1a2b363cfaa1bbc38933a742484a70a0a56e761/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatedSubscriptionTest.java#L107-L116

the test has been passing only when allowing duplicates (allowDuplicates = true in test case) in received messages, thus subscription replication is not working as expected.

Modifications

  • Handle ReplicatedSubscriptionsSnapshot when it arrives, passing the current mark delete position to the update.
  • move the previous logic to handle the snapshot to notifyTheMarkDeletePositionMoveForwardIfNeeded. Since the snapshot handling is idempotent, it's okay to handle it in both when the snapshot arrives or when the mark delete position moves forward.

Documentation

  • [ ] doc
  • [ ] doc-required
  • [x] doc-not-needed
  • [ ] doc-complete

lhotari avatar Jul 18 '22 10:07 lhotari

@lhotari Please provide a correct documentation label for your PR. Instructions see Pulsar Documentation Label Guide.

github-actions[bot] avatar Jul 18 '22 11:07 github-actions[bot]

The pr had no activity for 30 days, mark with Stale label.

github-actions[bot] avatar Aug 25 '22 02:08 github-actions[bot]

@codelipenghui PTAL

yangl avatar Feb 28 '23 06:02 yangl

Since we will start the RC version of 3.0.0 on 2023-04-11, I will change the label/milestone of PR who have not been merged.

  • The PR of type feature/improve is deferred to 3.1.0
  • The PR of type fix is deferred to 3.0.1

So drag this PR to 3.0.1

poorbarcode avatar Apr 10 '23 14:04 poorbarcode

/pulsarbot rerun-failure-checks

lhotari avatar Nov 24 '23 07:11 lhotari