TakaHiro0208 opened a new pull request, #15217:
URL: https://github.com/apache/pulsar/pull/15217

   
   
   ### Motivation
   I encounter the same problem as #11682 described, and i notice two pr for 
it, #10374 and #11683
   
   But I think they still remain problems.
   
   Actually internalUpdatePartitionedTopic consist of three part:
   1. tryCreatePartitionsAsync(): create the topic newPartition on 
metadataStore such as zk
   2. createSubscriptions(): creates subscriptions for new partitions of 
existing partitioned-topics
   3. updatePartitionedTopicAsync(): update the partitioned-topic 
metadata(update partition num to newPartition)
   
   Suppose there are subscriptions in a partitioned-topic and we want to update 
its partition.
   
   If part 1, 2 succeed, part 3 failed, it need to clean up managed-ledger 
znode. But it would throw zookeeper Directory not empty exception when 
clean-up, since znode would has successfully created subscription children 
node. 
   
   
![wecom-temp-977f0ae410a236f38d7822fc12d653b6](https://user-images.githubusercontent.com/13505225/163978509-150292e3-8ff8-4ccf-94e7-6bd465b479d8.png)
   
   
   And when we retrying updatePartition again, it would throw the below error 
because part 2 complete 
   
![wecom-temp-96b53fea557f4984494a8d213872f1d3](https://user-images.githubusercontent.com/13505225/163978565-27750a2b-5fe8-4fa0-a30e-dd58296ad60e.png)
   
   
   So we need to retry updatePartition again with "force=true". The 
"Subscription already exists" error would be catch, and it complete the 
updatePartition operation, while permanently skip the part 3.
   
   
   ### Modifications
   
   After catch the "Subscription already exists" error, do 
updatePartitionedTopicAsync() operation
   
   ### discussions
   
   When adding 'force=true' , the managed-ledger znode clean up operation seems 
not neccessary and can be removed?
   
   
   ### 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
   
   Check the box below or label this PR directly.
   
   Need to update docs? 
   
   - [ ] `doc-required` 
   (Your PR needs to update docs and you will update later)
     
   - [x ] `no-need-doc` 
   (Please explain why)
     
   - [ ] `doc` 
   (Your PR contains doc changes)
   
   - [ ] `doc-added`
   (Docs have been already added)


-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to