Skip to content

Commit

Permalink
[fix][broker] Disable EntryFilters for system topics (#20514)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari authored Jun 7, 2023
1 parent fe556ab commit ac46e2e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,10 @@ public void updateResourceGroupLimiter(Optional<Policies> optPolicies) {
}

public void updateEntryFilters() {
if (isSystemTopic()) {
entryFilters = Pair.of(null, Collections.emptyList());
return;
}
final EntryFilters entryFiltersPolicy = getEntryFiltersPolicy();
if (entryFiltersPolicy == null || StringUtils.isBlank(entryFiltersPolicy.getEntryFilterNames())) {
entryFilters = Pair.of(null, Collections.emptyList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public class EntryFilterSupport {

public EntryFilterSupport(Subscription subscription) {
this.subscription = subscription;
if (subscription != null && subscription.getTopic() != null) {
if (subscription != null && subscription.getTopic() != null
&& !subscription.getTopic().isSystemTopic()) {
final BrokerService brokerService = subscription.getTopic().getBrokerService();
final boolean allowOverrideEntryFilters = brokerService
.pulsar().getConfiguration().isAllowOverrideEntryFilters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
*/
package org.apache.pulsar.broker.service.persistent;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.apache.bookkeeper.mledger.ManagedLedger;
import org.apache.pulsar.broker.PulsarServerException;
import org.apache.pulsar.broker.namespace.NamespaceService;
import org.apache.pulsar.broker.service.BrokerService;
import org.apache.pulsar.broker.service.plugin.EntryFilter;
import org.apache.pulsar.common.naming.SystemTopicNames;
import org.apache.pulsar.common.naming.TopicName;
import org.apache.pulsar.common.policies.data.EntryFilters;

public class SystemTopic extends PersistentTopic {

Expand Down Expand Up @@ -82,4 +85,14 @@ public boolean isEncryptionRequired() {
// System topics are only written by the broker that can't know the encryption context.
return false;
}

@Override
public EntryFilters getEntryFiltersPolicy() {
return null;
}

@Override
public List<EntryFilter> getEntryFilters() {
return null;
}
}

0 comments on commit ac46e2e

Please sign in to comment.