mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Avoid excessive getpeername(2) calls for zookeeper_log
This commit is contained in:
parent
5bb0a91f83
commit
a63ef6b8eb
@ -387,6 +387,7 @@ void ZooKeeper::connect(
|
||||
}
|
||||
|
||||
socket.connect(node.address, connection_timeout);
|
||||
socket_address = socket.peerAddress();
|
||||
|
||||
socket.setReceiveTimeout(operation_timeout);
|
||||
socket.setSendTimeout(operation_timeout);
|
||||
@ -1255,7 +1256,7 @@ void ZooKeeper::logOperationIfNeeded(const ZooKeeperRequestPtr & request, const
|
||||
{
|
||||
elem.type = log_type;
|
||||
elem.event_time = event_time;
|
||||
elem.address = socket.peerAddress();
|
||||
elem.address = socket_address;
|
||||
elem.session_id = session_id;
|
||||
maybe_zk_log->add(elem);
|
||||
}
|
||||
|
@ -199,6 +199,8 @@ private:
|
||||
Poco::Timespan operation_timeout;
|
||||
|
||||
Poco::Net::StreamSocket socket;
|
||||
/// To avoid excessive getpeername(2) calls.
|
||||
Poco::Net::SocketAddress socket_address;
|
||||
std::optional<ReadBufferFromPocoSocket> in;
|
||||
std::optional<WriteBufferFromPocoSocket> out;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user