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] Revert "Skip loading broker interceptor when disableBrokerInterceptors is true #20422" #20710

Merged
merged 1 commit into from
Jul 5, 2023

Conversation

Technoboy-
Copy link
Contributor

@Technoboy- Technoboy- commented Jul 4, 2023

Motivation

After merging #20422 , the 2.11 may encounter NPE when config :

brokerInterceptors = xxx-interceptor
disableBrokerInterceptors = true
image
2023-07-03T10:26:00,507+0000 [main] INFO  org.apache.pulsar.broker.intercept.BrokerInterceptors - Skip loading the broker interceptors when disableBrokerInterceptors is true

See code of branch-2.11

public ProcessHandlerFilter(PulsarService pulsar) {
this.interceptor = pulsar.getBrokerInterceptor();
this.interceptorEnabled = !pulsar.getConfig().getBrokerInterceptors().isEmpty();
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
if (interceptorEnabled
&& !StringUtils.containsIgnoreCase(request.getContentType(), MediaType.MULTIPART_FORM_DATA)
&& !StringUtils.containsIgnoreCase(request.getContentType(), MediaType.APPLICATION_OCTET_STREAM)) {
interceptor.onFilter(request, response, chain);
} else {
chain.doFilter(request, response);
}
}

public static BrokerInterceptor load(ServiceConfiguration conf) throws IOException {
if (conf.isDisableBrokerInterceptors()) {
log.info("Skip loading the broker interceptors when disableBrokerInterceptors is true");
return null;
}

The master branch has fixed the NPE by #19376. it's hard to cherry-pick that to branch-2.11.
So in order to keep the same logic, we need to revert #20422 first and then discuss if we should keep disableBrokerInterceptors in the mail list.

Documentation

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

@Technoboy- Technoboy- self-assigned this Jul 4, 2023
@Technoboy- Technoboy- added this to the 3.1.0 milestone Jul 4, 2023
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jul 4, 2023
@Technoboy- Technoboy- closed this Jul 4, 2023
@Technoboy- Technoboy- reopened this Jul 4, 2023
@tisonkun tisonkun requested a review from nodece July 4, 2023 05:38
@Technoboy- Technoboy- closed this Jul 4, 2023
@Technoboy- Technoboy- reopened this Jul 4, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #20710 (dd355b1) into master (d85b995) will increase coverage by 2.13%.
The diff coverage is 16.21%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #20710      +/-   ##
============================================
+ Coverage     34.70%   36.83%   +2.13%     
- Complexity    11994    12181     +187     
============================================
  Files          1694     1691       -3     
  Lines        129459   130030     +571     
  Branches      14132    14229      +97     
============================================
+ Hits          44925    47900    +2975     
+ Misses        78571    75844    -2727     
- Partials       5963     6286     +323     
Flag Coverage Δ
inttests 24.21% <10.81%> (?)
systests 24.99% <13.51%> (+<0.01%) ⬆️
unittests 32.01% <31.57%> (+0.13%) ⬆️

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

Impacted Files Coverage Δ
...org/apache/pulsar/broker/ServiceConfiguration.java 98.04% <ø> (ø)
...in/java/org/apache/pulsar/PulsarBrokerStarter.java 28.14% <ø> (-3.00%) ⬇️
.../org/apache/pulsar/PulsarClusterMetadataSetup.java 16.37% <ø> (+16.37%) ⬆️
...g/apache/pulsar/PulsarClusterMetadataTeardown.java 71.71% <ø> (+71.71%) ⬆️
...org/apache/pulsar/PulsarInitialNamespaceSetup.java 0.00% <ø> (ø)
...ava/org/apache/pulsar/PulsarStandaloneStarter.java 29.23% <ø> (ø)
...sar/PulsarTransactionCoordinatorMetadataSetup.java 50.00% <ø> (+50.00%) ⬆️
...n/java/org/apache/pulsar/PulsarVersionStarter.java 0.00% <ø> (ø)
...he/pulsar/broker/intercept/BrokerInterceptors.java 6.95% <ø> (-2.37%) ⬇️
...pache/pulsar/broker/tools/GenerateDocsCommand.java 0.00% <ø> (ø)
... and 13 more

... and 185 files with indirect coverage changes

Copy link
Member

@nodece nodece left a comment

Choose a reason for hiding this comment

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

Why not fix the branch-2.11? I think this is the correct behavior that skips loading broker interceptor when disableBrokerInterceptors is true.

@Technoboy-
Copy link
Contributor Author

Why not fix the branch-2.11? I think this is the correct behavior that skips loading broker interceptor when disableBrokerInterceptors is true.

If fix 2.11, both master and 2.11 use disableBrokerInterceptors for judgment, but other branches do not

@Technoboy-
Copy link
Contributor Author

Technoboy- commented Jul 5, 2023

Why not fix the branch-2.11? I think this is the correct behavior that skips loading broker interceptor when disableBrokerInterceptors is true.

We need to discuss this disableBrokerInterceptors , as when it was introduced by #8157 (pulsar-2.7), it uses for test only.

Copy link
Contributor

@codelipenghui codelipenghui left a comment

Choose a reason for hiding this comment

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

I support reverting it first and then finding a solution to fix the bug. Just to avoid any potential break changes introduced to the subsequent releases.

@Technoboy- Technoboy- merged commit efea294 into apache:master Jul 5, 2023
113 of 121 checks passed
Technoboy- added a commit that referenced this pull request Jul 5, 2023
Technoboy- added a commit that referenced this pull request Jul 5, 2023
@Technoboy- Technoboy- deleted the revert-20422 branch November 11, 2023 07:26
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

7 participants