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


##########
src/java/org/apache/cassandra/db/compression/CompressionDictionaryCache.java:
##########
@@ -102,7 +102,12 @@ public void add(@Nullable CompressionDictionary 
compressionDictionary)
 
         // Only update cache if not already in the cache
         DictId newDictId = compressionDictionary.dictId();
-        cache.get(newDictId, id -> compressionDictionary);
+        CompressionDictionary cached = cache.get(newDictId, id -> 
compressionDictionary);
+        if (cached != compressionDictionary)
+        {
+            compressionDictionary.close();
+            return;
+        }

Review Comment:
   the logic here is that if the returned `cached` instance is different from 
`compressionDictionary`, then there is already cached dictionary under same 
dictionary id, so it is presumably same dictionary, so we do not need to do 
anything except closing it and returning.



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