Skip to content
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

Merged

Conversation

zhang2014
Copy link
Contributor

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

@zhang2014 zhang2014 force-pushed the feature/use_cluster_pool branch from a892580 to 4798ab1 Compare December 1, 2018 17:45
Protocol::Compression::Enable,
secure);
ClusterPtr cluster = storage.getCluster();
const auto shards_info = cluster->getShardsInfo();
Copy link
Member

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();
Copy link
Member

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];
Copy link
Member

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];
Copy link
Member

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
Copy link
Member

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==?

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Member

@alexey-milovidov alexey-milovidov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@zhang2014 zhang2014 force-pushed the feature/use_cluster_pool branch 3 times, most recently from 8fdfbf8 to 3363046 Compare December 3, 2018 04:20
@zhang2014 zhang2014 force-pushed the feature/use_cluster_pool branch from 3363046 to 994d1c0 Compare December 3, 2018 05:26
@alexey-milovidov alexey-milovidov merged commit b41fa8e into ClickHouse:master Jan 21, 2019
alexey-milovidov added a commit that referenced this pull request Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants