aljoscha commented on a change in pull request #14765:
URL: https://github.com/apache/flink/pull/14765#discussion_r565455652



##########
File path: 
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/iterator/RocksStatesPerKeyGroupMergeIterator.java
##########
@@ -106,7 +118,8 @@ public void next() {
                 detectNewKeyGroup(oldKey);
             }
         } else {
-            IOUtils.closeQuietly(rocksIterator);
+            IOUtils.closeQuietly(currentSubIterator);
+            closeableRegistry.unregisterCloseable(currentSubIterator);

Review comment:
       Thanks, I will use this pattern! And yes, it's actually important to 
unregister, we have tests that verify that exactly the right amount of 
`close()` calls happen on the Rocks classes. I was surprised myself. 🎊 




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to