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


##########
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:
   this is exercised when doing `refreshDictionaryFromSystemTable` repeatedly 
(every `compression_dictionary_refresh_interval`) it is just that in tests, 
this will be run also after `compression_dictionary_refresh_initial_delay` 
which is 10s so if tests take longer than this then 
`refreshDictionaryFromSystemTable` will kick in and it gets here. My suspicion 
is that we retrieve last from disk, then we go to cache it but it is already 
there so we dont do that, then the rest of the `cache.add` method finishes and 
we end up with `CompressionDictionary` from disk nobody is interested in 
anymore (because it is cached under a different instance already) and it is not 
closed either.



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