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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to