Xuanwo opened a new pull request, #9065:
URL: https://github.com/apache/opendal/pull/9065

   # Which issue does this PR close?
   
   Related to #8254. The Java upload work is tracked separately.
   
   # Rationale for this change
   
   A failed Node.js file upload could leave a multipart upload open after the 
process exited. On MinIO this happened when the input stream failed, when 
multipart completion rejected `ifNotExists`, and when the caller destroyed the 
stream during a pending write.
   
   # What changes are included in this PR?
   
   Expose `abort()` on the asynchronous `Writer`. In both CommonJS and ESM, the 
writable stream waits for its pending write or close during destruction. If the 
writer has not committed, it asks the backend to abort. An existing stream 
error takes precedence over an error during cleanup. If there is no earlier 
error and abort fails, the stream emits the cleanup error, including 
`Unsupported` on backends without abort support. Callers using `destroy()` 
directly should handle the stream’s `error` event.
   
   Tests cover destruction during a pending write, repeated destruction, and 
closing the writer after abort. Against a local MinIO server, each failure 
preserved the previous object byte for byte. Before the fix, an independent 
client still listed the unfinished upload after the uploader exited. With the 
fix, it listed none. A successful close also preserved the complete upload when 
destruction overlapped it.
   
   # Are there any user-facing changes?
   
   The async `Writer` gains `abort(): Promise<void>`. The stream’s destruction 
callback waits for cleanup. Depending on the source and options, a `pipeline()` 
promise can reject before the stream emits `close`. Cleanup requires the 
process to keep running through teardown. The backend determines what it can 
discard. In the unstaged Fs test, the original source error reached the caller 
and the destination retained a prefix of the attempted write.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Pi, `magpie/codex/gpt-6.2-sol`, xhigh: implementation and verification.
   - Pi, `magpie/codex/gpt-6.2-astra`, high: coordination and design.
   - Pi, `magpie/devin/swe-2`, high: independent review.
   - Pi, `magpie/agy-cli/gemini-4-neon`, high: PR title and description.
   
   The multipart checks used MinIO `RELEASE.2025-01-20T14-49-07Z` on Linux with 
Node.js 22.23.4. AWS S3 was not exercised.
   


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