Conversation
| throw Exception(ErrorCodes::INVALID_CONFIG_PARAMETER, "Protocol configuration error, unknown protocol name '{}'", type); | ||
| }; | ||
|
|
||
| for (const auto & protocol : protocols) |
There was a problem hiding this comment.
I see that it is a WIP, but I was just passing by, and want to note about applying changes w/o server restart (Server::updateServers())
…lickHouse into composable-protocol
| bool listen_try = config.getBool("listen_try", false); | ||
| if (!listen_try) | ||
| listen_try = DB::getMultipleValuesFromConfig(config, "", "listen_host").empty(); | ||
| { |
There was a problem hiding this comment.
Please could you add comment what we are doing here and why?
There was a problem hiding this comment.
Still have no idea - this will only affect starting interserver - lines starting at 2153 - the logic is that if config listen_try is false, make it true if no listen_host is configured (which means this node doesn't serve anything but interserver communication). And this change will preserve this logic with composable protocols.
| throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "SSL support is disabled"); | ||
| #endif | ||
| return std::make_shared<FunctionShowCertificate>(); | ||
| return std::make_shared<FunctionShowCertificate>(ctx->getQueryContext()->getClientInfo().certificate); |
There was a problem hiding this comment.
It's not clear if the pointers access is safe (is it guaranteed that they are not null?)
There was a problem hiding this comment.
I believe it is guaranteed
| <clickhouse> | ||
| <profiles> | ||
| <default> | ||
| <max_memory_usage>10000000000</max_memory_usage> |
There was a problem hiding this comment.
Why do we need these settings?
There was a problem hiding this comment.
it's just a copy-paste from some other test - does nothing
There was a problem hiding this comment.
If it's not necessary, let's remove it?
src/Server/TCPProtocolStackFactory.h
Outdated
| IServer & server [[maybe_unused]]; | ||
| Poco::Logger * log; | ||
| std::string conf_name; | ||
| std::list<TCPServerConnectionFactory::Ptr> stack; |
programs/server/Server.cpp
Outdated
| if (config.has(prefix + "port")) | ||
| { |
There was a problem hiding this comment.
I'd use the code below to reduce unnecessary nesting
if (!config.has(...))
continue;
| @@ -0,0 +1,69 @@ | |||
| import ssl | |||
There was a problem hiding this comment.
We need to add tests with incorrect configs
There was a problem hiding this comment.
it doesn't make much sense - server will just not start
There was a problem hiding this comment.
Well, my PoV - we've added some checks about config correctness for layer protocol, which would be nice to test. You to decide
programs/server/Server.cpp
Outdated
| throw Exception(ErrorCodes::INVALID_CONFIG_PARAMETER, "Protocol '{}' configuration contains a loop on '{}'", protocol, conf_name); | ||
| } | ||
|
|
||
| if (!stack || stack->size() == 0) |
There was a problem hiding this comment.
!stack - does it make sense here?
There was a problem hiding this comment.
stack->size() == 0 -> stack->empty()
programs/server/Server.cpp
Outdated
| bool is_secure = false; | ||
| auto stack = std::make_unique<TCPProtocolStackFactory>(*this, conf_name); | ||
|
|
||
| while (true) |
There was a problem hiding this comment.
It'd be nice to move this logic to a function, something like buildProtocolStackFromConfig(). It'll contain create_factory() lambda as well and will not blow up createServers() method
There was a problem hiding this comment.
there are too many connections in the code - dispatching it through function parameters will be quite cumbersome and will make code less clear
| <clickhouse> | ||
| <profiles> | ||
| <default> | ||
| <max_memory_usage>10000000000</max_memory_usage> |
There was a problem hiding this comment.
If it's not necessary, let's remove it?
| @@ -0,0 +1,69 @@ | |||
| import ssl | |||
There was a problem hiding this comment.
Well, my PoV - we've added some checks about config correctness for layer protocol, which would be nice to test. You to decide
programs/server/Server.cpp
Outdated
| http_params->setTimeout(settings.http_receive_timeout); | ||
| http_params->setKeepAliveTimeout(keep_alive_timeout); | ||
|
|
||
| Poco::Util::AbstractConfiguration::Keys protocols; |
There was a problem hiding this comment.
I still would ask you to move this code to a separate method/function. The method will not have more parameters than Server::createServers, composable protocol creation code will be localized in certain method and will not blow up existing method.
src/Server/TCPProtocolStackFactory.h
Outdated
|
|
||
| void append(TCPServerConnectionFactory::Ptr factory) | ||
| { | ||
| stack.push_back(factory); |
There was a problem hiding this comment.
| stack.push_back(factory); | |
| stack.push_back(std::move(factory)); |
|
It'd be nice if you could address this comment, but I don't insist. The concern is, - adding new functionality this way is a right way to make code less readable |
|
@devcrafter already did - probably you are looking at previous version? |
Sorry then. Thanks 👍 |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Composable protocol configuration is added.
closes #38411
protocols configuration example: