New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improve][broker] Omit making a copy of CommandAck when there are no broker interceptors #18997
[improve][broker] Omit making a copy of CommandAck when there are no broker interceptors #18997
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some spots where the NPE is not guarded, for example here:
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Producer.java
Lines 274 to 275 in 37ea179
this.cnx.getBrokerService().getInterceptor() | |
.onMessagePublish(this, headersAndPayload, messagePublishContext); |
Thanks @nicoloboschi, I pushed a fix. PTAL |
…broker interceptors
81f4852
to
1e578c9
Compare
/pulsarbot rerun-failure-checks |
Codecov Report
@@ Coverage Diff @@
## master #18997 +/- ##
============================================
- Coverage 45.92% 41.46% -4.47%
+ Complexity 10104 2399 -7705
============================================
Files 680 235 -445
Lines 66758 16652 -50106
Branches 7147 1812 -5335
============================================
- Hits 30660 6904 -23756
+ Misses 32680 8992 -23688
+ Partials 3418 756 -2662
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for catching the regression in my earlier PR.
pulsar-broker/src/main/java/org/apache/pulsar/broker/intercept/BrokerInterceptor.java
Show resolved
Hide resolved
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? |
Release note: remove |
…broker interceptors (apache#18997) (cherry picked from commit 1154d0a) (cherry picked from commit b75f068) (cherry picked from commit cc781f7)
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
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: lhotari#114