|
16 | 16 | import com.google.common.annotations.VisibleForTesting;
|
17 | 17 | import com.google.common.collect.Maps;
|
18 | 18 | import io.netty.buffer.ByteBuf;
|
19 |
| -import io.netty.channel.ChannelHandlerContext; |
20 | 19 | import io.netty.util.Recycler;
|
21 |
| -import io.netty.util.concurrent.FastThreadLocal; |
22 | 20 | import io.streamnative.pulsar.handlers.kop.KafkaServiceConfiguration;
|
23 | 21 | import io.streamnative.pulsar.handlers.kop.KafkaTopicConsumerManager;
|
24 | 22 | import io.streamnative.pulsar.handlers.kop.KafkaTopicLookupService;
|
|
87 | 85 | import org.apache.kafka.common.record.RecordBatch;
|
88 | 86 | import org.apache.kafka.common.requests.FetchResponse;
|
89 | 87 | import org.apache.kafka.common.utils.Time;
|
90 |
| -import org.apache.pulsar.broker.service.Topic; |
91 | 88 | import org.apache.pulsar.broker.service.persistent.PersistentTopic;
|
92 | 89 | import org.apache.pulsar.broker.service.plugin.EntryFilter;
|
93 | 90 | import org.apache.pulsar.common.naming.TopicName;
|
@@ -138,7 +135,6 @@ public CompletableFuture<KeyValueSchemaIds> getSchemaIds(String topic, BytesSche
|
138 | 135 | private final KafkaTopicLookupService kafkaTopicLookupService;
|
139 | 136 |
|
140 | 137 | private final List<EntryFilter> entryFilters;
|
141 |
| - private final boolean preciseTopicPublishRateLimitingEnable; |
142 | 138 |
|
143 | 139 | private final ProducerStateManagerSnapshotBuffer producerStateManagerSnapshotBuffer;
|
144 | 140 |
|
@@ -172,7 +168,6 @@ public PartitionLog(KafkaServiceConfiguration kafkaConfig,
|
172 | 168 | this.time = time;
|
173 | 169 | this.topicPartition = topicPartition;
|
174 | 170 | this.fullPartitionName = fullPartitionName;
|
175 |
| - this.preciseTopicPublishRateLimitingEnable = kafkaConfig.isPreciseTopicPublishRateLimiterEnable(); |
176 | 171 | this.kafkaTopicLookupService = kafkaTopicLookupService;
|
177 | 172 | this.producerStateManagerSnapshotBuffer = producerStateManagerSnapshotBuffer;
|
178 | 173 | this.recoveryExecutor = recoveryExecutor.chooseThread(fullPartitionName);
|
@@ -898,8 +893,6 @@ private void publishMessages(final CompletableFuture<Long> appendFuture,
|
898 | 893 | final LogAppendInfo appendInfo,
|
899 | 894 | final EncodeResult encodeResult,
|
900 | 895 | final AppendRecordsContext appendRecordsContext) {
|
901 |
| - checkAndRecordPublishQuota(persistentTopic, appendInfo.validBytes(), |
902 |
| - appendInfo.numMessages(), appendRecordsContext); |
903 | 896 | if (persistentTopic.isSystemTopic()) {
|
904 | 897 | encodeResult.recycle();
|
905 | 898 | log.error("Not support producing message to system topic: {}", persistentTopic);
|
@@ -944,37 +937,6 @@ private void publishMessages(final CompletableFuture<Long> appendFuture,
|
944 | 937 | });
|
945 | 938 | }
|
946 | 939 |
|
947 |
| - private void checkAndRecordPublishQuota(Topic topic, int msgSize, int numMessages, |
948 |
| - AppendRecordsContext appendRecordsContext) { |
949 |
| - final boolean isPublishRateExceeded; |
950 |
| - if (preciseTopicPublishRateLimitingEnable) { |
951 |
| - boolean isPreciseTopicPublishRateExceeded = |
952 |
| - topic.isTopicPublishRateExceeded(numMessages, msgSize); |
953 |
| - if (isPreciseTopicPublishRateExceeded) { |
954 |
| - topic.disableCnxAutoRead(); |
955 |
| - return; |
956 |
| - } |
957 |
| - isPublishRateExceeded = topic.isBrokerPublishRateExceeded(); |
958 |
| - } else { |
959 |
| - if (topic.isResourceGroupRateLimitingEnabled()) { |
960 |
| - final boolean resourceGroupPublishRateExceeded = |
961 |
| - topic.isResourceGroupPublishRateExceeded(numMessages, msgSize); |
962 |
| - if (resourceGroupPublishRateExceeded) { |
963 |
| - topic.disableCnxAutoRead(); |
964 |
| - return; |
965 |
| - } |
966 |
| - } |
967 |
| - isPublishRateExceeded = topic.isPublishRateExceeded(); |
968 |
| - } |
969 |
| - |
970 |
| - if (isPublishRateExceeded) { |
971 |
| - ChannelHandlerContext ctx = appendRecordsContext.getCtx(); |
972 |
| - if (ctx != null && ctx.channel().config().isAutoRead()) { |
973 |
| - ctx.channel().config().setAutoRead(false); |
974 |
| - } |
975 |
| - } |
976 |
| - } |
977 |
| - |
978 | 940 | /**
|
979 | 941 | * Publish message to bookkeeper.
|
980 | 942 | * When the message is control message, then it will not do the message deduplication.
|
|
0 commit comments