Skip to content

Commit

Permalink
[Enhancement] support config s3client request timeout for shared-data…
Browse files Browse the repository at this point in the history
… fslib (StarRocks#54211)

Signed-off-by: Kevin Xiaohua Cai <[email protected]>
  • Loading branch information
kevincai authored and magzhu committed Jan 6, 2025
1 parent d790856 commit f6ae211
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ CONF_Int64(object_storage_connect_timeout_ms, "-1");
// Note that for Curl this config is converted to seconds by rounding down to the nearest whole second except when the
// value is greater than 0 and less than 1000.
// When it's 0, low speed limit check will be disabled.
CONF_Int64(object_storage_request_timeout_ms, "-1");
CONF_mInt64(object_storage_request_timeout_ms, "-1");
// Request timeout for object storage specialized for rename_file operation.
// if this parameter is 0, use object_storage_request_timeout_ms instead.
CONF_Int64(object_storage_rename_file_request_timeout_ms, "30000");
Expand Down Expand Up @@ -1031,6 +1031,9 @@ CONF_mInt32(starlet_fs_read_prefetch_threadpool_size, "128");
CONF_mInt32(starlet_fslib_s3client_nonread_max_retries, "5");
CONF_mInt32(starlet_fslib_s3client_nonread_retry_scale_factor, "200");
CONF_mInt32(starlet_fslib_s3client_connect_timeout_ms, "1000");
// make starlet_fslib_s3client_request_timeout_ms as an alias of the object_storage_request_timeout_ms
// NOTE: need to handle the negative value properly
CONF_Alias(object_storage_request_timeout_ms, starlet_fslib_s3client_request_timeout_ms);
CONF_mInt32(starlet_delete_files_max_key_in_batch, "1000");
#endif

Expand Down
4 changes: 4 additions & 0 deletions be/src/http/action/update_config_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,10 @@ Status UpdateConfigAction::update_config(const std::string& name, const std::str
UPDATE_STARLET_CONFIG(starlet_fslib_s3client_nonread_retry_scale_factor,
fslib_s3client_nonread_retry_scale_factor);
UPDATE_STARLET_CONFIG(starlet_fslib_s3client_connect_timeout_ms, fslib_s3client_connect_timeout_ms);
if (config::object_storage_request_timeout_ms >= 0 &&
config::object_storage_request_timeout_ms <= std::numeric_limits<int32_t>::max()) {
UPDATE_STARLET_CONFIG(object_storage_request_timeout_ms, fslib_s3client_request_timeout_ms);
}
UPDATE_STARLET_CONFIG(s3_use_list_objects_v1, fslib_s3client_use_list_objects_v1);
UPDATE_STARLET_CONFIG(starlet_delete_files_max_key_in_batch, delete_files_max_key_in_batch);
#undef UPDATE_STARLET_CONFIG
Expand Down
4 changes: 4 additions & 0 deletions be/src/service/staros_worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ DECLARE_int32(fslib_s3client_max_instance_per_item);
DECLARE_int32(fslib_s3client_nonread_max_retries);
DECLARE_int32(fslib_s3client_nonread_retry_scale_factor);
DECLARE_int32(fslib_s3client_connect_timeout_ms);
DECLARE_int32(fslib_s3client_request_timeout_ms);
DECLARE_bool(fslib_s3client_use_list_objects_v1);
// threadpool size for buffer prefetch task
DECLARE_int32(fs_buffer_prefetch_threadpool_size);
Expand Down Expand Up @@ -395,6 +396,9 @@ void init_staros_worker(const std::shared_ptr<starcache::StarCache>& star_cache)
FLAGS_fslib_s3client_nonread_retry_scale_factor = config::starlet_fslib_s3client_nonread_retry_scale_factor;
FLAGS_fslib_s3client_connect_timeout_ms = config::starlet_fslib_s3client_connect_timeout_ms;
FLAGS_fslib_s3client_use_list_objects_v1 = config::s3_use_list_objects_v1;
if (config::object_storage_request_timeout_ms >= 0) {
FLAGS_fslib_s3client_request_timeout_ms = static_cast<int32_t>(config::object_storage_request_timeout_ms);
}
fslib::FLAGS_delete_files_max_key_in_batch = config::starlet_delete_files_max_key_in_batch;

fslib::FLAGS_use_star_cache = config::starlet_use_star_cache;
Expand Down

0 comments on commit f6ae211

Please sign in to comment.