diff --git a/be/src/service/backend_options.cpp b/be/src/service/backend_options.cpp index 19167d7d9b1340..4ba520321e291f 100644 --- a/be/src/service/backend_options.cpp +++ b/be/src/service/backend_options.cpp @@ -33,9 +33,9 @@ static const std::string PRIORITY_CIDR_SEPARATOR = ";"; std::string BackendOptions::_s_localhost; std::vector BackendOptions::_s_priority_cidrs; -TBackend BackendOptions::_backend; bool BackendOptions::_bind_ipv6 = false; const char* _service_bind_address = "0.0.0.0"; +int64_t BackendOptions::_s_backend_id = 0; bool BackendOptions::init() { if (!analyze_priority_cidrs(config::priority_networks, &_s_priority_cidrs)) { @@ -68,15 +68,17 @@ const std::string& BackendOptions::get_localhost() { } TBackend BackendOptions::get_local_backend() { - _backend.__set_host(_s_localhost); - _backend.__set_be_port(config::be_port); - _backend.__set_http_port(config::webserver_port); - _backend.__set_brpc_port(config::brpc_port); - return _backend; + TBackend backend; + backend.__set_host(_s_localhost); + backend.__set_be_port(config::be_port); + backend.__set_http_port(config::webserver_port); + backend.__set_brpc_port(config::brpc_port); + backend.__set_id(_s_backend_id); + return backend; } void BackendOptions::set_backend_id(int64_t backend_id) { - _backend.__set_id(backend_id); + _s_backend_id = backend_id; } void BackendOptions::set_localhost(const std::string& host) { diff --git a/be/src/service/backend_options.h b/be/src/service/backend_options.h index 8f504ba2ea7ce3..70444f6d1802f0 100644 --- a/be/src/service/backend_options.h +++ b/be/src/service/backend_options.h @@ -31,6 +31,7 @@ class CIDR; class BackendOptions { public: + BackendOptions() = delete; static bool init(); static const std::string& get_localhost(); static TBackend get_local_backend(); @@ -48,11 +49,9 @@ class BackendOptions { static bool is_in_prior_network(const std::string& ip); static std::string _s_localhost; - static TBackend _backend; + static int64_t _s_backend_id; static std::vector _s_priority_cidrs; static bool _bind_ipv6; - - DISALLOW_COPY_AND_ASSIGN(BackendOptions); }; } // namespace doris