smiklosovic commented on code in PR #4535:
URL: https://github.com/apache/cassandra/pull/4535#discussion_r2631087623


##########
src/java/org/apache/cassandra/db/compression/CompressionDictionaryCache.java:
##########
@@ -102,7 +103,14 @@ public void add(@Nullable CompressionDictionary 
compressionDictionary)
 
         // Only update cache if not already in the cache
         DictId newDictId = compressionDictionary.dictId();
-        cache.get(newDictId, id -> compressionDictionary);
+        cache.get(newDictId, id -> {
+            Ref<?> ref = compressionDictionary.tryRef();

Review Comment:
   just saying that when we `tryRef` here, that will populate `selfRef`. Then 
in the `removalListener` we are calling `dictionary.selfRef().release();`. 
`selfRef()` for now returns just `selfRef` which might be technically null when 
called unless somebody calls `tryRef()` first which will make it not null 
anymore. So in that regard we should be safe. If we go to remove from the 
cache, it always went through this method first where `selfRef` was populated.



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