StefanRRichter commented on a change in pull request #7188: [FLINK-10473][State TTL] TTL state incremental cleanup for heap backend URL: https://github.com/apache/flink/pull/7188#discussion_r247843856
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/CopyOnWriteStateTable.java ########## @@ -1032,75 +1040,143 @@ public int sizeOfNamespace(Object namespace) { // StateEntryIterator --------------------------------------------------------------------------------------------- + @Override + public StateIteratorWithUpdate<K, N, S> getStateEntryIterator() { + return new StateEntryIterator(true); + } + /** - * Iterator over the entries in a {@link CopyOnWriteStateTable}. + * Iterator over state entries in a {@link CopyOnWriteStateTable}. + * + * <p>This iterator can optionally tolerate concurrent modifications and + * support removing of underlying next key state. */ - class StateEntryIterator implements Iterator<StateEntry<K, N, S>> { + class StateEntryIterator implements StateIteratorWithUpdate<K, N, S> { Review comment: I would suggest not to mix two iterators into one implementation and deceide behaviour on a boolean flag. Better have a common superclass and replace the boolean flag by polymorphic methods. Then you can also only have the subclass "with update" implement the full `StateIteratorWithUpdate` whereas the other can still simply work as `Iterator` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 With regards, Apache Git Services