equanz opened a new pull request #11382:
URL: https://github.com/apache/pulsar/pull/11382


   ### Motivation
   
   If replicated subscription is enabled, broker will create new subscription 
in remote cluster at below.
   
https://github.com/apache/pulsar/blob/a14f1c5940fe656348b6d7d326596358f43dcbc9/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/ReplicatedSubscriptionsController.java#L188-L189
   
   This step is started when update marker message is received in remote 
cluster. This message is created from local cluster at below. It requires 
snapshot cache(and snapshot marker message as well).
   
https://github.com/apache/pulsar/blob/a14f1c5940fe656348b6d7d326596358f43dcbc9/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java#L405-L413
   
   Snapshot marker message is created in local cluster when snapshot response 
marker message is received from remote cluster. Snapshot response marker 
message is published from replicator producer in remote cluster.
   
https://github.com/apache/pulsar/blob/a14f1c5940fe656348b6d7d326596358f43dcbc9/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/ReplicatedSubscriptionsController.java#L158
   
   Therefore, when remote cluster's replicator producer is closed, then local 
cluster won't be able to create update message in the corner case. It causes 
that no new subscription will be created in remote cluster.
   
   For example, if unsubscribe the subscription and checkGC is started in 
remote cluster, broker will close replicator producer.
   
   ### Modifications
   
   * Restart replicator producer when snapshot request is received
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change added tests and can be verified as follows:
   
   * Added test for replicated subscription
     - Local cluster will replicate subscription to remote clusters correctly 
even if remote cluster's replicator producer is already closed.
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API: (no)
     - The schema: (no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - The admin cli options: (no)
     - Anything that affects deployment: (no)
   
   ### Documentation
   
   #### For contributor
   
   For this PR, do we need to update docs?
   
   No. Because this is one of the bug fixes.
   
   #### For committer
   
   For this PR, do we need to update docs?
   
   - If yes,
     
     - if you update docs in this PR, label this PR with the `doc` label.
     
     - if you plan to update docs later, label this PR with the `doc-required` 
label.
   
     - if you need help on updating docs, create a follow-up issue with the 
`doc-required` label.
     
   - If no, label this PR with the `no-need-doc` label and explain why.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to