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 2022/12/20 08:16:04 UTC

[GitHub] [pulsar] lhotari opened a new pull request, #18997: [improve][broker] Omit making a copy of CommandAck when there are no broker interceptors

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

   ### Motivation
   
   While fixing a bug, #18987 introduces a performance regression to handleAck method. The copy of the CommandAck instance should only be done if there's a broker interceptor in use.
   
   ### Modifications
   
   - Use a null value to indicate that the broker interceptor is missing
   - Make changes to handle the null broker interceptor
   - Omit making a copy of CommandAck in handleAck method when there are no broker interceptors
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. Please attach the local preview screenshots (run `sh start.sh` at `pulsar/site2/website`) to your PR description, or else your PR might not get merged. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


-- 
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] codecov-commenter commented on pull request #18997: [improve][broker] Omit making a copy of CommandAck when there are no broker interceptors

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #18997:
URL: https://github.com/apache/pulsar/pull/18997#issuecomment-1359562139

   # [Codecov](https://codecov.io/gh/apache/pulsar/pull/18997?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#18997](https://codecov.io/gh/apache/pulsar/pull/18997?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1e578c9) into [master](https://codecov.io/gh/apache/pulsar/commit/22866bd19c231e85ddff4acee4dad1f895cbbc72?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (22866bd) will **decrease** coverage by `8.95%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/pulsar/pull/18997/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pulsar/pull/18997?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #18997      +/-   ##
   ============================================
   - Coverage     45.92%   36.97%   -8.96%     
   + Complexity    10104     1965    -8139     
   ============================================
     Files           680      209     -471     
     Lines         66758    14406   -52352     
     Branches       7147     1567    -5580     
   ============================================
   - Hits          30660     5326   -25334     
   + Misses        32680     8497   -24183     
   + Partials       3418      583    -2835     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | unittests | `36.97% <ø> (-8.96%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/pulsar/pull/18997?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...g/apache/pulsar/client/impl/ConnectionHandler.java](https://codecov.io/gh/apache/pulsar/pull/18997/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL0Nvbm5lY3Rpb25IYW5kbGVyLmphdmE=) | `50.00% <0.00%> (-5.32%)` | :arrow_down: |
   | [...apache/pulsar/client/impl/AutoClusterFailover.java](https://codecov.io/gh/apache/pulsar/pull/18997/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL0F1dG9DbHVzdGVyRmFpbG92ZXIuamF2YQ==) | `69.44% <0.00%> (-0.56%)` | :arrow_down: |
   | [...n/java/org/apache/pulsar/broker/PulsarService.java](https://codecov.io/gh/apache/pulsar/pull/18997/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9QdWxzYXJTZXJ2aWNlLmphdmE=) | | |
   | [...che/pulsar/broker/intercept/BrokerInterceptor.java](https://codecov.io/gh/apache/pulsar/pull/18997/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9pbnRlcmNlcHQvQnJva2VySW50ZXJjZXB0b3IuamF2YQ==) | | |
   | [...he/pulsar/broker/intercept/BrokerInterceptors.java](https://codecov.io/gh/apache/pulsar/pull/18997/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9pbnRlcmNlcHQvQnJva2VySW50ZXJjZXB0b3JzLmphdmE=) | | |
   | [...ava/org/apache/pulsar/broker/service/Producer.java](https://codecov.io/gh/apache/pulsar/pull/18997/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL1Byb2R1Y2VyLmphdmE=) | | |
   | [...pulsar/broker/service/PulsarCommandSenderImpl.java](https://codecov.io/gh/apache/pulsar/pull/18997/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL1B1bHNhckNvbW1hbmRTZW5kZXJJbXBsLmphdmE=) | | |
   | [...va/org/apache/pulsar/broker/service/ServerCnx.java](https://codecov.io/gh/apache/pulsar/pull/18997/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL1NlcnZlckNueC5qYXZh) | | |
   | [...g/apache/pulsar/broker/web/PreInterceptFilter.java](https://codecov.io/gh/apache/pulsar/pull/18997/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci93ZWIvUHJlSW50ZXJjZXB0RmlsdGVyLmphdmE=) | | |
   | [.../apache/pulsar/broker/admin/impl/PackagesBase.java](https://codecov.io/gh/apache/pulsar/pull/18997/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi9pbXBsL1BhY2thZ2VzQmFzZS5qYXZh) | | |
   | ... and [468 more](https://codecov.io/gh/apache/pulsar/pull/18997/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   


-- 
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] lhotari commented on pull request #18997: [improve][broker] Omit making a copy of CommandAck when there are no broker interceptors

Posted by GitBox <gi...@apache.org>.
lhotari commented on PR #18997:
URL: https://github.com/apache/pulsar/pull/18997#issuecomment-1359530434

   /pulsarbot rerun-failure-checks


-- 
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] michaeljmarshall commented on pull request #18997: [improve][broker] Omit making a copy of CommandAck when there are no broker interceptors

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on PR #18997:
URL: https://github.com/apache/pulsar/pull/18997#issuecomment-1361862284

   Release note: remove `BrokerInterceptorDisabled` in favor of a `null` value indicating that the interceptor is disabled.


-- 
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] lhotari commented on pull request #18997: [improve][broker] Omit making a copy of CommandAck when there are no broker interceptors

Posted by GitBox <gi...@apache.org>.
lhotari commented on PR #18997:
URL: https://github.com/apache/pulsar/pull/18997#issuecomment-1359060596

   > There are some spots where the NPE is not guarded, for example here:
   > 
   > https://github.com/apache/pulsar/blob/37ea179fa18b8be26f9e44701f3b0d5e82c608ff/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Producer.java#L274-L275
   
   Thanks @nicoloboschi, I pushed a fix. PTAL


-- 
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] lhotari merged pull request #18997: [improve][broker] Omit making a copy of CommandAck when there are no broker interceptors

Posted by GitBox <gi...@apache.org>.
lhotari merged PR #18997:
URL: https://github.com/apache/pulsar/pull/18997


-- 
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] michaeljmarshall commented on pull request #18997: [improve][broker] Omit making a copy of CommandAck when there are no broker interceptors

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on PR #18997:
URL: https://github.com/apache/pulsar/pull/18997#issuecomment-1361860336

   I cherry-picked to all of the relevant branches. My only concern is that we might end up causing issues for any custom code that runs in the broker. Even though this might break broker extensions, I think it is relevant to cherry pick this change. Otherwise, we're subject to significant performance regressions in most implementations (assuming that most users do not have broker interceptors). Maybe it's sufficient to put a note in the release notes?


-- 
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] lhotari commented on a diff in pull request #18997: [improve][broker] Omit making a copy of CommandAck when there are no broker interceptors

Posted by GitBox <gi...@apache.org>.
lhotari commented on code in PR #18997:
URL: https://github.com/apache/pulsar/pull/18997#discussion_r1053618155


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/intercept/BrokerInterceptor.java:
##########
@@ -231,44 +231,6 @@ default void onFilter(ServletRequest request, ServletResponse response, FilterCh
      */
     void initialize(PulsarService pulsarService) throws Exception;
 
-    BrokerInterceptor DISABLED = new BrokerInterceptorDisabled();

Review Comment:
   Exactly. I didn't want to add a special way to detect that. 



-- 
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] michaeljmarshall commented on a diff in pull request #18997: [improve][broker] Omit making a copy of CommandAck when there are no broker interceptors

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on code in PR #18997:
URL: https://github.com/apache/pulsar/pull/18997#discussion_r1053615934


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/intercept/BrokerInterceptor.java:
##########
@@ -231,44 +231,6 @@ default void onFilter(ServletRequest request, ServletResponse response, FilterCh
      */
     void initialize(PulsarService pulsarService) throws Exception;
 
-    BrokerInterceptor DISABLED = new BrokerInterceptorDisabled();

Review Comment:
   Is the motivation for removing this disabled interceptor to simply make it clear when we do not have an interceptor?



-- 
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