flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] rkhachatryan commented on a change in pull request #15200: [FLINK-21355] Send changes to the state changelog
Date Thu, 27 May 2021 21:15:51 GMT

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



##########
File path: flink-state-backends/flink-statebackend-changelog/src/main/java/org/apache/flink/state/changelog/ChangelogMapState.java
##########
@@ -71,22 +94,67 @@ 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.entries().iterator();
+        final N currentNamespace = getCurrentNamespace();
+        return () ->
+                loggingIterator(
+                        new Iterator<Map.Entry<UK, UV>>() {
+                            @Override
+                            public Map.Entry<UK, UV> next() {
+                                return loggingMapEntry(
+                                        iterator.next(),
+                                        changeLogger,
+                                        changeWriter,
+                                        currentNamespace);
+                            }
+
+                            @Override
+                            public boolean hasNext() {
+                                return iterator.hasNext();
+                            }
+
+                            @Override
+                            public void remove() {
+                                iterator.remove();
+                            }

Review comment:
       I don't see why it's impossible. `MapState.entries` doesn't says anything forbidding
this.
   
   The `iterator` was already obtained from `delegatedState`, so `remove()` call should be
enough.




-- 
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:
users@infra.apache.org



Mime
View raw message