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


##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/TierWriter.scala:
##########
@@ -643,13 +643,26 @@ class DfsTierWriter(
       hadoopFs.delete(hdfsFileInfo.getDfsPath, false)
       deleted = true
     } else {
-      hadoopFs.create(hdfsFileInfo.getDfsWriterSuccessPath).close()
-      val indexOutputStream = hadoopFs.create(hdfsFileInfo.getDfsIndexPath)
-      
indexOutputStream.writeInt(hdfsFileInfo.getReduceFileMeta.getChunkOffsets.size)
-      for (offset <- hdfsFileInfo.getReduceFileMeta.getChunkOffsets.asScala) {
-        indexOutputStream.writeLong(offset)
+      var retryCount = 0
+      while (retryCount < conf.workerCreateIndexMaxAttempts && 
!hadoopFs.exists(hdfsFileInfo.getDfsWriterSuccessPath)) {
+        try {
+          if (hadoopFs.exists(hdfsFileInfo.getDfsIndexPath)) {
+            hadoopFs.delete(hdfsFileInfo.getDfsIndexPath, true)
+          }
+          val indexOutputStream = hadoopFs.create(hdfsFileInfo.getDfsIndexPath)
+          
indexOutputStream.writeInt(hdfsFileInfo.getReduceFileMeta.getChunkOffsets.size)
+          for (offset <- 
hdfsFileInfo.getReduceFileMeta.getChunkOffsets.asScala) {
+            indexOutputStream.writeLong(offset)
+          }
+          indexOutputStream.close()
+          hadoopFs.create(hdfsFileInfo.getDfsWriterSuccessPath).close()

Review Comment:
   If creating the success path results in an IOException, it will lead to 
unnecessary retries for creating the index file. Therefore, it would be better 
to implement a retry  for IOException during both the creation of the index 
file and the success path.



-- 
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: issues-unsubscr...@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to