-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature](cloud) Add priority network support for meta-service registry #33931
[feature](cloud) Add priority network support for meta-service registry #33931
Conversation
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
run buildall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
#include "common/network_util.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'common/network_util.h' file not found [clang-diagnostic-error]
#include "common/network_util.h"
^
if (errno != 0 && mask_length == 0) { | ||
char errmsg[64]; | ||
// Ignore unused return value | ||
auto ret = strerror_r(errno, errmsg, 64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'auto ret' can be declared as 'auto *ret' [readability-qualified-auto]
auto ret = strerror_r(errno, errmsg, 64); | |
auto *ret = strerror_r(errno, errmsg, 64); |
netmask_ = netmask_ << (32 - mask_length); | ||
return true; | ||
} | ||
bool contains(const std::string& ip) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'contains' can be made const [readability-make-member-function-const]
bool contains(const std::string& ip) { | |
bool contains(const std::string& ip) const { |
return true; | ||
} | ||
|
||
uint32_t address_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: use default member initializer for 'address_' [modernize-use-default-member-init]
cloud/src/common/network_util.cpp:37:
- CIDR() : address_(0), netmask_(0xffffffff) {}
+ CIDR() : , netmask_(0xffffffff) {}
uint32_t address_; | |
uint32_t address_{0}; |
} | ||
|
||
uint32_t address_; | ||
uint32_t netmask_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: use default member initializer for 'netmask_' [modernize-use-default-member-init]
cloud/src/common/network_util.cpp:37:
- CIDR() : address_(0), netmask_(0xffffffff) {}
+ CIDR() : address_(0), {}
uint32_t netmask_; | |
uint32_t netmask_{0xffffffff}; |
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
#include "common/network_util.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'common/network_util.h' file not found [clang-diagnostic-error]
#include "common/network_util.h"
^
f540e31
to
1ffb18a
Compare
run buildall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
} else if (!priority_cidrs.empty()) { | ||
if (is_in_prior_network(addr_it->get_host_address_v4())) { | ||
localhost_str = addr_it->get_host_address_v4(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if (!priority_cidrs.empty()) { | ||
if (is_in_prior_network(addr_it->get_host_address_v4())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if (!priority_cidrs.empty()) { | |
if (is_in_prior_network(addr_it->get_host_address_v4())) { | |
} else if (!priority_cidrs.empty() && is_in_prior_network(addr_it->get_host_address_v4())) { |
Meta-service registry IP may be 127.0.0.1 without priority network support. It will be a problem for syncing if there are multiple meta-service.
This PR introduces CIDR-based filter to select a true IP for meta-service when registering itself.