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

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

commit 39f49559a6ff207e67d28aab239a02f50a6c75a4
Author: AlexYue <yj976240...@gmail.com>
AuthorDate: Fri Apr 26 23:19:57 2024 +0800

    [enhance](S3) Add one config to control s3 client's scheme (#34176)
---
 be/src/common/config.cpp | 6 ++++++
 be/src/common/config.h   | 3 +++
 be/src/util/s3_util.cpp  | 5 +++++
 3 files changed, 14 insertions(+)

diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index 85d17c08e74..7844211322e 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -1205,6 +1205,12 @@ DEFINE_mInt32(thrift_client_open_num_tries, "1");
 
 DEFINE_Bool(enable_index_compaction, "false");
 
+// http scheme in S3Client to use. E.g. http or https
+DEFINE_String(s3_client_http_scheme, "http");
+DEFINE_Validator(s3_client_http_scheme, [](const std::string& config) -> bool {
+    return config == "http" || config == "https";
+});
+
 // enable injection point in regression-test
 DEFINE_mBool(enable_injection_point, "false");
 
diff --git a/be/src/common/config.h b/be/src/common/config.h
index d2f95653f1e..e7af34574ba 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -1287,6 +1287,9 @@ DECLARE_mInt64(hive_sink_max_file_size);
 // Retry the Open num_retries time waiting 100 milliseconds between retries.
 DECLARE_mInt32(thrift_client_open_num_tries);
 
+// http scheme in S3Client to use. E.g. http or https
+DECLARE_String(s3_client_http_scheme);
+
 // enable injection point in regression-test
 DECLARE_mBool(enable_injection_point);
 
diff --git a/be/src/util/s3_util.cpp b/be/src/util/s3_util.cpp
index eebda214757..233b936122c 100644
--- a/be/src/util/s3_util.cpp
+++ b/be/src/util/s3_util.cpp
@@ -197,6 +197,11 @@ std::shared_ptr<Aws::S3::S3Client> 
S3ClientFactory::create(const S3ClientConf& s
     if (s3_conf.connect_timeout_ms > 0) {
         aws_config.connectTimeoutMs = s3_conf.connect_timeout_ms;
     }
+
+    if (config::s3_client_http_scheme == "http") {
+        aws_config.scheme = Aws::Http::Scheme::HTTP;
+    }
+
     aws_config.retryStrategy =
             
std::make_shared<Aws::Client::DefaultRetryStrategy>(config::max_s3_client_retry);
     std::shared_ptr<Aws::S3::S3Client> new_client;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to