You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/09/17 05:42:25 UTC

[GitHub] [pulsar] metahys opened a new pull request #12076: [C++] Support setting priority for the consumer

metahys opened a new pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076


   <!--
   ### 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
   
   #165 added support for dispatching message based on consumer priority. However, for C++ client, there is no way to set such priority on `ConsumerConfiguration`. This PR is to support setting priority for the consumer in C++ client.
   
   ### Modifications
   
     - Add `getPriorityLevel` and `setPriorityLevel` methods in  `ConsumerConfiguration`
     - Modify the function signature of `Commands::newSubscribe` to add additional parameter `priority_level` with default value 0
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change added tests and can be verified as follows:
     - Add unit test for `ConsumerConfiguration::getPriorityLevel` and `ConsumerConfiguration::setPriorityLevel` in `ConsumerConfigurationTest`
   
   ### 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)
   
   


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] merlimat merged pull request #12076: [C++] Support setting priority for the consumer

Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076


   


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] BewareMyPower commented on pull request #12076: [C++] Support setting priority for the consumer

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076#issuecomment-1022948839


   Add `release/2.8.3` label to fix conflict when cherry-picking https://github.com/apache/pulsar/pull/13883 to branch-2.8.


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] BewareMyPower commented on a change in pull request #12076: [C++] Support setting priority for the consumer

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on a change in pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076#discussion_r711558463



##########
File path: pulsar-client-cpp/lib/Commands.cc
##########
@@ -258,7 +258,8 @@ SharedBuffer Commands::newSubscribe(const std::string& topic, const std::string&
                                     const std::map<std::string, std::string>& metadata,
                                     const SchemaInfo& schemaInfo,
                                     CommandSubscribe_InitialPosition subscriptionInitialPosition,
-                                    bool replicateSubscriptionState, KeySharedPolicy keySharedPolicy) {
+                                    bool replicateSubscriptionState, KeySharedPolicy keySharedPolicy,
+                                    int priority_level) {

Review comment:
       I suggeste keeping the code style consistent with the existing code. i.e. use low camel case instead of snake case for variables.




-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] BewareMyPower commented on pull request #12076: [C++] Support setting priority for the consumer

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076#issuecomment-922262482


   There's something wrong with vcpkg build on Windows currently so that the  I'll push a fix soon.


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] BewareMyPower commented on pull request #12076: [C++] Support setting priority for the consumer

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076#issuecomment-922404823


   Please rebase to master to fix the broken CI.


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] metahys commented on pull request #12076: [C++] Support setting priority for the consumer

Posted by GitBox <gi...@apache.org>.
metahys commented on pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076#issuecomment-922443275


   It seems that `KeySharedConsumerTest`  will produce non-deterministic results due to using `rand()` to generate the key. And for some seeds used by `srand()`, the test will fail.


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] metahys commented on pull request #12076: [C++] Support setting priority for the consumer

Posted by GitBox <gi...@apache.org>.
metahys commented on pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076#issuecomment-922410748


   > Please rebase to master to fix the broken CI.
   
   PTAL @BewareMyPower, running the workflows require approval.


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] BewareMyPower removed a comment on pull request #12076: [C++] Support setting priority for the consumer

Posted by GitBox <gi...@apache.org>.
BewareMyPower removed a comment on pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076#issuecomment-1022948839


   Add `release/2.8.3` label to fix conflict when cherry-picking https://github.com/apache/pulsar/pull/13883 to branch-2.8.


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] BewareMyPower commented on pull request #12076: [C++] Support setting priority for the consumer

Posted by GitBox <gi...@apache.org>.
BewareMyPower commented on pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076#issuecomment-922446836


   > And for some seeds used by srand(), the test will fail.
   
   Yeah, it's a flaky test but now it doesn't fail frequently. You can comment `/pulsarbot run-failure-checks`  to rerun the tests.


-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] metahys commented on a change in pull request #12076: [C++] Support setting priority for the consumer

Posted by GitBox <gi...@apache.org>.
metahys commented on a change in pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076#discussion_r711568737



##########
File path: pulsar-client-cpp/lib/Commands.cc
##########
@@ -258,7 +258,8 @@ SharedBuffer Commands::newSubscribe(const std::string& topic, const std::string&
                                     const std::map<std::string, std::string>& metadata,
                                     const SchemaInfo& schemaInfo,
                                     CommandSubscribe_InitialPosition subscriptionInitialPosition,
-                                    bool replicateSubscriptionState, KeySharedPolicy keySharedPolicy) {
+                                    bool replicateSubscriptionState, KeySharedPolicy keySharedPolicy,
+                                    int priority_level) {

Review comment:
       Thanks for your suggestion, I have fixed it in the latest commit.




-- 
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-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] metahys commented on pull request #12076: [C++] Support setting priority for the consumer

Posted by GitBox <gi...@apache.org>.
metahys commented on pull request #12076:
URL: https://github.com/apache/pulsar/pull/12076#issuecomment-922478131


   > > And for some seeds used by srand(), the test will fail.
   > 
   > Yeah, it's a flaky test but now it doesn't fail frequently. You can comment `/pulsarbot run-failure-checks` to rerun the tests.
   
   OK, got it. Thanks.


-- 
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-unsubscribe@pulsar.apache.org

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