Xuanwo opened a new pull request, #8746: URL: https://github.com/apache/opendal/pull/8746
# Which issue does this PR close? N/A. The reported behavior is reproduced by the focused unit tests in this PR. # Rationale for this change `FuturesAsyncWriter::poll_flush` moved buffered bytes from `FlexBuf` into `BufferSink`, but then returned `Ok(())` because `BufferSink` only writes in its own `poll_flush`. As a result, `flush()` could succeed while up to 256 KiB stayed unsent and underlying write errors surfaced only on `close()`. The same path backs `blocking::StdWriter::flush()`. `BufferSink::poll_flush` also returned early when its buffer was empty before checking for `State::Idle(None)`. After `close()`, `poll_ready()` and `start_send()` therefore still accepted data. # What changes are included in this PR? - `FuturesAsyncWriter::poll_flush` now flushes `BufferSink` after draining `FlexBuf`, so `flush()` pushes buffered bytes and surfaces write errors. - `FuturesAsyncWriter::poll_write` rejects writes once the sink is closed. - `BufferSink` checks the closed state before the empty-buffer fast path, and `start_send` rejects writes to a closed sink. - Added focused unit tests covering flush delivery, flush error propagation, and writes/flushes after close. The tests fail before the fix and pass after it. # Are there any user-facing changes? `AsyncWrite::flush()` now sends buffered data and reports write failures instead of returning success. Writing to `FuturesAsyncWriter` or `BufferSink` after `close()` returns an error instead of being accepted. # Breaking changes # AI Usage Statement - Harness: pi coding agent - Model: group/deepseek - Effort: max - Role: Implemented the adapter fixes and focused tests, and ran the verification. No known assumptions or unknowns beyond the behavior covered by the tests. -- 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]
