danzhewuju opened a new pull request, #9933:
URL: https://github.com/apache/paimon/pull/9933

   ### Purpose
   
   Fixes #9932.
   
   When a `SingleFileWriter` fails while writing, for example with an 
`OutOfMemoryError`, it aborts and deletes the uncommitted file. However, 
`RollingFileWriterImpl` still keeps the aborted writer in `currentWriter` and 
remains open. When `MergeTreeWriter` subsequently closes the rolling writer 
from its `finally` block, `closeCurrentWriter()` calls `result()` on the 
aborted writer. The metadata lookup can then fail with `FileNotFoundException`, 
masking the original write failure.
   
   This change makes `RollingFileWriterImpl#abort` terminal by:
   
   - detaching `currentWriter` before aborting it;
   - marking the rolling writer as closed; and
   - keeping subsequent `abort()` and `close()` calls idempotent.
   
   As a result, cleanup still removes the uncommitted file, but a later close 
no longer attempts to generate metadata for that deleted file, and the original 
write failure remains visible to the caller.
   
   ### Tests
   
    Added `RollingFileWriterTest#testCloseAfterWriteFailure` to verify that:
     - the original `OutOfMemoryError` is propagated;
     - the uncommitted file is deleted; and
     - repeated `abort()` and a subsequent `close()` do not throw another 
exception.


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