acelyc111 commented on code in PR #1825:
URL:
https://github.com/apache/incubator-pegasus/pull/1825#discussion_r1440400151
##########
src/runtime/rpc/rpc_host_port.cpp:
##########
@@ -157,12 +159,20 @@ std::string host_port::to_string() const
case HOST_TYPE_IPV4:
return fmt::format("{}:{}", _host, _port);
case HOST_TYPE_GROUP:
- return fmt::format("address group {}", group_host_port()->name());
+ return fmt::format("host_port group {}", group_host_port()->name());
default:
- return "invalid address";
+ return "invalid host_port";
}
}
+static __thread fixed_size_buffer_pool<8, 256> bf;
Review Comment:
The entire hostname, including the delimiting dots, has a maximum of 253
ASCII characters, so 256 is not enough for host and port (5 bytes at maximum)
> https://en.wikipedia.org/wiki/Hostname
##########
src/runtime/rpc/rpc_host_port.h:
##########
@@ -118,6 +120,22 @@ inline bool operator==(const host_port &hp1, const
host_port &hp2)
inline bool operator!=(const host_port &hp1, const host_port &hp2) { return
!(hp1 == hp2); }
+inline bool operator<(const host_port &hp1, const host_port &hp2)
Review Comment:
Add some tests.
##########
src/runtime/rpc/rpc_host_port.cpp:
##########
@@ -80,6 +81,7 @@ host_port::host_port(rpc_address addr)
} break;
case HOST_TYPE_GROUP: {
_group_host_port = new rpc_group_host_port(addr.group_address());
+ _group_host_port->add_ref();
Review Comment:
What if not adding this?
##########
src/runtime/rpc/rpc_host_port.h:
##########
@@ -85,6 +85,8 @@ class host_port
// This function is used for validating the format of string like
"localhost:8888".
bool from_string(const std::string &s);
+ const char *get_char_str() const;
Review Comment:
How will this function be used? Is to_string() meet the requirement?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]