-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Describe the bug
See the following unit test code to reproduce this issue.
The root cause of this is that in topic policy setting, it limits the size of message header and payload.
See
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Line 413 in 6b8ebbd
| if (isExceedMaximumMessageSize(headersAndPayload.readableBytes())) { |
To Reproduce
Steps to reproduce the behavior:
Add this unit test code in org.apache.pulsar.broker.admin.TopicPoliciesTest
@Test
public void testTopicMaxMessageSizeThreshHold() throws Exception {
@Cleanup
Producer<byte[]> p = pulsarClient.newProducer().topic(testTopic).create();
admin.topicPolicies().setMaxMessageSize(testTopic,1000);
Awaitility.await().until(() -> pulsar.getTopicPoliciesService().getTopicPolicies(TopicName.get(testTopic)) != null);
p.send(new byte[1000]);
}
Got the following error:
org.apache.pulsar.client.api.PulsarClientException$NotAllowedException: The size of the message which is produced by producer test-0-2 to the topic persistent://my-tenant/my-namespace/test-set-backlog-quota-partition-0 is not allowed
Expected behavior
Message should produce success.
Screenshots
NA
Desktop (please complete the following information):
- OS: macOS
Additional context
NA