rkhachatryan commented on code in PR #28661:
URL: https://github.com/apache/flink/pull/28661#discussion_r3729044885


##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/channel/FetchedChannelStateReader.java:
##########
@@ -0,0 +1,127 @@
+/*
+ * 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.checkpoint.channel;
+
+import org.apache.flink.annotation.Internal;
+
+import java.io.Closeable;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.Optional;
+
+/**
+ * Forward reader over a {@link FetchedChannelState}'s spill files. This is 
our own segment reader,

Review Comment:
   Thanks!



##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/channel/FetchedChannelStateReader.java:
##########
@@ -0,0 +1,127 @@
+/*
+ * 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.checkpoint.channel;
+
+import org.apache.flink.annotation.Internal;
+
+import java.io.Closeable;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.Optional;
+
+/**
+ * Forward reader over a {@link FetchedChannelState}'s spill files. This is 
our own segment reader,
+ * on purpose <em>not</em> a Java {@link java.util.Iterator}: our access 
pattern ("a body must be
+ * fully read before the next segment", "body ownership is handed to the 
consumer", "consume and
+ * commit are separate steps") does not fit the {@code hasNext/next} contract.
+ *
+ * <p>This interface is the contract callers depend on; {@link 
FetchedChannelStateReaderImpl} holds
+ * the implementation (the live file stream, the two progress positions, the 
bounded body view).
+ *
+ * <p>Reading is strictly sequential: a reader is positioned once (offset 0 
for the root reader, or
+ * the committed position for a {@link #snapshot()}), then consumes forward 
only via {@link
+ * #nextSegment()}. It never seeks backward and never re-positions 
mid-iteration.
+ *
+ * <p>The drain thread reads the root reader front to back and commits via 
{@link

Review Comment:
   Thanks!



##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/channel/SequentialChannelStateReaderImpl.java:
##########
@@ -110,7 +111,7 @@ public Optional<FetchedChannelState> readInputData(
             // only signals "there is state to recover". The spilling backend 
returns a real,
             // file-backed container here.

Review Comment:
   Why can't we simply change
   ```
   return filterContext.isCheckpointingDuringRecoveryEnabled() && readAny
           ? Optional.of(new 
FetchedChannelState(java.util.Collections.emptyList()))
           : Optional.empty();
   ```
   to
   ```
   return filterContext.isCheckpointingDuringRecoveryEnabled() && readAny
           ? Optional.ofNullable(stateHandler.getProducedChannelState())
           : Optional.empty();
   ```
   so we don't need to worry about some intermediate states between PRs?
   Or am I missing something?



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to