You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "hemantk-12 (via GitHub)" <gi...@apache.org> on 2023/04/14 22:17:00 UTC

[GitHub] [ozone] hemantk-12 commented on pull request #4567: HDDS-7935. [Snapshot] Custom SnapshotCache implementation to replace LoadingCache

hemantk-12 commented on PR #4567:
URL: https://github.com/apache/ozone/pull/4567#issuecomment-1509349573

   Only for the snapshot use case, I am inclined towards approach #2.
   
   Reason: 
   1. The way [SnapshotCache](https://github.com/apache/ozone/pull/4567/files#diff-d5b0b24274c5d19e876dc2ffeb744d4965fa1a23ce727ac09b965f665573c18aR38) is implemented is not bounded cache. I don't see [cacheSize](https://github.com/apache/ozone/pull/4567/files#diff-d5b0b24274c5d19e876dc2ffeb744d4965fa1a23ce727ac09b965f665573c18aR55) is used in eviction policy if cache is full. Yes, it doesn't proactively claims some entries but only if they are not used by anyone. If it was bounded cache I would have gone the first approach.
   2. If I understood it properly, Cache is used in snapshot to reuse the RocksDB instance instead of create a new one every time. In that case, I think it is OK to rely on GC for that.
   
   I was thinking to use [WeakReference](https://docs.oracle.com/javase/8/docs/api/java/lang/ref/WeakReference.html) with [WeakHashMap](https://docs.oracle.com/javase/7/docs/api/java/util/WeakHashMap.html) which I guess would be similar to `CacheBuilder#weakValues()` and `CacheBuilder#softValues()`.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org