MarvinCai commented on issue #10016:
URL: https://github.com/apache/pulsar/issues/10016#issuecomment-819281424


   The cache_used_size is get from 
[here](https://github.com/apache/pulsar/blob/f800fde9f27b2e14994f822b8ddac4d01583fb08/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryMBeanImpl.java#L74)
 which is stored in `EntryCacheManager` , the cacheSize is decrement 
[here](https://github.com/apache/pulsar/blob/f800fde9f27b2e14994f822b8ddac4d01583fb08/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/EntryCacheManager.java#L140),
 and the only place I find can possibly make it negative is 
[here](https://github.com/apache/pulsar/blob/f800fde9f27b2e14994f822b8ddac4d01583fb08/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/RangeCache.java#L238),
 when clearing a cache we're not exactly returning entry cache size before 
entries removal instead of the size of entries removed.
   I'll have a patch for it.
   But IMO this metrics is not very accurate as when it's calculated using 
Bytebuf.readableByte, and when we remove entry from cache after we consuming 
it, the readableByte will be smaller than before, which means we're not 
properly reducing the size of cached entries.


-- 
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]


Reply via email to