gavinchou commented on code in PR #45255:
URL: https://github.com/apache/doris/pull/45255#discussion_r1900334489


##########
cloud/src/common/network_util.cpp:
##########
@@ -160,6 +161,17 @@ static bool get_hosts_v4(std::vector<InetAddress>* hosts) {
 
 std::string get_local_ip(const std::string& priority_networks) {
     std::string localhost_str = butil::my_ip_cstr();
+    std::unique_ptr<int, std::function<void(int*)>> defer((int*)0x01, 
[&localhost_str](int*) {
+        // Check if ip eq 127.0.0.1, ms/recycler exit
+        if (config::enable_check_loopback_address_for_ms && "127.0.0.1" == 
localhost_str) {
+            LOG(WARNING) << "enable check prohibit use loopback addr, but 
localhost="
+                         << localhost_str
+                         << ", so exit(-1), please use priority network CIDR 
to set non-loopback "
+                            "address";
+            exit(-1);
+        }
+        LOG(INFO) << "at last, localhost=" << localhost_str;
+    });

Review Comment:
   ```suggestion
           LOG(INFO) << "get the IP for ms is " << localhost_str;
           if (config::enable_loopback_address_for_ms || localhost_str != 
"127.0.0.1") return;
           LOG(WARNING) << "localhost IP is loopback address (127.0.0.1), "
                        << "there may be multiple NICs for use, "
                        << "please set priority_network with a CIDR expression 
in doris_cloud.conf "
                        << "to choose a non-loopback address accordingly";
           exit(-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-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to