BewareMyPower opened a new pull request #6732: Auto update topic partitions for 
C++ client
URL: https://github.com/apache/pulsar/pull/6732
 
 
   <!--
   ### Contribution Checklist
     
     - Name the pull request in the form "[Issue XYZ][component] Title of the 
pull request", where *XYZ* should be replaced by the actual issue number.
       Skip *Issue XYZ* if there is no associated github issue for this pull 
request.
       Skip *component* if you are unsure about which is the best component. 
E.g. `[docs] Fix typo in produce method`.
   
     - Fill out the template below to describe the changes contributed by the 
pull request. That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue, not mix up code from 
multiple issues.
     
     - Each commit in the pull request has a meaningful commit message
   
     - Once all items of the checklist are addressed, remove the above text and 
this checklist, leaving only the filled out template below.
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ### Motivation
   
   We need to increase producers or consumers when partitions updated.
   
   Java client has implemented this feature, see 
[#3513](https://github.com/apache/pulsar/pull/3513). This PR trys to implement 
the same feature in C++ client.
   
   ### Modifications
   
   - Add a `boost::asio::deadline_timer` to `PartitionedConsumerImpl` and 
`PartitionedProducerImpl` to register lookup task to detect partitions changes 
periodly;
   - Add an `unsigned int` configuration parameter to indicate the period 
seconds of detecting partitions change (default: 60 seconds);
   - Unlock the `mutex_` in `PartitionedConsumerImpl::receive` after `state_` 
were checked. 
   > Explain: When new consumers are created, 
`handleSinglePartitionConsumerCreated` will be called finally, which tried to 
lock the `mutex_`. It may happen that `receive` acquire the lock again and 
again so that `handleSinglePartitionConsumerCreated` 
   are blocked in `lock.lock()` for a long time.
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change added tests and can be verified as follows:
   
   Run  `PartitionsUpdateTest` test suite after the cmake build.
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes)
     - If yes, how is the feature documented? (docs)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a followup 
issue for adding the documentation
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to