LuciferYang edited a comment on pull request #33556:
URL: https://github.com/apache/spark/pull/33556#issuecomment-891055156


   > Could we just avoid file operations when initialized=false in 
revertPartialWritesAndClose?
   
   Or Could we just avoid file operations when `reportedPosition - 
committedPosition == 0` in `revertPartialWritesAndClose`? @Ngone51 
   
   like 
   ```
   Utils.tryWithSafeFinally {
         if (initialized) {
           writeMetrics.decBytesWritten(reportedPosition - committedPosition)
           writeMetrics.decRecordsWritten(numRecordsWritten)
           streamOpen = false
           closeResources() 
         }
       } {
         // if `reportedPosition > committedPosition`, there will be 
uncommitted data.
         if (reportedPosition > committedPosition) {
             // do truncate file operations. 
         }
       }
   ```
   
   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to