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


##########
client/src/main/java/org/apache/celeborn/client/read/CelebornInputStream.java:
##########
@@ -568,6 +568,13 @@ private PartitionReader createReader(
         Optional<PartitionReaderCheckpointMetadata> checkpointMetadata)
         throws IOException, InterruptedException {
 
+      // CELEBORN-2032. For the first creation of a reader (non-retries) and
+      // attemptNumber % 2 = 1, we should read the replica data first.
+      if (location.hasPeer() && fetchChunkRetryCnt == 0 && attemptNumber % 2 
== 1) {

Review Comment:
   IMO we need remove this, as the location may already change to replica, and 
the `Partitionlocation`should consistent with `pbStreamHandler`



##########
client-spark/spark-3/src/main/scala/org/apache/spark/shuffle/celeborn/CelebornShuffleReader.scala:
##########
@@ -240,7 +240,19 @@ class CelebornShuffleReader[K, C](
 
     partitionIdList.foreach { partitionId =>
       if (fileGroups.partitionGroups.containsKey(partitionId)) {
-        var locations = fileGroups.partitionGroups.get(partitionId)
+        // CELEBORN-2032. For the first time of open stream and
+        // attemptNumber % 2 = 1, we should read the replica data first.
+        val originLocations = fileGroups.partitionGroups.get(partitionId)
+        val hasReplicate = originLocations.asScala.exists(p => p != null && 
p.hasPeer)
+        var locations =
+          if (encodedAttemptId % 2 == 1 && hasReplicate) {

Review Comment:
   Should we use `context.attemptNumber()`?



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