-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use cluster connections pool in DirectoryMonitor #3726
Use cluster connections pool in DirectoryMonitor #3726
Conversation
a892580
to
4798ab1
Compare
Protocol::Compression::Enable, | ||
secure); | ||
ClusterPtr cluster = storage.getCluster(); | ||
const auto shards_info = cluster->getShardsInfo(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive copy.
secure); | ||
ClusterPtr cluster = storage.getCluster(); | ||
const auto shards_info = cluster->getShardsInfo(); | ||
const auto shards_addresses = cluster->getShardsAddresses(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive copy.
/// existing connections pool have a higher priority | ||
for (size_t shard_index = 0; shard_index < shards_info.size(); ++shard_index) | ||
{ | ||
Cluster::Addresses replicas_addresses = shards_addresses[shard_index]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive copy.
|
||
for (size_t replica_index = 0; replica_index < replicas_addresses.size(); ++replica_index) | ||
{ | ||
Cluster::Address replica_address = replicas_addresses[replica_index]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive copy.
{ | ||
Cluster::Address replica_address = replicas_addresses[replica_index]; | ||
|
||
if (replica_address.host_name == host && replica_address.port == port |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't make an operator==?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because no other place has similar needs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it's reasonable to have operator==. Because otherwise it's very easy to forget to modify this place if we will add more struct members.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
8fdfbf8
to
3363046
Compare
3363046
to
994d1c0
Compare
When too many distributed tables are in a single server, a large number of connections are created.
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en