This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new d77b8ceddfb Pick "[enhance](S3) Print the oss request id for each 
error s3 request #32499" (#32607)
d77b8ceddfb is described below

commit d77b8ceddfb2eddd12ce6b25395b68658a534ad4
Author: AlexYue <[email protected]>
AuthorDate: Thu Mar 21 17:50:23 2024 +0800

    Pick "[enhance](S3) Print the oss request id for each error s3 request 
#32499" (#32607)
---
 be/src/io/fs/s3_file_reader.cpp |  9 +++++----
 be/src/io/fs/s3_file_system.cpp |  4 ++--
 be/src/io/fs/s3_file_writer.cpp | 26 ++++++++++++++++----------
 3 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/be/src/io/fs/s3_file_reader.cpp b/be/src/io/fs/s3_file_reader.cpp
index ceebc683a94..29faec47d8e 100644
--- a/be/src/io/fs/s3_file_reader.cpp
+++ b/be/src/io/fs/s3_file_reader.cpp
@@ -96,10 +96,11 @@ Status S3FileReader::read_at_impl(size_t offset, Slice 
result, size_t* bytes_rea
     }
     auto outcome = client->GetObject(request);
     if (!outcome.IsSuccess()) {
-        return Status::IOError("failed to read from {}: {}, exception {}, 
error code {}",
-                               _path.native(), outcome.GetError().GetMessage(),
-                               outcome.GetError().GetExceptionName(),
-                               outcome.GetError().GetResponseCode());
+        return Status::IOError(
+                "failed to read from {}: {}, exception {}, error code {}, 
request id {}",
+                _path.native(), outcome.GetError().GetMessage(),
+                outcome.GetError().GetExceptionName(), 
outcome.GetError().GetResponseCode(),
+                outcome.GetError().GetRequestId());
     }
     *bytes_read = outcome.GetResult().GetContentLength();
     if (*bytes_read != bytes_req) {
diff --git a/be/src/io/fs/s3_file_system.cpp b/be/src/io/fs/s3_file_system.cpp
index cad49b4555c..6423de4fa15 100644
--- a/be/src/io/fs/s3_file_system.cpp
+++ b/be/src/io/fs/s3_file_system.cpp
@@ -526,10 +526,10 @@ Status S3FileSystem::get_key(const Path& path, 
std::string* key) const {
 
 template <typename AwsOutcome>
 std::string S3FileSystem::error_msg(const std::string& key, const AwsOutcome& 
outcome) const {
-    return fmt::format("(endpoint: {}, bucket: {}, key:{}, {}), {}, error code 
{}",
+    return fmt::format("(endpoint: {}, bucket: {}, key:{}, {}), {}, error code 
{}, request id {}",
                        _s3_conf.endpoint, _s3_conf.bucket, key,
                        outcome.GetError().GetExceptionName(), 
outcome.GetError().GetMessage(),
-                       outcome.GetError().GetResponseCode());
+                       outcome.GetError().GetResponseCode(), 
outcome.GetError().GetRequestId());
 }
 
 std::string S3FileSystem::error_msg(const std::string& key, const std::string& 
err) const {
diff --git a/be/src/io/fs/s3_file_writer.cpp b/be/src/io/fs/s3_file_writer.cpp
index 39a8441f87b..1679385165d 100644
--- a/be/src/io/fs/s3_file_writer.cpp
+++ b/be/src/io/fs/s3_file_writer.cpp
@@ -120,9 +120,10 @@ Status S3FileWriter::_create_multi_upload_request() {
     }
     return Status::IOError(
             "failed to create multipart upload(bucket={}, key={}, 
upload_id={}): {}, exception {}, "
-            "error code {}",
+            "error code {}, request id {}",
             _bucket, _path.native(), _upload_id, 
outcome.GetError().GetMessage(),
-            outcome.GetError().GetExceptionName(), 
outcome.GetError().GetResponseCode());
+            outcome.GetError().GetExceptionName(), 
outcome.GetError().GetResponseCode(),
+            outcome.GetError().GetRequestId());
 }
 
 void S3FileWriter::_wait_until_finish(std::string_view task_name) {
@@ -174,9 +175,10 @@ Status S3FileWriter::abort() {
     }
     return Status::IOError(
             "failed to abort multipart upload(bucket={}, key={}, 
upload_id={}): {}, exception {}, "
-            "error code {}",
+            "error code {}, request id {}",
             _bucket, _path.native(), _upload_id, 
outcome.GetError().GetMessage(),
-            outcome.GetError().GetExceptionName(), 
outcome.GetError().GetResponseCode());
+            outcome.GetError().GetExceptionName(), 
outcome.GetError().GetResponseCode(),
+            outcome.GetError().GetRequestId());
 }
 
 Status S3FileWriter::close() {
@@ -306,11 +308,12 @@ void S3FileWriter::_upload_one_part(int64_t part_num, 
S3FileBuffer& buf) {
     if (!upload_part_outcome.IsSuccess()) {
         auto s = Status::IOError(
                 "failed to upload part (bucket={}, key={}, part_num={}, 
up_load_id={}): {}, "
-                "exception {}, error code {}",
+                "exception {}, error code {}, request id {}",
                 _bucket, _path.native(), part_num, _upload_id,
                 upload_part_outcome.GetError().GetMessage(),
                 upload_part_outcome.GetError().GetExceptionName(),
-                upload_part_outcome.GetError().GetResponseCode());
+                upload_part_outcome.GetError().GetResponseCode(),
+                upload_part_outcome.GetError().GetRequestId());
         LOG_WARNING(s.to_string());
         buf._on_failed(s);
         return;
@@ -357,10 +360,11 @@ Status S3FileWriter::_complete() {
     if (!compute_outcome.IsSuccess()) {
         auto s = Status::IOError(
                 "failed to create complete multi part upload (bucket={}, 
key={}): {}, exception "
-                "{}, error code {}",
+                "{}, error code {}, request id {}",
                 _bucket, _path.native(), 
compute_outcome.GetError().GetMessage(),
                 compute_outcome.GetError().GetExceptionName(),
-                compute_outcome.GetError().GetResponseCode());
+                compute_outcome.GetError().GetResponseCode(),
+                compute_outcome.GetError().GetRequestId());
         LOG_WARNING(s.to_string());
         return s;
     }
@@ -399,9 +403,11 @@ void S3FileWriter::_put_object(S3FileBuffer& buf) {
     auto response = _client->PutObject(request);
     if (!response.IsSuccess()) {
         _st = Status::InternalError(
-                "failed to put object (bucket={}, key={}), Error: [{}:{}, 
responseCode:{}]",
+                "failed to put object (bucket={}, key={}), Error: [{}:{}, 
responseCode:{}, request "
+                "id:{}]",
                 _bucket, _path.native(), 
response.GetError().GetExceptionName(),
-                response.GetError().GetMessage(), 
response.GetError().GetResponseCode());
+                response.GetError().GetMessage(), 
response.GetError().GetResponseCode(),
+                response.GetError().GetRequestId());
         LOG(WARNING) << _st;
         buf._on_failed(_st);
         return;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to