ben-manes commented on code in PR #13850:
URL: https://github.com/apache/kafka/pull/13850#discussion_r1229083529
##########
core/src/main/scala/kafka/log/remote/RemoteIndexCache.scala:
##########
@@ -152,8 +194,7 @@ class RemoteIndexCache(maxSize: Int = 1024,
remoteStorageManager: RemoteStorageM
val txnIndex = new TransactionIndex(offset, txnIndexFile)
txnIndex.sanityCheck()
- val entry = new Entry(offsetIndex, timeIndex, txnIndex)
- entries.put(uuid, entry)
+ internalCache.put(uuid, new Entry(offsetIndex, timeIndex, txnIndex))
Review Comment:
it may not be desirable, but typically you should prefer to use a
computation, `cache.get(key, mappingFunction)`, to make the loading atomic and
avoid a cache stampede. Otherwise a race could allow duplicate work if not
protected elsewhere.
--
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]