After KAFKA-6514, we add API version as a tag for the RequestsPerSec metric but 
in the implementation, we use the non-threadsafe mutable.HashMap to store the 
version -> metric mapping without any protection 
(https://github.com/apache/kafka/pull/4506/files#diff-d0332a0ff31df50afce3809d90505b25R357
 ). This can mess up the data structure and cause unexpected behavior 
(https://github.com/scala/bug/issues/10436 ). This PR changes 
requestRateInternal to use the thread-safe Pool instead.

*More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.*

*Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.*

### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation 
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)


[ Full content available at: https://github.com/apache/kafka/pull/5717 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to