d8tltanc commented on a change in pull request #9485:
URL: https://github.com/apache/kafka/pull/9485#discussion_r543174139
##########
File path: core/src/main/scala/kafka/security/authorizer/AclAuthorizer.scala
##########
@@ -130,6 +130,10 @@ class AclAuthorizer extends Authorizer with Logging {
@volatile
private var aclCache = new
scala.collection.immutable.TreeMap[ResourcePattern, VersionedAcls]()(new
ResourceOrdering)
+
+ private val resourceCache = new
scala.collection.mutable.HashMap[ResourceIndex,
+ scala.collection.mutable.HashSet[String]]()
Review comment:
I tested a bit, using 1 bg thread adding and removing elements to a
mutable.HashSet while the main thread constantly iterating the HashSet using
"foreach". The "foreach" call doesn't throw any exception. But I'm a bit unsure
what would happen if the iteration hits a bucket where some elements are being
added to or deleted from.
Let me test what's the overhead using the immutable map. I'd prefer this
approach as we're expecting much more READ than WRITE to the hashset.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]