rkhachatryan commented on a change in pull request #14838: URL: https://github.com/apache/flink/pull/14838#discussion_r573788615
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/StateChangelogHandleStreamImpl.java ########## @@ -0,0 +1,144 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.state; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.runtime.state.filesystem.FileStateHandle; +import org.apache.flink.runtime.state.memory.ByteStreamStateHandle; +import org.apache.flink.util.CloseableIterator; +import org.apache.flink.util.ExceptionUtils; + +import javax.annotation.Nullable; + +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +/** {@link StateChangelogHandle} implementation based on {@link StreamStateHandle}. */ +@Internal +public final class StateChangelogHandleStreamImpl + implements StateChangelogHandle<StateChangelogHandleStreamImpl.StateChangeStreamReader> { + private static final long serialVersionUID = -8070326169926626355L; + + private final KeyGroupRange keyGroupRange; + /** NOTE: order is important as it reflects the order of changes. */ + private final List<Tuple2<StreamStateHandle, Long>> handlesAndOffsets; Review comment: > What is the second field, offset to the file? Yes, the 2nd field in `handlesAndOffsets` is offset (to file or other handle). > Would it be more clear to make it a separate class, with each field a specific name and java doc/comment? To me, replacing `Tuple2<...>` with `HandleAndOffset` class isn't much better; and introducing a new abstraction like `StatePointer` isn't necessarily more clear. Using `long` and `Tuple2` in `StateHandle` implementations is common, so I don't think we should change it. > The structure might also change if we want to use something else (DB) instead of a blob DFS? In that case, a new `StateChangelogHandle` implementation should be added. ---------------------------------------------------------------- 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]
