rkhachatryan commented on a change in pull request #15200:
URL: https://github.com/apache/flink/pull/15200#discussion_r648233215



##########
File path: 
flink-state-backends/flink-statebackend-changelog/src/main/java/org/apache/flink/state/changelog/ChangelogMapState.java
##########
@@ -71,22 +108,72 @@ public boolean contains(UK key) throws Exception {
 
     @Override
     public Iterable<Map.Entry<UK, UV>> entries() throws Exception {
-        return delegatedState.entries();
+        Iterator<Map.Entry<UK, UV>> iterator = delegatedState.iterator();
+        return () -> getEntryIterator(iterator);
+    }
+
+    private Iterator<Map.Entry<UK, UV>> 
getEntryIterator(Iterator<Map.Entry<UK, UV>> iterator) {
+        final N currentNamespace = getCurrentNamespace();
+        return StateChangeLoggingIterator.create(
+                new Iterator<Map.Entry<UK, UV>>() {
+                    @Override
+                    public Map.Entry<UK, UV> next() {
+                        return loggingMapEntry(iterator.next(), changeLogger, 
currentNamespace);
+                    }
+
+                    @Override
+                    public boolean hasNext() {
+                        return iterator.hasNext();
+                    }
+
+                    @Override
+                    public void remove() {
+                        iterator.remove();
+                    }
+                },
+                changeLogger,
+                (entry, out) -> serializeKey(entry.getKey(), out),
+                currentNamespace);
     }
 
     @Override
     public Iterable<UK> keys() throws Exception {
-        return delegatedState.keys();
+        Iterable<UK> iterable = delegatedState.keys();
+        return iterable == null
+                ? null

Review comment:
       Hmm..I was sure that `null` is an allowed return value here, but you are 
right.
   I'll just remove the null check.




-- 
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:
[email protected]


Reply via email to