[C++] Release the unused spots of pending message queue#6926
Merged
codelipenghui merged 6 commits intoapache:masterfrom May 19, 2020
Merged
[C++] Release the unused spots of pending message queue#6926codelipenghui merged 6 commits intoapache:masterfrom
codelipenghui merged 6 commits intoapache:masterfrom
Conversation
ccbf2dc to
2e891f8
Compare
2e891f8 to
d9403ae
Compare
Contributor
Author
|
/pulsarbot run-failure-checks |
sijie
approved these changes
May 18, 2020
codelipenghui
approved these changes
May 19, 2020
nicolo-paganin
pushed a commit
to oncodeit/pulsar
that referenced
this pull request
May 22, 2020
### Motivation If messages were sent in batch, every single message would reserve one spot of producer's pending message queue, but only one batched message would be pushed to the queue. Therefore there may exist many unused spots when `ProducerQueueIsFull` happened. Besides, if a message was too big or failed to be encrypted, `sendAsync` failed immediately but the reserved spot won't be released. ### Modifications - Add a `bool` return value to `BatchMessageContainer::sendMessages` to indicate whether the batched message was pushed to producer's queue. - Add a `bool` return value to `BatchMessageContainer::add` to indicate whether the reserved spot should be released. The spot would be retained only if the first message was batched and not sent immediately. The spot would be released when the batched message was pushed to the queue. - Test sending a batch with a 2-spots pending message queue, one spot for storing the batched message, another spot for preventing `ProducerQueueIsFull` error. - Test after all batched messages being sent, whether the reserved spots of producer's queue were 0. ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change is already covered by existing tests, such as `BatchMessageTest.testSendCallback`, `BatchMessageTest.testPartitionedTopics` and `BasicEndToEndTest.testMessageTooBig`.
nicolo-paganin
pushed a commit
to oncodeit/pulsar
that referenced
this pull request
May 22, 2020
### Motivation If messages were sent in batch, every single message would reserve one spot of producer's pending message queue, but only one batched message would be pushed to the queue. Therefore there may exist many unused spots when `ProducerQueueIsFull` happened. Besides, if a message was too big or failed to be encrypted, `sendAsync` failed immediately but the reserved spot won't be released. ### Modifications - Add a `bool` return value to `BatchMessageContainer::sendMessages` to indicate whether the batched message was pushed to producer's queue. - Add a `bool` return value to `BatchMessageContainer::add` to indicate whether the reserved spot should be released. The spot would be retained only if the first message was batched and not sent immediately. The spot would be released when the batched message was pushed to the queue. - Test sending a batch with a 2-spots pending message queue, one spot for storing the batched message, another spot for preventing `ProducerQueueIsFull` error. - Test after all batched messages being sent, whether the reserved spots of producer's queue were 0. ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change is already covered by existing tests, such as `BatchMessageTest.testSendCallback`, `BatchMessageTest.testPartitionedTopics` and `BasicEndToEndTest.testMessageTooBig`.
Huanli-Meng
pushed a commit
to Huanli-Meng/pulsar
that referenced
this pull request
May 27, 2020
### Motivation If messages were sent in batch, every single message would reserve one spot of producer's pending message queue, but only one batched message would be pushed to the queue. Therefore there may exist many unused spots when `ProducerQueueIsFull` happened. Besides, if a message was too big or failed to be encrypted, `sendAsync` failed immediately but the reserved spot won't be released. ### Modifications - Add a `bool` return value to `BatchMessageContainer::sendMessages` to indicate whether the batched message was pushed to producer's queue. - Add a `bool` return value to `BatchMessageContainer::add` to indicate whether the reserved spot should be released. The spot would be retained only if the first message was batched and not sent immediately. The spot would be released when the batched message was pushed to the queue. - Test sending a batch with a 2-spots pending message queue, one spot for storing the batched message, another spot for preventing `ProducerQueueIsFull` error. - Test after all batched messages being sent, whether the reserved spots of producer's queue were 0. ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change is already covered by existing tests, such as `BatchMessageTest.testSendCallback`, `BatchMessageTest.testPartitionedTopics` and `BasicEndToEndTest.testMessageTooBig`.
huangdx0726
pushed a commit
to huangdx0726/pulsar
that referenced
this pull request
Aug 24, 2020
### Motivation If messages were sent in batch, every single message would reserve one spot of producer's pending message queue, but only one batched message would be pushed to the queue. Therefore there may exist many unused spots when `ProducerQueueIsFull` happened. Besides, if a message was too big or failed to be encrypted, `sendAsync` failed immediately but the reserved spot won't be released. ### Modifications - Add a `bool` return value to `BatchMessageContainer::sendMessages` to indicate whether the batched message was pushed to producer's queue. - Add a `bool` return value to `BatchMessageContainer::add` to indicate whether the reserved spot should be released. The spot would be retained only if the first message was batched and not sent immediately. The spot would be released when the batched message was pushed to the queue. - Test sending a batch with a 2-spots pending message queue, one spot for storing the batched message, another spot for preventing `ProducerQueueIsFull` error. - Test after all batched messages being sent, whether the reserved spots of producer's queue were 0. ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change is already covered by existing tests, such as `BatchMessageTest.testSendCallback`, `BatchMessageTest.testPartitionedTopics` and `BasicEndToEndTest.testMessageTooBig`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
If messages were sent in batch, every single message would reserve one spot of producer's pending message queue, but only one batched message would be pushed to the queue. Therefore there may exist many unused spots when
ProducerQueueIsFullhappened.Besides, if a message was too big or failed to be encrypted,
sendAsyncfailed immediately but the reserved spot won't be released.Modifications
boolreturn value toBatchMessageContainer::sendMessagesto indicate whether the batched message was pushed to producer's queue.boolreturn value toBatchMessageContainer::addto indicate whether the reserved spot should be released. The spot would be retained only if the first message was batched and not sent immediately. The spot would be released when the batched message was pushed to the queue.ProducerQueueIsFullerror.Verifying this change
This change is already covered by existing tests, such as
BatchMessageTest.testSendCallback,BatchMessageTest.testPartitionedTopicsandBasicEndToEndTest.testMessageTooBig.