RexXiong commented on code in PR #3132:
URL: https://github.com/apache/celeborn/pull/3132#discussion_r1993154904


##########
client/src/main/java/org/apache/celeborn/client/read/WorkerPartitionReader.java:
##########
@@ -176,7 +186,8 @@ public ByteBuf next() throws IOException, 
InterruptedException {
       throw e;
     }
     returnedChunks++;
-    return chunk;
+    chunkIdsAlreadyReturned.add(chunk.getLeft());

Review Comment:
   Only checkpoint when isCheckpointEnabled



##########
common/src/main/scala/org/apache/celeborn/common/CelebornConf.scala:
##########
@@ -4691,6 +4694,15 @@ object CelebornConf extends Logging {
       .bytesConf(ByteUnit.BYTE)
       .createWithDefaultString("64k")
 
+  val PARTITION_READER_CHECKPOINT_ENABLED: ConfigEntry[Boolean] =
+    buildConf("celeborn.partition.reader.checkpoint.enabled")

Review Comment:
   Maybe rename the configuration to 
`celeborn.client.partition.reader.checkpoint.enabled`, since it is only for 
client use.



##########
client/src/main/java/org/apache/celeborn/client/read/WorkerPartitionReader.java:
##########
@@ -210,14 +224,39 @@ public PartitionLocation getLocation() {
     return location;
   }
 
+  @Override
+  public Optional<PartitionReaderCheckpointMetadata> 
getPartitionReaderCheckpointMetadata() {
+    return isCheckpointEnabled
+        ? Optional.of(new 
PartitionReaderCheckpointMetadata(chunkIdsAlreadyReturned))
+        : Optional.empty();
+  }
+
+  @Override
+  public void updateCheckpointMetadata(PartitionReaderCheckpointMetadata 
checkpointMetadata) {
+    chunkIdsAlreadyReturned = checkpointMetadata.getReturnedChunks();
+  }
+
   private void fetchChunks() throws IOException, InterruptedException {
     final int inFlight = chunkIndex - startChunkIndex - returnedChunks;
     if (inFlight < fetchMaxReqsInFlight) {
-      final int toFetch =
-          Math.min(fetchMaxReqsInFlight - inFlight + 1, endChunkIndex + 1 - 
chunkIndex);
-      for (int i = 0; i < toFetch; i++) {
-        if (testFetch && fetchChunkRetryCnt < fetchChunkMaxRetry - 1 && 
chunkIndex == 3) {
+      int toFetch = Math.min(fetchMaxReqsInFlight - inFlight + 1, 
endChunkIndex + 1 - chunkIndex);
+
+      while (toFetch > 0 && chunkIndex <= endChunkIndex) {
+        if (chunkIdsAlreadyReturned.contains(chunkIndex)) {

Review Comment:
   `isCheckpointEnabled && chunkIdsAlreadyReturned.contains(chunkIndex)`



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