Nicklee007 opened a new pull request, #17276:
URL: https://github.com/apache/pulsar/pull/17276
### Motivation
Fix client memory limit currentUsage and semaphore release when
batchMessageContainer add message.
If `BatchMessageContainerImpl's` add method throw an Exception while adding
the first messages, then the `memoryLimitController` `currentUsage` and
`MaxQueueSize` `semaphore` not release before discard message.
https://github.com/apache/pulsar/blob/b58439e835ea9c4f492a8c05bdd99047c1233bc2/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageContainerImpl.java#L109-L113
### Modifications
1. Release `memoryLimitController` `currentUsage` and `MaxQueueSize`
`semaphore` before discard message.
2. add some unit test.
### Documentation
- [X] `doc-not-needed`
(Please explain why)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]