You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "merlimat (via GitHub)" <gi...@apache.org> on 2023/06/06 17:14:59 UTC
[GitHub] [pulsar] merlimat commented on a diff in pull request #20506: [improve] [broker] Replace `AtomicLong` with `LongAdder` in `RangeEntryCacheManagerImpl`
merlimat commented on code in PR #20506:
URL: https://github.com/apache/pulsar/pull/20506#discussion_r1220031923
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/RangeEntryCacheManagerImpl.java:
##########
@@ -106,12 +106,12 @@ public void removeEntryCache(String name) {
entryCache.clear();
if (log.isDebugEnabled()) {
- log.debug("Removed cache for {} - Size: {} -- Current Size: {}", name, size / MB, currentSize.get() / MB);
+ log.debug("Removed cache for {} - Size: {} -- Current Size: {}", name, size / MB, currentSize.sum() / MB);
}
}
boolean hasSpaceInCache() {
- long currentSize = this.currentSize.get();
+ long currentSize = this.currentSize.sum();
Review Comment:
This operation will become more expensive. If we're checking this everything, it might not be good to do it with `LongAdder`
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org