LuciferYang commented on pull request #33556:
URL: https://github.com/apache/spark/pull/33556#issuecomment-890897722


   > How can we call closeResources if initialized is already false?
   
   It seems that I don't fully understand what you mean...
   
   I mean `closeResources()` will set `initialized` as false and `initialized` 
is always false in finally block, so will "just avoid file operations when 
initialized=false in revertPartialWritesAndClose"  become "always not do these 
file operations" ?
   
   ```scala
   Utils.tryWithSafeFinally {
         if (initialized) {
           writeMetrics.decBytesWritten(reportedPosition - committedPosition)
           writeMetrics.decRecordsWritten(numRecordsWritten)
           streamOpen = false
           closeResources() // `closeResources()` will set `initialized` as 
false
         }
       } {
         //  `initialized` is always false in this block
         // 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