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


##########
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()
+        } catch {
+          case e: IOException =>
+            logWarn(s"Fail to create writer success file 
${hdfsFileInfo.getDfsWriterSuccessPath}", e)
+            retryCount += 1
+            Thread.sleep(200)

Review Comment:
   It will be better to add a config for this sleep time.



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