MongoDB table engine now establishes connection only when it reads data.#20110
Merged
KochetovNicolai merged 2 commits intoClickHouse:masterfrom Feb 12, 2021
Merged
Conversation
Comment on lines
+55
to
+57
| std::lock_guard lock{connection_mutex}; | ||
| if (!connection) | ||
| connection = std::make_shared<Poco::MongoDB::Connection>(host, port); |
Member
There was a problem hiding this comment.
I think it is better to release mutex right after connection is initialized.
Member
Author
There was a problem hiding this comment.
It seems there is no point in allowing multiple threads to do the same authentication in parallel.
Comment on lines
+55
to
+57
| std::lock_guard lock{connection_mutex}; | ||
| if (!connection) | ||
| connection = std::make_shared<Poco::MongoDB::Connection>(host, port); |
Member
There was a problem hiding this comment.
Suggested change
| std::lock_guard lock{connection_mutex}; | |
| if (!connection) | |
| connection = std::make_shared<Poco::MongoDB::Connection>(host, port); | |
| { | |
| std::lock_guard lock{connection_mutex}; | |
| if (!connection) | |
| connection = std::make_shared<Poco::MongoDB::Connection>(host, port); | |
| } |
KochetovNicolai
approved these changes
Feb 8, 2021
vitlibar
commented
Feb 9, 2021
|
|
||
| std::shared_ptr<Poco::MongoDB::Connection> connection; | ||
| bool authentified = false; | ||
| std::mutex connection_mutex; /// Protects the variables `connection` and `authentified`. |
This was referenced Feb 12, 2021
robot-clickhouse
pushed a commit
that referenced
this pull request
Feb 12, 2021
…ion only when it reads data.
robot-clickhouse
pushed a commit
that referenced
this pull request
Feb 12, 2021
…ion only when it reads data.
robot-clickhouse
pushed a commit
that referenced
this pull request
Feb 12, 2021
…tion only when it reads data.
This was referenced Feb 12, 2021
alexey-milovidov
added a commit
that referenced
this pull request
Feb 12, 2021
Backport #20110 to 20.12: MongoDB table engine now establishes connection only when it reads data.
alexey-milovidov
added a commit
that referenced
this pull request
Feb 12, 2021
Backport #20110 to 21.1: MongoDB table engine now establishes connection only when it reads data.
alexey-milovidov
added a commit
that referenced
this pull request
Feb 12, 2021
Backport #20110 to 21.2: MongoDB table engine now establishes connection only when it reads data.
robot-clickhouse
pushed a commit
that referenced
this pull request
Feb 15, 2021
…ion only when it reads data.
vitlibar
pushed a commit
that referenced
this pull request
Feb 16, 2021
Backport #20110 to 20.8: MongoDB table engine now establishes connection only when it reads data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category:
Changelog entry:
The
MongoDBtable engine now establishes connection only when it's going to read data.ATTACH TABLEwon't try to connect anymore.This PR fixes #20055