You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by te...@apache.org on 2023/08/21 06:27:01 UTC

[pulsar] branch master updated: [improve][broker] PIP-293: Delete config disableBrokerInterceptors (#20995)

This is an automated email from the ASF dual-hosted git repository.

technoboy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 0d25e9ac3eb [improve][broker] PIP-293: Delete config disableBrokerInterceptors  (#20995)
0d25e9ac3eb is described below

commit 0d25e9ac3eb96221d0527162b6731174bbf39c0d
Author: Jiwei Guo <te...@apache.org>
AuthorDate: Mon Aug 21 14:26:55 2023 +0800

    [improve][broker] PIP-293: Delete config disableBrokerInterceptors  (#20995)
---
 .../main/java/org/apache/pulsar/broker/ServiceConfiguration.java    | 6 ------
 .../src/main/java/org/apache/pulsar/broker/web/WebService.java      | 3 +--
 .../org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java   | 1 -
 .../pulsar/broker/intercept/ExceptionsBrokerInterceptorTest.java    | 1 -
 .../org/apache/pulsar/broker/testcontext/PulsarTestContext.java     | 3 ---
 .../java/org/apache/pulsar/broker/web/ProcessHandlerFilterTest.java | 1 -
 6 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
index 3d73734e827..25b6ac75e0e 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
@@ -1354,12 +1354,6 @@ public class ServiceConfiguration implements PulsarConfiguration {
     )
     private Set<String> brokerInterceptors = new TreeSet<>();
 
-    @FieldContext(
-        category = CATEGORY_SERVER,
-        doc = "Enable or disable the broker interceptor, which is only used for testing for now"
-    )
-    private boolean disableBrokerInterceptors = true;
-
     @FieldContext(
             category = CATEGORY_SERVER,
             doc = "List of interceptors for payload processing.")
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java
index eada0436f4d..902593b7bf6 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java
@@ -213,8 +213,7 @@ public class WebService implements AutoCloseable {
                         new RateLimitingFilter(config.getHttpRequestsMaxPerSecond())));
             }
 
-            boolean brokerInterceptorEnabled =
-                    pulsarService.getBrokerInterceptor() != null && !config.isDisableBrokerInterceptors();
+            boolean brokerInterceptorEnabled = pulsarService.getBrokerInterceptor() != null;
             if (brokerInterceptorEnabled) {
                 ExceptionHandler handler = new ExceptionHandler();
                 // Enable PreInterceptFilter only when interceptors are enabled
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
index d1cf91635f9..405d7caa1fa 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
@@ -69,7 +69,6 @@ public class BrokerInterceptorTest extends ProducerConsumerBase {
     public void setup() throws Exception {
         conf.setSystemTopicEnabled(false);
         conf.setTopicLevelPoliciesEnabled(false);
-        this.conf.setDisableBrokerInterceptors(false);
 
         this.listener1 = mock(BrokerInterceptor.class);
         this.ncl1 = mock(NarClassLoader.class);
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/ExceptionsBrokerInterceptorTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/ExceptionsBrokerInterceptorTest.java
index aa254a8ac16..0aa80cdad1e 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/ExceptionsBrokerInterceptorTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/ExceptionsBrokerInterceptorTest.java
@@ -46,7 +46,6 @@ public class ExceptionsBrokerInterceptorTest extends ProducerConsumerBase {
     public void setup() throws Exception {
         conf.setSystemTopicEnabled(false);
         conf.setTopicLevelPoliciesEnabled(false);
-        this.conf.setDisableBrokerInterceptors(false);
 
 
         this.enableBrokerInterceptor = true;
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java
index 40a42286fda..995dccda369 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java
@@ -528,9 +528,6 @@ public class PulsarTestContext implements AutoCloseable {
             if (configOverrideCustomizer != null) {
                 configOverrideCustomizer.accept(super.config);
             }
-            if (super.brokerInterceptor != null) {
-                super.config.setDisableBrokerInterceptors(false);
-            }
             initializeCommonPulsarServices(spyConfig);
             initializePulsarServices(spyConfig, this);
             if (pulsarServiceCustomizer != null) {
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/web/ProcessHandlerFilterTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/web/ProcessHandlerFilterTest.java
index cabde4af1f1..6d28aeb9f9d 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/web/ProcessHandlerFilterTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/web/ProcessHandlerFilterTest.java
@@ -60,7 +60,6 @@ public class ProcessHandlerFilterTest {
         Mockito.doReturn(config).when(mockPulsarService).getConfig();
         // request has MULTIPART_FORM_DATA content-type
         config.setBrokerInterceptors(Sets.newHashSet("Interceptor1","Interceptor2"));
-        config.setDisableBrokerInterceptors(false);
         HttpServletRequest mockHttpServletRequest2 = Mockito.mock(HttpServletRequest.class);
         Mockito.doReturn(MediaType.MULTIPART_FORM_DATA).when(mockHttpServletRequest2).getContentType();
         ProcessHandlerFilter processHandlerFilter2 = new ProcessHandlerFilter(mockPulsarService.getBrokerInterceptor());