You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by ji...@apache.org on 2022/07/21 03:31:25 UTC

[incubator-pegasus] branch master updated: feat: The conf server_list of meta_server support use fqdn:port (#1061)

This is an automated email from the ASF dual-hosted git repository.

jiashuo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new a3d43b773 feat: The conf server_list of meta_server support use fqdn:port (#1061)
a3d43b773 is described below

commit a3d43b7739c7b7cfbc36e5fac39b01ae8774ae28
Author: WHBANG <38...@users.noreply.github.com>
AuthorDate: Thu Jul 21 11:31:19 2022 +0800

    feat: The conf server_list of meta_server support use fqdn:port (#1061)
---
 src/rdsn/src/common/replication_common.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/rdsn/src/common/replication_common.cpp b/src/rdsn/src/common/replication_common.cpp
index 46c2e6fd3..9d42b6fba 100644
--- a/src/rdsn/src/common/replication_common.cpp
+++ b/src/rdsn/src/common/replication_common.cpp
@@ -477,7 +477,23 @@ bool replica_helper::load_meta_servers(/*out*/ std::vector<dsn::rpc_address> &se
     ::dsn::utils::split_args(server_list.c_str(), lv, ',');
     for (auto &s : lv) {
         ::dsn::rpc_address addr;
-        if (!addr.from_string_ipv4(s.c_str())) {
+        std::vector<std::string> hostname_port;
+        uint32_t ip = 0;
+        utils::split_args(s.c_str(), hostname_port, ':');
+        dassert_f(2 == hostname_port.size(),
+                  "invalid address '{}' specified in config [{}].{}",
+                  s.c_str(),
+                  section,
+                  key);
+        uint32_t port_num = 0;
+        dassert_f(dsn::internal::buf2unsigned(hostname_port[1], port_num) && port_num < UINT16_MAX,
+                  "invalid address '{}' specified in config [{}].{}",
+                  s.c_str(),
+                  section,
+                  key);
+        if (0 != (ip = ::dsn::rpc_address::ipv4_from_host(hostname_port[0].c_str()))) {
+            addr.assign_ipv4(ip, static_cast<uint16_t>(port_num));
+        } else if (!addr.from_string_ipv4(s.c_str())) {
             derror_f("invalid address '{}' specified in config [{}].{}", s, section, key);
             return false;
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org