Xuanwo opened a new pull request, #8813: URL: https://github.com/apache/opendal/pull/8813
# Which issue does this PR close? None. # Rationale for this change `PositionWriter::new` wraps every `write_all_at` submitted through `self.tasks` with `executor.timeout()`, converting stalled writes into a temporary `"write position timeout"` error that callers can retry. However, `PositionWriter::close` drained `self.tasks` first and then called `self.w.write_all_at` directly for `self.cache`, bypassing `self.tasks` and `executor.timeout()`. As a result: - A stalled single-chunk write or final cached chunk during `close()` hung indefinitely instead of timing out via `executor.timeout()`. - For concurrent writers (`concurrent > 1`), the final cached chunk was serialized behind all earlier tasks instead of running through `self.tasks`. # What changes are included in this PR? - Schedule `self.cache` via `self.tasks.execute(...)` before draining `self.tasks` in `PositionWriter::close`, matching `MultipartWriter::close` and `BlockWriter::close`. - Clear `self.cache` and advance `self.next_offset` only after `self.tasks.execute(...)` succeeds, preserving retry safety for both non-concurrent (`concurrent <= 1`, where `execute` runs inline and leaves `self.cache` intact on error) and concurrent (`concurrent > 1`, where `ConcurrentTasks` re-queues temporary failures in place) paths. - Update the comment in `core/services/fs/src/writer.rs` to reflect that `PositionWriter` waits for all write tasks before closing with the logical byte count. - Add deterministic unit tests in `core/core/src/raw/oio/write/position_write.rs` covering `close()` timeout and retry for `concurrent = 1`, `concurrent = 2`, and full-queue multi-chunk writes. # Are there any user-facing changes? No public API changes. Writers backed by `PositionWriter` now honor `Executor::timeout()` when flushing the final cached chunk in `close()`. # Breaking changes # AI Usage Statement - **Harness:** pi - **Model:** Gemini 4 Neon - **Effort:** high - **Role:** Implemented the `PositionWriter::close` fix, updated the related `fs` writer comment, added deterministic timeout and retry unit tests, and created this pull request. -- 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]
