Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(services/s3): Mark xml deserialize error as temporary during list #5178

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions core/src/services/s3/lister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use super::error::parse_error;
use crate::raw::oio::PageContext;
use crate::raw::*;
use crate::EntryMode;
use crate::Error;
use crate::Metadata;
use crate::Result;
use bytes::Buf;
Expand Down Expand Up @@ -84,8 +85,14 @@ impl oio::PageList for S3Lister {
}
let bs = resp.into_body();

let output: ListObjectsOutput =
de::from_reader(bs.reader()).map_err(new_xml_deserialize_error)?;
let output: ListObjectsOutput = de::from_reader(bs.reader())
.map_err(new_xml_deserialize_error)
// Allow S3 list to retry on XML deserialization errors.
//
// This is because the S3 list API may return incomplete XML data under high load.
// We are confident that our XML decoding logic is correct. When this error occurs,
// we allow retries to obtain the correct data.
.map_err(Error::set_temporary)?;

// Try our best to check whether this list is done.
//
Expand Down Expand Up @@ -196,8 +203,14 @@ impl oio::PageList for S3ObjectVersionsLister {
}

let body = resp.into_body();
let output: ListObjectVersionsOutput =
de::from_reader(body.reader()).map_err(new_xml_deserialize_error)?;
let output: ListObjectVersionsOutput = de::from_reader(body.reader())
.map_err(new_xml_deserialize_error)
// Allow S3 list to retry on XML deserialization errors.
//
// This is because the S3 list API may return incomplete XML data under high load.
// We are confident that our XML decoding logic is correct. When this error occurs,
// we allow retries to obtain the correct data.
.map_err(Error::set_temporary)?;

ctx.done = if let Some(is_truncated) = output.is_truncated {
!is_truncated
Expand Down
Loading