hemantk-12 commented on code in PR #5968:
URL: https://github.com/apache/ozone/pull/5968#discussion_r1448142582
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotCache.java:
##########
@@ -231,23 +216,20 @@ public ReferenceCounted<IOmMetadataReader, SnapshotCache>
get(String key,
* @param key snapshot table key
*/
public void release(String key) {
- ReferenceCounted<IOmMetadataReader, SnapshotCache>
- rcOmSnapshot = dbMap.get(key);
- if (rcOmSnapshot == null) {
- throw new IllegalArgumentException(
- "Key '" + key + "' does not exist in cache");
- }
-
- if (rcOmSnapshot.decrementRefCount() == 0L) {
- synchronized (pendingEvictionList) {
- // v is eligible to be evicted and closed
- pendingEvictionList.add(rcOmSnapshot);
+ Lock lock = getLock(key);
+ lock.lock();
+ try {
+ ReferenceCounted<IOmMetadataReader, SnapshotCache> rcOmSnapshot =
dbMap.get(key);
+ if (rcOmSnapshot == null) {
+ throw new IllegalArgumentException("Key '" + key + "' does not exist
in cache");
}
+ rcOmSnapshot.decrementRefCount();
+ // The cache size might have already exceeded the soft limit
+ // Thus triggering cleanup() to check and evict if applicable
+ cleanup();
Review Comment:
I missed it :face_palm:. Thanks for the catch. Removed.
--
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]