You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Ji-Xinyou (via GitHub)" <gi...@apache.org> on 2023/04/30 12:57:47 UTC
[GitHub] [incubator-opendal] Ji-Xinyou opened a new pull request, #2171: fix(service/s3): set retryable on batch
Ji-Xinyou opened a new pull request, #2171:
URL: https://github.com/apache/incubator-opendal/pull/2171
* set retryable on batch
* add more retryable errors
Close: #2158
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Ji-Xinyou commented on a diff in pull request #2171: fix(service/s3): set retryable on batch
Posted by "Ji-Xinyou (via GitHub)" <gi...@apache.org>.
Ji-Xinyou commented on code in PR #2171:
URL: https://github.com/apache/incubator-opendal/pull/2171#discussion_r1181255201
##########
core/src/services/s3/error.rs:
##########
@@ -79,6 +71,34 @@ pub async fn parse_error(resp: Response<IncomingAsyncBody>) -> Result<Error> {
Ok(err)
}
+/// Returns the Errorkind of this code and whether the error is retryable.
+/// All possible error code: <https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList>
+pub fn kind_and_retryable(code: &str) -> Option<(ErrorKind, bool)> {
Review Comment:
Nice one, the naming I chose was bad :(((((
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Xuanwo merged pull request #2171: fix(service/s3): set retryable on batch
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #2171:
URL: https://github.com/apache/incubator-opendal/pull/2171
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2171: fix(service/s3): set retryable on batch
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #2171:
URL: https://github.com/apache/incubator-opendal/pull/2171#discussion_r1181228353
##########
core/src/services/s3/error.rs:
##########
@@ -79,6 +71,34 @@ pub async fn parse_error(resp: Response<IncomingAsyncBody>) -> Result<Error> {
Ok(err)
}
+/// Returns the Errorkind of this code and whether the error is retryable.
+/// All possible error code: <https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList>
+pub fn kind_and_retryable(code: &str) -> Option<(ErrorKind, bool)> {
Review Comment:
I prefer to have an API like:
`fn parse_s3_error_code(code: &str) -> (ErrorKind, bool)`
##########
core/src/services/s3/error.rs:
##########
@@ -79,6 +71,34 @@ pub async fn parse_error(resp: Response<IncomingAsyncBody>) -> Result<Error> {
Ok(err)
}
+/// Returns the Errorkind of this code and whether the error is retryable.
+/// All possible error code: <https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList>
+pub fn kind_and_retryable(code: &str) -> Option<(ErrorKind, bool)> {
+ match code {
+ // > Your socket connection to the server was not read from
+ // > or written to within the timeout period."
+ //
+ // It's Ok for us to retry it again.
+ "RequestTimeout" => Some((ErrorKind::Unexpected, true)),
+ // > An internal error occurred. Try again.
+ "InternalError" => Some((ErrorKind::Unexpected, true)),
+ // > A conflicting conditional operation is currently in progress
+ // > against this resource. Try again.
+ "OperationAborted" => Some((ErrorKind::Unexpected, true)),
+ // > Please reduce your request rate.
+ //
+ // It's Ok to retry since later on the request rate may get reduced.
+ "SlowDown" => Some((ErrorKind::Unexpected, true)),
Review Comment:
We can use `RateLimited`
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] ClSlaid commented on a diff in pull request #2171: fix(service/s3): set retryable on batch
Posted by "ClSlaid (via GitHub)" <gi...@apache.org>.
ClSlaid commented on code in PR #2171:
URL: https://github.com/apache/incubator-opendal/pull/2171#discussion_r1181390728
##########
core/src/services/s3/error.rs:
##########
@@ -79,6 +71,34 @@ pub async fn parse_error(resp: Response<IncomingAsyncBody>) -> Result<Error> {
Ok(err)
}
+/// Returns the Errorkind of this code and whether the error is retryable.
+/// All possible error code: <https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList>
+pub fn parse_s3_error_code(code: &str) -> Option<(ErrorKind, bool)> {
Review Comment:
Consider use `(ErrorKind, bool)` directly, instead of wrapping in `Option`.
##########
core/src/services/s3/error.rs:
##########
@@ -58,16 +58,8 @@ pub async fn parse_error(resp: Response<IncomingAsyncBody>) -> Result<Error> {
.map(|s3_err| (format!("{s3_err:?}"), Some(s3_err)))
.unwrap_or_else(|_| (String::from_utf8_lossy(&bs).into_owned(), None));
- // All possible error code: <https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList>
if let Some(s3_err) = s3_err {
- (kind, retryable) = match s3_err.code.as_str() {
- // > Your socket connection to the server was not read from
- // > or written to within the timeout period."
- //
- // It's Ok for us to retry it again.
- "RequestTimeout" => (ErrorKind::Unexpected, true),
- _ => (kind, retryable),
- }
+ (kind, retryable) = parse_s3_error_code(s3_err.code.as_str()).unwrap_or((kind, retryable));
Review Comment:
Looks like we will always need a `(ErrorKind, bool)` tuple here. Can we use `(ErrorKind, bool)` directly?
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2171: fix(service/s3): set retryable on batch
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #2171:
URL: https://github.com/apache/incubator-opendal/pull/2171#discussion_r1181262183
##########
core/src/services/s3/error.rs:
##########
@@ -79,6 +71,34 @@ pub async fn parse_error(resp: Response<IncomingAsyncBody>) -> Result<Error> {
Ok(err)
}
+/// Returns the Errorkind of this code and whether the error is retryable.
+/// All possible error code: <https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList>
+pub fn parse_s3_error_code(code: &str) -> Option<(ErrorKind, bool)> {
Review Comment:
I don't like the Option here which doesn't make sense.
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2171: fix(service/s3): set retryable on batch
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #2171:
URL: https://github.com/apache/incubator-opendal/pull/2171#discussion_r1181395250
##########
core/src/services/s3/error.rs:
##########
@@ -58,16 +58,8 @@ pub async fn parse_error(resp: Response<IncomingAsyncBody>) -> Result<Error> {
.map(|s3_err| (format!("{s3_err:?}"), Some(s3_err)))
.unwrap_or_else(|_| (String::from_utf8_lossy(&bs).into_owned(), None));
- // All possible error code: <https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList>
if let Some(s3_err) = s3_err {
- (kind, retryable) = match s3_err.code.as_str() {
- // > Your socket connection to the server was not read from
- // > or written to within the timeout period."
- //
- // It's Ok for us to retry it again.
- "RequestTimeout" => (ErrorKind::Unexpected, true),
- _ => (kind, retryable),
- }
+ (kind, retryable) = parse_s3_error_code(s3_err.code.as_str()).unwrap_or((kind, retryable));
Review Comment:
I got it. We need to re-use the old `(ErrorKind, bool)` here. Let's merge first and polish the error handling logic later.
--
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: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org