This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 9ec4db7723 fix: fix RangeWriter incorrect `next_offset` (#3927)
9ec4db7723 is described below
commit 9ec4db7723cc19a9eb94088f06ac7ef321f1e30d
Author: Weny Xu <[email protected]>
AuthorDate: Sat Jan 6 15:41:19 2024 +0900
fix: fix RangeWriter incorrect `next_offset` (#3927)
---
core/src/raw/oio/write/range_write.rs | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/core/src/raw/oio/write/range_write.rs
b/core/src/raw/oio/write/range_write.rs
index 7e2f9f0883..bbd81606b0 100644
--- a/core/src/raw/oio/write/range_write.rs
+++ b/core/src/raw/oio/write/range_write.rs
@@ -86,7 +86,7 @@ pub trait RangeWrite: Send + Sync + Unpin + 'static {
async fn abort_range(&self, location: &str) -> Result<()>;
}
-struct WriteRangeFuture(BoxedFuture<Result<u64>>);
+struct WriteRangeFuture(BoxedFuture<Result<()>>);
/// # Safety
///
@@ -99,7 +99,7 @@ unsafe impl Send for WriteRangeFuture {}
unsafe impl Sync for WriteRangeFuture {}
impl Future for WriteRangeFuture {
- type Output = Result<u64>;
+ type Output = Result<()>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
self.get_mut().0.poll_unpin(cx)
}
@@ -177,12 +177,11 @@ impl<W: RangeWrite> oio::Write for RangeWriter<W> {
AsyncBody::ChunkedBytes(cache),
)
.await
- .map(|_| size)
})));
let size = self.fill_cache(bs);
return Poll::Ready(Ok(size));
- } else if let Some(size) =
ready!(self.futures.poll_next_unpin(cx)) {
- self.next_offset += size?;
+ } else if let Some(result) =
ready!(self.futures.poll_next_unpin(cx)) {
+ result?;
}
}
None => {
@@ -221,8 +220,8 @@ impl<W: RangeWrite> oio::Write for RangeWriter<W> {
match self.location.clone() {
Some(location) => {
if !self.futures.is_empty() {
- while let Some(size) =
ready!(self.futures.poll_next_unpin(cx)) {
- self.next_offset += size?;
+ while let Some(result) =
ready!(self.futures.poll_next_unpin(cx)) {
+ result?;
}
}
match self.buffer.take() {