-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Refactoring of using ExternalLoader in dictionary DDL. #8055
Refactoring of using ExternalLoader in dictionary DDL. #8055
Conversation
de72381
to
44ccfbf
Compare
44ccfbf
to
2e7a246
Compare
Instead of using ExternalLoader::reload() now it's used reloadConfig() which reloads only what necessary. Functions attachDictionary() and detachDictionary() are simplified and have lesser number of parameters. Instead of injecting into LoadablesConfigReader's internals for creating dictionary a temp repository is used.
2e7a246
to
4c15700
Compare
"Dictionary " + full_name + " already exists.", | ||
ErrorCodes::DICTIONARY_ALREADY_EXISTS); | ||
if (!dictionaries.emplace(dictionary_name).second) | ||
throw Exception("Dictionary " + full_name + " already exists.", ErrorCodes::DICTIONARY_ALREADY_EXISTS); |
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 we removed this check?
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.
createDictionary()
adds a temp metadata file with a dictionary to ExternalLoader
, then loads the dictionary (if lazy_load == false
), then calls attachDictionary()
. At the moment when attachDictionary()
is called the dictionary could be already loaded. I don't think this check was very useful before anyway.
@@ -427,7 +427,8 @@ DictionaryConfigurationPtr getDictionaryConfigurationFromAST(const ASTCreateQuer | |||
|
|||
AutoPtr<Poco::XML::Element> name_element(xml_document->createElement("name")); | |||
current_dictionary->appendChild(name_element); | |||
AutoPtr<Text> name(xml_document->createTextNode(query.database + "." + query.table)); | |||
String full_name = (!database_name.empty() ? database_name : query.database) + "." + query.table; |
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.
Seems like it's already substituted in InterpreterCreateQuery https://github.com/clickhouse/ClickHouse/blob/master/dbms/src/Interpreters/InterpreterCreateQuery.cpp#L714.
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.
It's substituted, but the result of that substitution (i.e. database's name) isn't passed to createDictionary()
. Seems it's better to set create.database
there than the current solution, I'll simplify the code in a separate PR.
|
||
namespace DB | ||
{ | ||
/// A config repository filled with preset loadables used by ExternalLoader. |
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.
This comment doesn't help.
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.
I think I'll rename this class to something like ExternalLoaderTempConfigRepository
and write a more detailed comment in a separate PR.
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category:
Instead of using ExternalLoader::reload() now it's used reloadConfig() which reloads only what necessary. Functions attachDictionary() and detachDictionary() are simplified and have lesser number of parameters. Instead of injecting into LoadablesConfigReader's internals for creating dictionary a temp repository is used.