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

[Bug] Produce chunk messages failed when topic level maxMessageSize is set. #13360

Closed
Jason918 opened this issue Dec 16, 2021 · 3 comments
Closed
Assignees
Labels
lifecycle/stale type/bug The PR fixed a bug or issue reported a bug

Comments

@Jason918
Copy link
Contributor

Jason918 commented Dec 16, 2021

Describe the bug
Produce chunk messages failed when topic level maxMessageSize is set.
See details in the following unit test case.

To Reproduce
See this new unit test code in org.apache.pulsar.broker.admin.TopicPoliciesTest

   @Test
   public void testMaxMessageSizeWithChunking() throws Exception {
       this.conf.setMaxMessageSize(10);

       @Cleanup
       Producer<byte[]> producer = pulsarClient.newProducer()
               .topic(persistenceTopic)
               .enableChunking(true)
               .enableBatching(false)
               .create();

       PersistentTopic topic = (PersistentTopic) pulsar.getBrokerService().getTopic(persistenceTopic,false).join().get();

       byte[] data = new byte[100];
       producer.send(data);

       // success with maxMessageSize is 10
       admin.topicPolicies().setMaxMessageSize(persistenceTopic, 10);
       Awaitility.await().untilAsserted(() -> {
           Assert.assertEquals((int) topic.getHierarchyTopicPolicies().getTopicMaxMessageSize().get(), 10);
       });
       producer.send(data);

       // failed with maxMessageSize is 9
       admin.topicPolicies().setMaxMessageSize(persistenceTopic, 9);
       Awaitility.await().untilAsserted(() -> {
           Assert.assertEquals((int) topic.getHierarchyTopicPolicies().getTopicMaxMessageSize().get(), 9);
       });
       producer.send(data);
   }

Expected behavior
Chunking should work fine if we change maxMessageSize.

Screenshots
NA

Desktop (please complete the following information):

  • OS: macOS

Additional context
NA

@Jason918
Copy link
Contributor Author

I am working on a fix.

@github-actions
Copy link

The issue had no activity for 30 days, mark with Stale label.

@Jason918
Copy link
Contributor Author

Solved with PIP-131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

No branches or pull requests

1 participant