Skip to content
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

[fix][broker] Skip loading broker interceptor when disableBrokerInterceptors is true #20422

Merged
merged 1 commit into from
May 30, 2023

Conversation

nodece
Copy link
Member

@nodece nodece commented May 29, 2023

Motivation

When disableBrokerInterceptors is true, we should skip loading the broker interceptor to avoid initializing it.

This configuration is true by default, whether enabled or not, it will not affect the broker feature.

By the way, the web service and broker service should keep the same behavior:

boolean brokerInterceptorEnabled =
pulsarService.getBrokerInterceptor() != null && !config.isDisableBrokerInterceptors();
if (brokerInterceptorEnabled) {
ExceptionHandler handler = new ExceptionHandler();
// Enable PreInterceptFilter only when interceptors are enabled
filterHolders.add(
new FilterHolder(new PreInterceptFilter(pulsarService.getBrokerInterceptor(), handler)));
filterHolders.add(new FilterHolder(new ProcessHandlerFilter(pulsarService.getBrokerInterceptor())));
}

Modifications

  • Check whether disableBrokerInterceptors value, and then load the broker interceptor
  • Update disableBrokerInterceptors description

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label May 29, 2023
@nodece nodece self-assigned this May 29, 2023
@nodece
Copy link
Member Author

nodece commented May 29, 2023

/pulsarbot rerun-failure-checks

@codecov-commenter
Copy link

Codecov Report

Merging #20422 (7051026) into master (aa3bfcd) will decrease coverage by 0.01%.
The diff coverage is 90.90%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #20422      +/-   ##
============================================
- Coverage     72.90%   72.90%   -0.01%     
- Complexity    31864    31880      +16     
============================================
  Files          1864     1864              
  Lines        138416   138417       +1     
  Branches      15188    15189       +1     
============================================
- Hits         100919   100917       -2     
- Misses        29477    29489      +12     
+ Partials       8020     8011       -9     
Flag Coverage Δ
inttests 24.18% <27.27%> (+0.01%) ⬆️
systests 24.96% <27.27%> (-0.10%) ⬇️
unittests 72.18% <90.90%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...n/java/org/apache/pulsar/broker/PulsarService.java 81.68% <83.33%> (-0.43%) ⬇️
...ookkeeper/mledger/impl/ManagedLedgerMBeanImpl.java 89.31% <100.00%> (ø)
...kkeeper/mledger/impl/cache/EntryCacheDisabled.java 70.83% <100.00%> (ø)
...keeper/mledger/impl/cache/RangeEntryCacheImpl.java 58.75% <100.00%> (ø)

... and 65 files with indirect coverage changes

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nodece what is the real-world affect without this fix? Will the broker crash or thow exception?

This can be semantically correct while if we have a real world problem, we may add a test case to prevent regressions.

@nodece
Copy link
Member Author

nodece commented May 29, 2023

@tisonkun

@nodece what is the real-world affect without this fix?

Without this patch, the broker always inits the broker interceptor and calls it.

Will the broker crash or thow exception?

The broker works fine.

This can be semantically correct while if we have a real world problem, we may add a test case to prevent regressions.

Perhaps I should add a test to check this call.

…ceptors is true

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
@nodece nodece changed the title [fix][broker] Skip loading broker interceptor when disabled [fix][broker] Skip loading broker interceptor when disableBrokerInterceptors is true May 29, 2023
@nodece nodece requested a review from tisonkun May 29, 2023 08:56
@nodece nodece merged commit 639c460 into apache:master May 30, 2023
46 checks passed
@Technoboy- Technoboy- added this to the 3.1.0 milestone May 30, 2023
Technoboy- pushed a commit that referenced this pull request May 30, 2023
…ceptors is true (#20422)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
poorbarcode pushed a commit that referenced this pull request May 30, 2023
…ceptors is true (#20422)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
(cherry picked from commit 639c460)
Technoboy- added a commit to Technoboy-/pulsar that referenced this pull request Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants