You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "ZashJie (via GitHub)" <gi...@apache.org> on 2023/02/10 10:04:06 UTC
[GitHub] [doris] ZashJie opened a new pull request, #16617: ZhangShunjieNet interface
ZashJie opened a new pull request, #16617:
URL: https://github.com/apache/doris/pull/16617
# Proposed changes
Issue Number: close #xxx
## Problem summary
Describe your changes.
## Checklist(Required)
1. Does it affect the original behavior:
- [ ] Yes
- [ ] No
- [ ] I don't know
2. Has unit tests been added:
- [ ] Yes
- [ ] No
- [ ] No Need
3. Has document been added or modified:
- [ ] Yes
- [ ] No
- [ ] No Need
4. Does it need to update dependencies:
- [ ] Yes
- [ ] No
5. Are there any changes that cannot be rolled back:
- [ ] Yes (If Yes, please explain WHY)
- [ ] No
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16617: ZhangShunjieNet interface
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16617:
URL: https://github.com/apache/doris/pull/16617#issuecomment-1426689358
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] dataroaring commented on a diff in pull request #16617: [Feature](network interface) Support network interface
Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #16617:
URL: https://github.com/apache/doris/pull/16617#discussion_r1122534473
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +110,48 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+bool BackendOptions::get_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interfaces;
+
+ struct ifaddrs * ifAddrStruct = NULL;
+ void * tmpAddrPtr = NULL;
+
+ getifaddrs(&ifAddrStruct);
+
+ std::vector<std::string> name_strs =
+ strings::Split(config::network_interfaces, PRIORITY_CIDR_SEPARATOR);
+ bool flag = false;
Review Comment:
found may be a better name here.
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +110,48 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+bool BackendOptions::get_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interfaces;
+
+ struct ifaddrs * ifAddrStruct = NULL;
+ void * tmpAddrPtr = NULL;
+
+ getifaddrs(&ifAddrStruct);
+
+ std::vector<std::string> name_strs =
+ strings::Split(config::network_interfaces, PRIORITY_CIDR_SEPARATOR);
+ bool flag = false;
+
+ for (auto& name_str : name_strs) {
+ while (ifAddrStruct!=NULL) {
+ if (ifAddrStruct->ifa_addr->sa_family==AF_INET) { // check it is IP4
Review Comment:
we should put a space around !=, ==, +, - etc. liking while (ifAddrStruct != nullptr)
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +110,48 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+bool BackendOptions::get_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interfaces;
+
+ struct ifaddrs * ifAddrStruct = NULL;
+ void * tmpAddrPtr = NULL;
+
+ getifaddrs(&ifAddrStruct);
+
+ std::vector<std::string> name_strs =
Review Comment:
nic_names is a better var name.
##########
be/src/service/backend_options.h:
##########
@@ -21,6 +21,8 @@
#include <string>
#include <vector>
+#include <ifaddrs.h>
+#include <arpa/inet.h>
Review Comment:
put the two .h to .cpp .
##########
be/src/service/backend_options.cpp:
##########
@@ -57,6 +62,10 @@ bool BackendOptions::init() {
VLOG_CRITICAL << "check ip=" << addr_it->get_host_address_v4();
if ((*addr_it).is_loopback_v4()) {
loopback = addr_it->get_host_address_v4();
+ } else if (!_s_net_interfaces.empty()) {
+ if (is_in_net_interface(addr_it->get_host_address_v4())) {
+ _s_localhost = addr_it->get_host_address_v4();
+ }
Review Comment:
We should not follow cidrs here.
There is a problem here, e.g. There are 2 nics, eth0 and eth1, we configed eth1 and cidrs, if we tranverse eth0 first then cidr is used. we should let network interface is selected in priority.
So we should handle net_interface before this while.
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +110,48 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+bool BackendOptions::get_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interfaces;
+
+ struct ifaddrs * ifAddrStruct = NULL;
+ void * tmpAddrPtr = NULL;
+
+ getifaddrs(&ifAddrStruct);
+
+ std::vector<std::string> name_strs =
+ strings::Split(config::network_interfaces, PRIORITY_CIDR_SEPARATOR);
+ bool flag = false;
+
+ for (auto& name_str : name_strs) {
+ while (ifAddrStruct!=NULL) {
+ if (ifAddrStruct->ifa_addr->sa_family==AF_INET) { // check it is IP4
Review Comment:
for (; if_addr_struct != nullptr; if_addr_struct = if_addr_struct->ifa_next) {
...
}
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +110,48 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+bool BackendOptions::get_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interfaces;
Review Comment:
network interfaces in conf:
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +110,48 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+bool BackendOptions::get_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interfaces;
+
+ struct ifaddrs * ifAddrStruct = NULL;
+ void * tmpAddrPtr = NULL;
+
+ getifaddrs(&ifAddrStruct);
+
+ std::vector<std::string> name_strs =
+ strings::Split(config::network_interfaces, PRIORITY_CIDR_SEPARATOR);
+ bool flag = false;
+
+ for (auto& name_str : name_strs) {
+ while (ifAddrStruct!=NULL) {
+ if (ifAddrStruct->ifa_addr->sa_family==AF_INET) { // check it is IP4
+ // is a valid IP4 Address
+ if (name_str == ifAddrStruct->ifa_name) {
+ tmpAddrPtr=&((struct sockaddr_in *)ifAddrStruct->ifa_addr)->sin_addr;
Review Comment:
tmpAddrPtr = &...
##########
fe/fe-core/src/main/java/org/apache/doris/service/FrontendOptions.java:
##########
@@ -68,6 +81,11 @@ public static void init() throws UnknownHostException {
if (addr instanceof Inet4Address) {
if (addr.isLoopbackAddress()) {
loopBack = addr;
+ } else if (!netInterfaces.isEmpty()) {
+ if (isInNetInterface(addr.getHostAddress())) {
+ localAddr = addr;
+ break;
+ }
Review Comment:
same as be.
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +110,48 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+bool BackendOptions::get_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interfaces;
+
+ struct ifaddrs * ifAddrStruct = NULL;
+ void * tmpAddrPtr = NULL;
+
+ getifaddrs(&ifAddrStruct);
+
+ std::vector<std::string> name_strs =
+ strings::Split(config::network_interfaces, PRIORITY_CIDR_SEPARATOR);
+ bool flag = false;
+
+ for (auto& name_str : name_strs) {
+ while (ifAddrStruct!=NULL) {
+ if (ifAddrStruct->ifa_addr->sa_family==AF_INET) { // check it is IP4
Review Comment:
use if_addr_struct instead of ifAddrStruct.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] Yukang-Lian commented on a diff in pull request #16617: ZhangShunjieNet interface
Posted by "Yukang-Lian (via GitHub)" <gi...@apache.org>.
Yukang-Lian commented on code in PR #16617:
URL: https://github.com/apache/doris/pull/16617#discussion_r1102817723
##########
be/src/service/backend_options.cpp:
##########
@@ -81,15 +84,11 @@ std::string BackendOptions::get_localhost() {
return _s_localhost;
}
-bool BackendOptions::analyze_priority_cidrs() {
- if (config::priority_networks == "") {
- return true;
- }
- LOG(INFO) << "priority cidrs in conf: " << config::priority_networks;
-
+// 解析IP为cidr表达方式
Review Comment:
please use english comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] dataroaring commented on a diff in pull request #16617: ZhangShunjieNet interface
Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #16617:
URL: https://github.com/apache/doris/pull/16617#discussion_r1102610699
##########
be/src/service/backend_options.cpp:
##########
@@ -81,15 +84,11 @@ std::string BackendOptions::get_localhost() {
return _s_localhost;
}
-bool BackendOptions::analyze_priority_cidrs() {
- if (config::priority_networks == "") {
- return true;
- }
- LOG(INFO) << "priority cidrs in conf: " << config::priority_networks;
-
+// 解析IP为cidr表达方式
+bool BackendOptions::analyze_cidrs(const std::string & ip) {
Review Comment:
There is no need to modify this function.
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +100,61 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+
+//从network_interface中获取IP
+bool BackendOptions::analyze_network_interface() {
+ if (config::network_interface[0] == "") {
+ // 为空,则去分析priority_networks配置值
+ return false;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interface[0];
+ LOG(INFO) << "priority cidrs in conf: " << config::network_interface[1];
+
Review Comment:
Please merge the above 2 LOGS to one, LOG(INFO) << "" << "" <<.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16617: [Feature](network interface) Support network interface
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16617:
URL: https://github.com/apache/doris/pull/16617#issuecomment-1455459348
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16617: [Feature](network interface) Support network interface
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16617:
URL: https://github.com/apache/doris/pull/16617#issuecomment-1455473532
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16617: [Feature](network interface) Support network interface
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16617:
URL: https://github.com/apache/doris/pull/16617#issuecomment-1703968973
We're closing this PR because it hasn't been updated in a while.
This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and feel free a maintainer to remove the Stale tag!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16617: [Feature](network interface) Support network interface
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16617:
URL: https://github.com/apache/doris/pull/16617#issuecomment-1455094890
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] closed pull request #16617: [Feature](network interface) Support network interface
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #16617: [Feature](network interface) Support network interface
URL: https://github.com/apache/doris/pull/16617
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] hf200012 commented on pull request #16617: ZhangShunjieNet interface
Posted by "hf200012 (via GitHub)" <gi...@apache.org>.
hf200012 commented on PR #16617:
URL: https://github.com/apache/doris/pull/16617#issuecomment-1425588711
title style :[<type>](<scope>) <subject>
https://doris.apache.org/zh-CN/community/how-to-contribute/commit-format-specification
@ZashJie
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16617: ZhangShunjieNet interface
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16617:
URL: https://github.com/apache/doris/pull/16617#issuecomment-1425554179
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] dataroaring commented on a diff in pull request #16617: [Feature](network interface) Support network interface
Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #16617:
URL: https://github.com/apache/doris/pull/16617#discussion_r1106567023
##########
be/src/service/backend_options.cpp:
##########
@@ -81,6 +84,51 @@ std::string BackendOptions::get_localhost() {
return _s_localhost;
}
+bool BackendOptions::analyze_network_interface() {
+ if (config::network_interface[0] == "") {
+ return false;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interface[0] << "\tpriority cidrs in conf: " << config::network_interface[1];
+
Review Comment:
we should not print cidrs here, it is confusing.
##########
be/src/common/config.h:
##########
@@ -49,6 +49,8 @@ CONF_Int32(single_replica_load_brpc_num_threads, "64");
// If no ip match this rule, will choose one randomly.
CONF_String(priority_networks, "");
+CONF_Strings(network_interface, "");
Review Comment:
String is enough.
##########
be/src/service/backend_options.cpp:
##########
@@ -81,6 +84,51 @@ std::string BackendOptions::get_localhost() {
return _s_localhost;
}
+bool BackendOptions::analyze_network_interface() {
+ if (config::network_interface[0] == "") {
+ return false;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interface[0] << "\tpriority cidrs in conf: " << config::network_interface[1];
+
+ std::vector<std::string> cidr_strs =
Review Comment:
variable name is confusing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #16617: [Feature](network interface) Support network interface
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16617:
URL: https://github.com/apache/doris/pull/16617#issuecomment-1455475150
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on a diff in pull request #16617: [Feature](network interface) Support network interface
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #16617:
URL: https://github.com/apache/doris/pull/16617#discussion_r1125588905
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +112,43 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+bool BackendOptions::analyze_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network interfaces in conf: " << config::network_interfaces;
+
+ struct ifaddrs * if_addr_struct = NULL;
Review Comment:
warning: use nullptr [modernize-use-nullptr]
```suggestion
struct ifaddrs * if_addr_struct = nullptr;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] Yukang-Lian commented on a diff in pull request #16617: ZhangShunjieNet interface
Posted by "Yukang-Lian (via GitHub)" <gi...@apache.org>.
Yukang-Lian commented on code in PR #16617:
URL: https://github.com/apache/doris/pull/16617#discussion_r1102817961
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +100,61 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+
+//从network_interface中获取IP
Review Comment:
ditto
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +100,61 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+
+//从network_interface中获取IP
+bool BackendOptions::analyze_network_interface() {
+ if (config::network_interface[0] == "") {
+ // 为空,则去分析priority_networks配置值
+ return false;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interface[0];
+ LOG(INFO) << "priority cidrs in conf: " << config::network_interface[1];
+
+ if (analyze_cidrs(config::network_interface[1])) {
+ return true;
+ } else {
+ return false;
+ }
+ // std::vector<std::string> cidr_strs =
+ // strings::Split(config::network_interface[1], PRIORITY_CIDR_SEPARATOR);
+
+ // for (auto& cidr_str : cidr_strs) {
+ // CIDR cidr;
+ // if (!cidr.reset(cidr_str)) {
+ // LOG(FATAL) << "wrong cidr format. cidr_str=" << cidr_str;
+ // return false;
+ // }
+ // _s_priority_cidrs.push_back(cidr);
+ // }
+ // return true;
Review Comment:
useless code?
##########
conf/be.conf:
##########
@@ -34,13 +34,14 @@ brpc_port = 8060
# If no ip match this rule, will choose one randomly.
# use CIDR format, e.g. 10.10.10.0/24
# Default value is empty.
-# priority_networks = 10.10.10.0/24;192.168.0.0/16
+priority_networks = 127.0.0.1/16
+network_interface = eth1, 127.0.0.1/16
# data root path, separate by ';'
# you can specify the storage medium of each root path, HDD or SSD
# you can add capacity limit at the end of each root path, separate by ','
# eg:
-# storage_root_path = /home/disk1/doris.HDD,50;/home/disk2/doris.SSD,1;/home/disk2/doris
+# storage_root_path = /root/git/output/be/storage;/home/disk2/doris.SSD,1;/home/disk2/doris
# /home/disk1/doris.HDD, capacity limit is 50GB, HDD;
# /home/disk2/doris.SSD, capacity limit is 1GB, SSD;
Review Comment:
modify this file in your environment, but do not commit it.
##########
conf/fe.conf:
##########
@@ -52,7 +52,7 @@ mysql_service_nio_enabled = true
# If no ip match this rule, will choose one randomly.
# use CIDR format, e.g. 10.10.10.0/24
# Default value is empty.
-# priority_networks = 10.10.10.0/24;192.168.0.0/16
+priority_networks = 127.0.0.1/16
# Advanced configurations
# log_roll_size_mb = 1024
Review Comment:
ditto
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +100,61 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+
+//从network_interface中获取IP
+bool BackendOptions::analyze_network_interface() {
+ if (config::network_interface[0] == "") {
+ // 为空,则去分析priority_networks配置值
+ return false;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interface[0];
+ LOG(INFO) << "priority cidrs in conf: " << config::network_interface[1];
+
+ if (analyze_cidrs(config::network_interface[1])) {
+ return true;
+ } else {
+ return false;
+ }
+ // std::vector<std::string> cidr_strs =
+ // strings::Split(config::network_interface[1], PRIORITY_CIDR_SEPARATOR);
+
+ // for (auto& cidr_str : cidr_strs) {
+ // CIDR cidr;
+ // if (!cidr.reset(cidr_str)) {
+ // LOG(FATAL) << "wrong cidr format. cidr_str=" << cidr_str;
+ // return false;
+ // }
+ // _s_priority_cidrs.push_back(cidr);
+ // }
+ // return true;
+}
+
+bool BackendOptions::analyze_priority_cidrs() {
+ if (config::priority_networks == "") {
+ return true;
+ }
+ LOG(INFO) << "priority cidrs in conf: " << config::priority_networks;
+
+ if (analyze_cidrs(config::priority_networks)) {
+ return true;
+ } else {
+ return false;
+ }
+
+ // std::vector<std::string> cidr_strs =
+ // strings::Split(config::priority_networks, PRIORITY_CIDR_SEPARATOR);
+
+ // for (auto& cidr_str : cidr_strs) {
+ // CIDR cidr;
+ // if (!cidr.reset(cidr_str)) {
+ // LOG(FATAL) << "wrong cidr format. cidr_str=" << cidr_str;
+ // return false;
+ // }
+ // _s_priority_cidrs.push_back(cidr);
+ // }
+ // return true;
+}
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] morningman commented on pull request #16617: ZhangShunjieNet interface
Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman commented on PR #16617:
URL: https://github.com/apache/doris/pull/16617#issuecomment-1427198926
Please amend your PR title and add describe in your PR comment.
And I suggest to wait #14063 merge
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on a diff in pull request #16617: [Feature](network interface) Support network interface
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #16617:
URL: https://github.com/apache/doris/pull/16617#discussion_r1121395013
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +110,48 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+bool BackendOptions::get_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interfaces;
+
+ struct ifaddrs * ifAddrStruct = NULL;
Review Comment:
warning: use nullptr [modernize-use-nullptr]
```suggestion
struct ifaddrs * ifAddrStruct = nullptr;
```
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +110,48 @@
return true;
}
+bool BackendOptions::get_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interfaces;
+
+ struct ifaddrs * ifAddrStruct = NULL;
+ void * tmpAddrPtr = NULL;
+
+ getifaddrs(&ifAddrStruct);
+
+ std::vector<std::string> name_strs =
+ strings::Split(config::network_interfaces, PRIORITY_CIDR_SEPARATOR);
+ bool flag = false;
+
+ for (auto& name_str : name_strs) {
+ while (ifAddrStruct!=NULL) {
Review Comment:
warning: use nullptr [modernize-use-nullptr]
```suggestion
while (ifAddrStruct!=nullptr) {
```
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +110,48 @@
return true;
}
+bool BackendOptions::get_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network name in conf: " << config::network_interfaces;
+
+ struct ifaddrs * ifAddrStruct = NULL;
+ void * tmpAddrPtr = NULL;
Review Comment:
warning: use nullptr [modernize-use-nullptr]
```suggestion
void * tmpAddrPtr = nullptr;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on a diff in pull request #16617: [Feature](network interface) Support network interface
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #16617:
URL: https://github.com/apache/doris/pull/16617#discussion_r1124155633
##########
be/src/service/backend_options.cpp:
##########
@@ -101,6 +112,43 @@ bool BackendOptions::analyze_priority_cidrs() {
return true;
}
+bool BackendOptions::analyze_network_interfaces() {
+ if (config::network_interfaces == "") {
+ return true;
+ }
+ LOG(INFO) << "network interfaces in conf: " << config::network_interfaces;
+
+ struct ifaddrs * if_Addr_Struct = NULL;
Review Comment:
warning: use nullptr [modernize-use-nullptr]
```suggestion
struct ifaddrs * if_Addr_Struct = nullptr;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org