jyothsnakonisa commented on code in PR #4535:
URL: https://github.com/apache/cassandra/pull/4535#discussion_r2633029787
##########
src/java/org/apache/cassandra/db/compression/CompressionDictionaryCache.java:
##########
@@ -63,7 +64,7 @@ public CompressionDictionaryCache()
CompressionDictionary
dictionary,
RemovalCause cause) -> {
// Release the cache's reference to the
dictionary when evicted
- // The dictionary will only be truly cleaned
up when all references are released
+ // The dictionary will only be trully cleaned
up when all references are released
Review Comment:
```suggestion
// The dictionary will only be truly
cleaned up when all references are released
```
##########
test/unit/org/apache/cassandra/db/compression/CompressionDictionaryIntegrationTest.java:
##########
@@ -134,7 +134,7 @@ public void testResourceCleanupOnClose() throws Exception
assertThat(testDict.selfRef().globalCount())
.as("Dictionary's reference count should be 1 after adding to cache")
- .isOne();
+ .isOne(); // TODO this fails, for some reason, this is "2" instead of
"1".
Review Comment:
This could be because of the reference not being released as per my earlier
comment
##########
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:
@smiklosovic The new Ref returned by tryRef() is never released, isn't
that going to be a reference leak?
--
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]