From 22a91d190e836d9e3d0e112eb856b079eb9457e5 Mon Sep 17 00:00:00 2001 From: alexander goryanets Date: Mon, 7 Feb 2022 10:44:05 +0000 Subject: [PATCH 01/35] introduce interserver_listen_host param --- programs/server/config.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/programs/server/config.xml b/programs/server/config.xml index d34340ac995..9e741e50605 100644 --- a/programs/server/config.xml +++ b/programs/server/config.xml @@ -188,6 +188,10 @@ 127.0.0.1 --> + + + + From ee29e93fc0d08f6daf97fa411230d61d0ccbe37c Mon Sep 17 00:00:00 2001 From: alexander goryanets Date: Mon, 7 Feb 2022 10:58:09 +0000 Subject: [PATCH 02/35] use interserver_listen_host param for configure interserver listen_host --- programs/server/Server.cpp | 109 +++++++++++++++++++++---------------- programs/server/Server.h | 1 + 2 files changed, 63 insertions(+), 47 deletions(-) diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp index ad835af1159..7e5c22e0975 100644 --- a/programs/server/Server.cpp +++ b/programs/server/Server.cpp @@ -369,6 +369,15 @@ std::vector getListenHosts(const Poco::Util::AbstractConfiguration return listen_hosts; } +std::vector getInterserverListenHosts(const Poco::Util::AbstractConfiguration & config, std::vector listen_hosts) +{ + auto interserver_listen_hosts = DB::getMultipleValuesFromConfig(config, "", "interserver_listen_host"); + if (interserver_listen_hosts.empty()) + return listen_hosts; + else + return interserver_listen_hosts; +} + bool getListenTry(const Poco::Util::AbstractConfiguration & config) { bool listen_try = config.getBool("listen_try", false); @@ -978,6 +987,7 @@ if (ThreadFuzzer::instance().isEffective()) /* already_loaded = */ false); /// Reload it right now (initial loading) const auto listen_hosts = getListenHosts(config()); + const auto interserver_listen_hosts = getInterserverListenHosts(config(), listen_hosts); const auto listen_try = getListenTry(config()); if (config().has("keeper_server")) @@ -1369,7 +1379,7 @@ if (ThreadFuzzer::instance().isEffective()) { std::lock_guard lock(servers_lock); - createServers(config(), listen_hosts, listen_try, server_pool, async_metrics, servers); + createServers(config(), listen_hosts, interserver_listen_hosts, listen_try, server_pool, async_metrics, servers); if (servers.empty()) throw Exception( "No servers started (add valid listen_host and 'tcp_port' or 'http_port' to configuration file.)", @@ -1549,6 +1559,7 @@ if (ThreadFuzzer::instance().isEffective()) void Server::createServers( Poco::Util::AbstractConfiguration & config, const std::vector & listen_hosts, + const std::vector & interserver_listen_hosts, bool listen_try, Poco::ThreadPool & server_pool, AsynchronousMetrics & async_metrics, @@ -1666,51 +1677,6 @@ void Server::createServers( #endif }); - /// Interserver IO HTTP - port_name = "interserver_http_port"; - createServer(config, listen_host, port_name, listen_try, start_servers, servers, [&](UInt16 port) -> ProtocolServerAdapter - { - Poco::Net::ServerSocket socket; - auto address = socketBindListen(socket, listen_host, port); - socket.setReceiveTimeout(settings.http_receive_timeout); - socket.setSendTimeout(settings.http_send_timeout); - return ProtocolServerAdapter( - listen_host, - port_name, - "replica communication (interserver): http://" + address.toString(), - std::make_unique( - context(), - createHandlerFactory(*this, async_metrics, "InterserverIOHTTPHandler-factory"), - server_pool, - socket, - http_params)); - }); - - port_name = "interserver_https_port"; - createServer(config, listen_host, port_name, listen_try, start_servers, servers, [&](UInt16 port) -> ProtocolServerAdapter - { -#if USE_SSL - Poco::Net::SecureServerSocket socket; - auto address = socketBindListen(socket, listen_host, port, /* secure = */ true); - socket.setReceiveTimeout(settings.http_receive_timeout); - socket.setSendTimeout(settings.http_send_timeout); - return ProtocolServerAdapter( - listen_host, - port_name, - "secure replica communication (interserver): https://" + address.toString(), - std::make_unique( - context(), - createHandlerFactory(*this, async_metrics, "InterserverIOHTTPSHandler-factory"), - server_pool, - socket, - http_params)); -#else - UNUSED(port); - throw Exception{"SSL support for TCP protocol is disabled because Poco library was built without NetSSL support.", - ErrorCodes::SUPPORT_IS_DISABLED}; -#endif - }); - port_name = "mysql_port"; createServer(config, listen_host, port_name, listen_try, start_servers, servers, [&](UInt16 port) -> ProtocolServerAdapter { @@ -1769,6 +1735,54 @@ void Server::createServers( }); } + for (const auto & interserver_listen_host : interserver_listen_hosts) + { + /// Interserver IO HTTP + const char * port_name = "interserver_http_port"; + createServer(config, interserver_listen_host, port_name, listen_try, start_servers, servers, [&](UInt16 port) -> ProtocolServerAdapter + { + Poco::Net::ServerSocket socket; + auto address = socketBindListen(socket, interserver_listen_host, port); + socket.setReceiveTimeout(settings.http_receive_timeout); + socket.setSendTimeout(settings.http_send_timeout); + return ProtocolServerAdapter( + interserver_listen_host, + port_name, + "replica communication (interserver): http://" + address.toString(), + std::make_unique( + context(), + createHandlerFactory(*this, async_metrics, "InterserverIOHTTPHandler-factory"), + server_pool, + socket, + http_params)); + }); + + port_name = "interserver_https_port"; + createServer(config, interserver_listen_host, port_name, listen_try, start_servers, servers, [&](UInt16 port) -> ProtocolServerAdapter + { +#if USE_SSL + Poco::Net::SecureServerSocket socket; + auto address = socketBindListen(socket, interserver_listen_host, port, /* secure = */ true); + socket.setReceiveTimeout(settings.http_receive_timeout); + socket.setSendTimeout(settings.http_send_timeout); + return ProtocolServerAdapter( + interserver_listen_host, + port_name, + "secure replica communication (interserver): https://" + address.toString(), + std::make_unique( + context(), + createHandlerFactory(*this, async_metrics, "InterserverIOHTTPSHandler-factory"), + server_pool, + socket, + http_params)); +#else + UNUSED(port); + throw Exception{"SSL support for TCP protocol is disabled because Poco library was built without NetSSL support.", + ErrorCodes::SUPPORT_IS_DISABLED}; +#endif + }); + } + } void Server::updateServers( @@ -1780,6 +1794,7 @@ void Server::updateServers( Poco::Logger * log = &logger(); /// Gracefully shutdown servers when their port is removed from config const auto listen_hosts = getListenHosts(config); + const auto interserver_listen_hosts = getInterserverListenHosts(config, listen_hosts); const auto listen_try = getListenTry(config); for (auto & server : servers) @@ -1794,7 +1809,7 @@ void Server::updateServers( } } - createServers(config, listen_hosts, listen_try, server_pool, async_metrics, servers, /* start_servers: */ true); + createServers(config, listen_hosts, interserver_listen_hosts, listen_try, server_pool, async_metrics, servers, /* start_servers: */ true); /// Remove servers once all their connections are closed while (std::any_of(servers.begin(), servers.end(), [](const auto & server) { return server.isStopping(); })) diff --git a/programs/server/Server.h b/programs/server/Server.h index b4f2ea3bb79..09fcfba742a 100644 --- a/programs/server/Server.h +++ b/programs/server/Server.h @@ -82,6 +82,7 @@ private: void createServers( Poco::Util::AbstractConfiguration & config, const std::vector & listen_hosts, + const std::vector & interserver_listen_hosts, bool listen_try, Poco::ThreadPool & server_pool, AsynchronousMetrics & async_metrics, From f43fbfadb0fe06e12fcfb95c7b7609c44f8cb0c5 Mon Sep 17 00:00:00 2001 From: alexander goryanets Date: Mon, 7 Feb 2022 11:10:42 +0000 Subject: [PATCH 03/35] add docs for interserver_listen_host setting --- .../server-configuration-parameters/settings.md | 12 ++++++++++++ .../server-configuration-parameters/settings.md | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/docs/en/operations/server-configuration-parameters/settings.md b/docs/en/operations/server-configuration-parameters/settings.md index 266abadb087..5652a294e78 100644 --- a/docs/en/operations/server-configuration-parameters/settings.md +++ b/docs/en/operations/server-configuration-parameters/settings.md @@ -389,6 +389,18 @@ For more information, see the section “[Configuration files](../../operations/ /etc/metrica.xml ``` +## interserver_listen_host {#interserver-listen-host} + +Restriction on hosts that can exchange data between ClickHouse servers. +The default value equals to `listen_host` setting. + +Examples: + +``` xml +::ffff:a00:1 +10.0.0.1 +``` + ## interserver_http_port {#interserver-http-port} Port for exchanging data between ClickHouse servers. diff --git a/docs/ru/operations/server-configuration-parameters/settings.md b/docs/ru/operations/server-configuration-parameters/settings.md index 5d667ef8238..136a28d7e06 100644 --- a/docs/ru/operations/server-configuration-parameters/settings.md +++ b/docs/ru/operations/server-configuration-parameters/settings.md @@ -390,6 +390,18 @@ ClickHouse проверяет условия для `min_part_size` и `min_part /etc/metrica.xml ``` +## interserver_listen_host {#interserver-listen-host} + +Ограничение по хостам, для обмена между серверами ClickHouse. +Значение по умолчанию совпадает со значением параметра listen_host + +Примеры: + +``` xml +::ffff:a00:1 +10.0.0.1 +``` + ## interserver_http_port {#interserver-http-port} Порт для обмена между серверами ClickHouse. From d9cfba9047bb93dda235ebe73f1f9df94d9943c7 Mon Sep 17 00:00:00 2001 From: alexander goryanets Date: Wed, 9 Feb 2022 15:28:36 +0000 Subject: [PATCH 04/35] add integration test for interserver_listen_host --- .../__init__.py | 0 .../config.d/interserver-listen-host.xml | 3 ++ .../config.d/no-interserver-listen-host.xml | 3 ++ .../test_case.py | 52 +++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 tests/integration/test_tcp_handler_interserver_listen_host/__init__.py create mode 100644 tests/integration/test_tcp_handler_interserver_listen_host/configs/config.d/interserver-listen-host.xml create mode 100644 tests/integration/test_tcp_handler_interserver_listen_host/configs/config.d/no-interserver-listen-host.xml create mode 100644 tests/integration/test_tcp_handler_interserver_listen_host/test_case.py diff --git a/tests/integration/test_tcp_handler_interserver_listen_host/__init__.py b/tests/integration/test_tcp_handler_interserver_listen_host/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/integration/test_tcp_handler_interserver_listen_host/configs/config.d/interserver-listen-host.xml b/tests/integration/test_tcp_handler_interserver_listen_host/configs/config.d/interserver-listen-host.xml new file mode 100644 index 00000000000..52d45e7c956 --- /dev/null +++ b/tests/integration/test_tcp_handler_interserver_listen_host/configs/config.d/interserver-listen-host.xml @@ -0,0 +1,3 @@ + + 10.0.0.10 + diff --git a/tests/integration/test_tcp_handler_interserver_listen_host/configs/config.d/no-interserver-listen-host.xml b/tests/integration/test_tcp_handler_interserver_listen_host/configs/config.d/no-interserver-listen-host.xml new file mode 100644 index 00000000000..2e7e1a83aa1 --- /dev/null +++ b/tests/integration/test_tcp_handler_interserver_listen_host/configs/config.d/no-interserver-listen-host.xml @@ -0,0 +1,3 @@ + + + diff --git a/tests/integration/test_tcp_handler_interserver_listen_host/test_case.py b/tests/integration/test_tcp_handler_interserver_listen_host/test_case.py new file mode 100644 index 00000000000..7d47a353631 --- /dev/null +++ b/tests/integration/test_tcp_handler_interserver_listen_host/test_case.py @@ -0,0 +1,52 @@ +"""Test Interserver responses on configured IP.""" +from pathlib import Path +import pytest +from helpers.cluster import ClickHouseCluster +import requests +import socket +import time + +cluster = ClickHouseCluster(__file__) + +INTERSERVER_LISTEN_HOST = '10.0.0.10' +INTERSERVER_HTTP_PORT = 9009 + +node_with_interserver_listen_host = cluster.add_instance( + 'node_with_interserver_listen_host', + main_configs=["configs/config.d/interserver-listen-host.xml"], + ipv4_address=INTERSERVER_LISTEN_HOST, # used to configure acc. interface in test container + ipv6_address='2001:3984:3989::1:1000', +) + +node_without_interserver_listen_host = cluster.add_instance( + 'node_without_interserver_listen_host', + main_configs=["configs/config.d/no-interserver-listen-host.xml"], + ipv6_address='2001:3984:3989::2:1000' +) + +@pytest.fixture(scope="module") +def start_cluster(): + try: + cluster.start() + yield cluster + + finally: + cluster.shutdown() + +def test_request_to_node_with_interserver_listen_host(start_cluster): + time.sleep(5) # waiting for interserver listener to start + response_interserver = requests.get( + f'http://{INTERSERVER_LISTEN_HOST}:{INTERSERVER_HTTP_PORT}' + ) + response_client = requests.get( + f'http://{node_without_interserver_listen_host.ip_address}:8123' + ) + assert response_interserver.status_code == 200 + assert "Ok." in response_interserver.text + assert response_client.status_code == 200 + +def test_request_to_node_without_interserver_listen_host(start_cluster): + response = requests.get( + f'http://{node_without_interserver_listen_host.ip_address}:{INTERSERVER_HTTP_PORT}' + ) + assert response.status_code == 200 From d7071e8596f1beefb3f36cf966fa4a8ca2a643ef Mon Sep 17 00:00:00 2001 From: Nikita Mikhaylov Date: Tue, 5 Apr 2022 17:04:53 +0200 Subject: [PATCH 05/35] Style --- programs/server/Server.cpp | 20 ++++++++-------- programs/server/Server.h | 4 ++-- .../test_case.py | 23 +++++++++++-------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp index 7e5c22e0975..7b81220a4c1 100644 --- a/programs/server/Server.cpp +++ b/programs/server/Server.cpp @@ -358,7 +358,7 @@ Poco::Net::SocketAddress Server::socketBindListen(Poco::Net::ServerSocket & sock return address; } -std::vector getListenHosts(const Poco::Util::AbstractConfiguration & config) +Strings getListenHosts(const Poco::Util::AbstractConfiguration & config) { auto listen_hosts = DB::getMultipleValuesFromConfig(config, "", "listen_host"); if (listen_hosts.empty()) @@ -369,13 +369,14 @@ std::vector getListenHosts(const Poco::Util::AbstractConfiguration return listen_hosts; } -std::vector getInterserverListenHosts(const Poco::Util::AbstractConfiguration & config, std::vector listen_hosts) +Strings getInterserverListenHosts(const Poco::Util::AbstractConfiguration & config) { auto interserver_listen_hosts = DB::getMultipleValuesFromConfig(config, "", "interserver_listen_host"); - if (interserver_listen_hosts.empty()) - return listen_hosts; - else + if (!interserver_listen_hosts.empty()) return interserver_listen_hosts; + + /// Use more general restriction in case of emptiness + return getListenHosts(config); } bool getListenTry(const Poco::Util::AbstractConfiguration & config) @@ -987,7 +988,7 @@ if (ThreadFuzzer::instance().isEffective()) /* already_loaded = */ false); /// Reload it right now (initial loading) const auto listen_hosts = getListenHosts(config()); - const auto interserver_listen_hosts = getInterserverListenHosts(config(), listen_hosts); + const auto interserver_listen_hosts = getInterserverListenHosts(config()); const auto listen_try = getListenTry(config()); if (config().has("keeper_server")) @@ -1558,8 +1559,8 @@ if (ThreadFuzzer::instance().isEffective()) void Server::createServers( Poco::Util::AbstractConfiguration & config, - const std::vector & listen_hosts, - const std::vector & interserver_listen_hosts, + const Strings & listen_hosts, + const Strings & interserver_listen_hosts, bool listen_try, Poco::ThreadPool & server_pool, AsynchronousMetrics & async_metrics, @@ -1735,6 +1736,7 @@ void Server::createServers( }); } + /// Now iterate over interserver_listen_hosts for (const auto & interserver_listen_host : interserver_listen_hosts) { /// Interserver IO HTTP @@ -1794,7 +1796,7 @@ void Server::updateServers( Poco::Logger * log = &logger(); /// Gracefully shutdown servers when their port is removed from config const auto listen_hosts = getListenHosts(config); - const auto interserver_listen_hosts = getInterserverListenHosts(config, listen_hosts); + const auto interserver_listen_hosts = getInterserverListenHosts(config); const auto listen_try = getListenTry(config); for (auto & server : servers) diff --git a/programs/server/Server.h b/programs/server/Server.h index 09fcfba742a..b973f22890f 100644 --- a/programs/server/Server.h +++ b/programs/server/Server.h @@ -81,8 +81,8 @@ private: void createServers( Poco::Util::AbstractConfiguration & config, - const std::vector & listen_hosts, - const std::vector & interserver_listen_hosts, + const Strings & listen_hosts, + const Strings & interserver_listen_hosts, bool listen_try, Poco::ThreadPool & server_pool, AsynchronousMetrics & async_metrics, diff --git a/tests/integration/test_tcp_handler_interserver_listen_host/test_case.py b/tests/integration/test_tcp_handler_interserver_listen_host/test_case.py index 7d47a353631..44df1c369cf 100644 --- a/tests/integration/test_tcp_handler_interserver_listen_host/test_case.py +++ b/tests/integration/test_tcp_handler_interserver_listen_host/test_case.py @@ -8,22 +8,23 @@ import time cluster = ClickHouseCluster(__file__) -INTERSERVER_LISTEN_HOST = '10.0.0.10' +INTERSERVER_LISTEN_HOST = "10.0.0.10" INTERSERVER_HTTP_PORT = 9009 node_with_interserver_listen_host = cluster.add_instance( - 'node_with_interserver_listen_host', + "node_with_interserver_listen_host", main_configs=["configs/config.d/interserver-listen-host.xml"], - ipv4_address=INTERSERVER_LISTEN_HOST, # used to configure acc. interface in test container - ipv6_address='2001:3984:3989::1:1000', + ipv4_address=INTERSERVER_LISTEN_HOST, # used to configure acc. interface in test container + ipv6_address="2001:3984:3989::1:1000", ) node_without_interserver_listen_host = cluster.add_instance( - 'node_without_interserver_listen_host', + "node_without_interserver_listen_host", main_configs=["configs/config.d/no-interserver-listen-host.xml"], - ipv6_address='2001:3984:3989::2:1000' + ipv6_address="2001:3984:3989::2:1000", ) + @pytest.fixture(scope="module") def start_cluster(): try: @@ -33,20 +34,22 @@ def start_cluster(): finally: cluster.shutdown() + def test_request_to_node_with_interserver_listen_host(start_cluster): - time.sleep(5) # waiting for interserver listener to start + time.sleep(5) # waiting for interserver listener to start response_interserver = requests.get( - f'http://{INTERSERVER_LISTEN_HOST}:{INTERSERVER_HTTP_PORT}' + f"http://{INTERSERVER_LISTEN_HOST}:{INTERSERVER_HTTP_PORT}" ) response_client = requests.get( - f'http://{node_without_interserver_listen_host.ip_address}:8123' + f"http://{node_without_interserver_listen_host.ip_address}:8123" ) assert response_interserver.status_code == 200 assert "Ok." in response_interserver.text assert response_client.status_code == 200 + def test_request_to_node_without_interserver_listen_host(start_cluster): response = requests.get( - f'http://{node_without_interserver_listen_host.ip_address}:{INTERSERVER_HTTP_PORT}' + f"http://{node_without_interserver_listen_host.ip_address}:{INTERSERVER_HTTP_PORT}" ) assert response.status_code == 200 From 22219c4b7acea3ca54b873481c7ecf41571c635a Mon Sep 17 00:00:00 2001 From: Robert Schulze Date: Sun, 24 Jul 2022 19:03:43 +0000 Subject: [PATCH 06/35] Merge Woboq code browser page into "Getting Started" document There was too little information on the page to deserve a separate document. --- docs/en/development/browse-code.md | 13 ------------- docs/en/development/developer-instruction.md | 6 ++++++ docs/ru/development/browse-code.md | 13 ------------- docs/ru/development/developer-instruction.md | 8 ++++++++ docs/zh/development/browse-code.md | 12 ------------ docs/zh/development/developer-instruction.md | 8 ++++++++ 6 files changed, 22 insertions(+), 38 deletions(-) delete mode 100644 docs/en/development/browse-code.md delete mode 100644 docs/ru/development/browse-code.md delete mode 100644 docs/zh/development/browse-code.md diff --git a/docs/en/development/browse-code.md b/docs/en/development/browse-code.md deleted file mode 100644 index da924c359ff..00000000000 --- a/docs/en/development/browse-code.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_label: Source Code Browser -sidebar_position: 72 -description: Various ways to browse and edit the source code ---- - -# Browse ClickHouse Source Code - -You can use the **Woboq** online code browser available [here](https://clickhouse.com/codebrowser/ClickHouse/src/index.html). It provides code navigation and semantic highlighting, search and indexing. The code snapshot is updated daily. - -Also, you can browse sources on [GitHub](https://github.com/ClickHouse/ClickHouse) as usual. - -If you’re interested what IDE to use, we recommend CLion, QT Creator, VS Code and KDevelop (with caveats). You can use any favorite IDE. Vim and Emacs also count. diff --git a/docs/en/development/developer-instruction.md b/docs/en/development/developer-instruction.md index ea2ed95fd27..b496f7f0d63 100644 --- a/docs/en/development/developer-instruction.md +++ b/docs/en/development/developer-instruction.md @@ -267,6 +267,12 @@ The system will prepare ClickHouse binary builds for your pull request individua Most probably some of the builds will fail at first times. This is due to the fact that we check builds both with gcc as well as with clang, with almost all of existing warnings (always with the `-Werror` flag) enabled for clang. On that same page, you can find all of the build logs so that you do not have to build ClickHouse in all of the possible ways. +## Browse ClickHouse Source Code + +You can use the **Woboq** online code browser available [here](https://clickhouse.com/codebrowser/ClickHouse/src/index.html). It provides code navigation, semantic highlighting, search and indexing. The code snapshot is updated daily. + +Also, you can browse sources on [GitHub](https://github.com/ClickHouse/ClickHouse) as usual. + ## Faster builds for development: Split build configuration {#split-build} ClickHouse is normally statically linked into a single static `clickhouse` binary with minimal dependencies. This is convenient for distribution, but it means that for every change the entire binary needs to be re-linked, which is slow and inconvenient for development. As an alternative, you can instead build dynamically linked shared libraries and separate binaries `clickhouse-server`, `clickhouse-client` etc., allowing for faster incremental builds. To use it, add the following flags to your `cmake` invocation: diff --git a/docs/ru/development/browse-code.md b/docs/ru/development/browse-code.md deleted file mode 100644 index 7290eed5c6f..00000000000 --- a/docs/ru/development/browse-code.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -sidebar_position: 72 -sidebar_label: "Навигация по коду ClickHouse" ---- - - -# Навигация по коду ClickHouse {#navigatsiia-po-kodu-clickhouse} - -Для навигации по коду онлайн доступен **Woboq**, он расположен [здесь](https://clickhouse.com/codebrowser/ClickHouse/src/index.html). В нём реализовано удобное перемещение между исходными файлами, семантическая подсветка, подсказки, индексация и поиск. Слепок кода обновляется ежедневно. - -Также вы можете просматривать исходники на [GitHub](https://github.com/ClickHouse/ClickHouse). - -Если вы интересуетесь, какую среду разработки выбрать для работы с ClickHouse, мы рекомендуем CLion, QT Creator, VSCode или KDevelop (с некоторыми предостережениями). Вы можете использовать свою любимую среду разработки, Vim и Emacs тоже считаются. diff --git a/docs/ru/development/developer-instruction.md b/docs/ru/development/developer-instruction.md index 4c1981198a0..f5ab32f4bed 100644 --- a/docs/ru/development/developer-instruction.md +++ b/docs/ru/development/developer-instruction.md @@ -285,3 +285,11 @@ Pull request можно создать, даже если работа над з Система подготовит сборки ClickHouse специально для вашего pull request. Для их получения, нажмите на ссылку «Details» у проверки «Clickhouse build check». Там вы сможете найти прямые ссылки на собранные .deb пакеты ClickHouse, которые, при желании, вы даже сможете установить на свои продакшен серверы (если не страшно). Вероятнее всего, часть сборок не будет успешной с первого раза. Ведь мы проверяем сборку кода и gcc и clang, а при сборке с помощью clang включаются почти все существующие в природе warnings (всегда с флагом `-Werror`). На той же странице, вы сможете найти логи сборки - вам не обязательно самому собирать ClickHouse всеми возможными способами. + +## Навигация по коду ClickHouse {#navigatsiia-po-kodu-clickhouse} + +Для навигации по коду онлайн доступен **Woboq**, он расположен [здесь](https://clickhouse.com/codebrowser/ClickHouse/src/index.html). В нём реализовано удобное перемещение между исходными файлами, семантическая подсветка, подсказки, индексация и поиск. Слепок кода обновляется ежедневно. + +Также вы можете просматривать исходники на [GitHub](https://github.com/ClickHouse/ClickHouse). + +Если вы интересуетесь, какую среду разработки выбрать для работы с ClickHouse, мы рекомендуем CLion, QT Creator, VSCode или KDevelop (с некоторыми предостережениями). Вы можете использовать свою любимую среду разработки, Vim и Emacs тоже считаются. diff --git a/docs/zh/development/browse-code.md b/docs/zh/development/browse-code.md deleted file mode 100644 index 7610589e171..00000000000 --- a/docs/zh/development/browse-code.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -sidebar_position: 63 -sidebar_label: "\u6D4F\u89C8\u6E90\u4EE3\u7801" ---- - -# 浏览ClickHouse源代码 {#browse-clickhouse-source-code} - -您可以使用 **Woboq** 在线代码浏览器 [点击这里](https://clickhouse.com/codebrowser/ClickHouse/src/index.html). 它提供了代码导航和语义突出显示、搜索和索引。 代码快照每天更新。 - -此外,您还可以像往常一样浏览源代码 [GitHub](https://github.com/ClickHouse/ClickHouse) - -如果你希望了解哪种IDE较好,我们推荐使用CLion,QT Creator,VS Code和KDevelop(有注意事项)。 您可以使用任何您喜欢的IDE。 Vim和Emacs也可以。 diff --git a/docs/zh/development/developer-instruction.md b/docs/zh/development/developer-instruction.md index 7ade3ad57fb..5ba6e31099e 100644 --- a/docs/zh/development/developer-instruction.md +++ b/docs/zh/development/developer-instruction.md @@ -264,3 +264,11 @@ ClickHouse成员一旦在您的拉取请求上贴上«可以测试»标签,就 系统将分别为您的拉取请求准备ClickHouse二进制版本。若要检索这些构建信息,请在检查列表中单击« ClickHouse构建检查»旁边的«详细信息»链接。在这里,您会找到指向ClickHouse的.deb软件包的直接链接,此外,甚至可以将其部署在生产服务器上(如果您不担心)。 某些构建项很可能会在首次构建时失败。这是因为我们同时检查了基于gcc和clang的构建,几乎所有现有的被clang启用的警告(总是带有`-Werror`标志)。在同一页面上,您可以找到所有构建的日志,因此不必以所有可能的方式构建ClickHouse。 + +## 浏览ClickHouse源代码 {#browse-clickhouse-source-code} + +您可以使用 **Woboq** 在线代码浏览器 [点击这里](https://clickhouse.com/codebrowser/ClickHouse/src/index.html). 它提供了代码导航和语义突出显示、搜索和索引。 代码快照每天更新。 + +此外,您还可以像往常一样浏览源代码 [GitHub](https://github.com/ClickHouse/ClickHouse) + +如果你希望了解哪种IDE较好,我们推荐使用CLion,QT Creator,VS Code和KDevelop(有注意事项)。 您可以使用任何您喜欢的IDE。 Vim和Emacs也可以。 From 6126bd60ed7f38fe757a091c46c9e21c0ab5e873 Mon Sep 17 00:00:00 2001 From: "Mikhail f. Shiryaev" Date: Fri, 29 Jul 2022 19:27:38 +0200 Subject: [PATCH 07/35] Fix cherry-pick for cases, when assignee is not set for PR --- tests/ci/cherry_pick.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/ci/cherry_pick.py b/tests/ci/cherry_pick.py index 334a24ed7af..5382106d26b 100644 --- a/tests/ci/cherry_pick.py +++ b/tests/ci/cherry_pick.py @@ -206,7 +206,8 @@ Merge it only if you intend to backport changes to the target branch, otherwise ) self.cherrypick_pr.add_to_labels(Labels.LABEL_CHERRYPICK) self.cherrypick_pr.add_to_labels(Labels.LABEL_DO_NOT_TEST) - self.cherrypick_pr.add_to_assignees(self.pr.assignee) + if self.pr.assignee is not None: + self.cherrypick_pr.add_to_assignees(self.pr.assignee) self.cherrypick_pr.add_to_assignees(self.pr.user) def create_backport(self): @@ -238,7 +239,8 @@ Merge it only if you intend to backport changes to the target branch, otherwise head=self.backport_branch, ) self.backport_pr.add_to_labels(Labels.LABEL_BACKPORT) - self.backport_pr.add_to_assignees(self.pr.assignee) + if self.pr.assignee is not None: + self.cherrypick_pr.add_to_assignees(self.pr.assignee) self.backport_pr.add_to_assignees(self.pr.user) @property From 942f056ce57068d0397da55cb894ce095a92565e Mon Sep 17 00:00:00 2001 From: Anton Popov Date: Fri, 29 Jul 2022 19:10:23 +0000 Subject: [PATCH 08/35] fix redirecting of logs to stdout in client --- src/Client/ClientBase.cpp | 9 +++++++-- .../0_stateless/02360_send_logs_level_colors.reference | 1 + .../queries/0_stateless/02360_send_logs_level_colors.sh | 4 +--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Client/ClientBase.cpp b/src/Client/ClientBase.cpp index faef19fe1a3..977d2bca01f 100644 --- a/src/Client/ClientBase.cpp +++ b/src/Client/ClientBase.cpp @@ -583,9 +583,14 @@ try if (has_vertical_output_suffix) current_format = "Vertical"; - /// It is not clear how to write progress intermixed with data with parallel formatting. + bool logs_into_stdout = server_logs_file == "-"; + bool extras_into_stdout = need_render_progress || logs_into_stdout; + bool select_only_into_file = select_into_file && !select_into_file_and_stdout; + + /// It is not clear how to write progress and logs + /// intermixed with data with parallel formatting. /// It may increase code complexity significantly. - if (!need_render_progress || (select_into_file && !select_into_file_and_stdout)) + if (!extras_into_stdout || select_only_into_file) output_format = global_context->getOutputFormatParallelIfPossible( current_format, out_file_buf ? *out_file_buf : *out_buf, block); else diff --git a/tests/queries/0_stateless/02360_send_logs_level_colors.reference b/tests/queries/0_stateless/02360_send_logs_level_colors.reference index 1c30d50f5c0..fe2824243c4 100644 --- a/tests/queries/0_stateless/02360_send_logs_level_colors.reference +++ b/tests/queries/0_stateless/02360_send_logs_level_colors.reference @@ -1,2 +1,3 @@ ASCII text ASCII text +ASCII text diff --git a/tests/queries/0_stateless/02360_send_logs_level_colors.sh b/tests/queries/0_stateless/02360_send_logs_level_colors.sh index eaa294cebe4..4e5ce057702 100755 --- a/tests/queries/0_stateless/02360_send_logs_level_colors.sh +++ b/tests/queries/0_stateless/02360_send_logs_level_colors.sh @@ -26,8 +26,6 @@ EOF run "$CLICKHOUSE_CLIENT -q 'SELECT 1' 2>$file_name" run "$CLICKHOUSE_CLIENT -q 'SELECT 1' --server_logs_file=$file_name" - -# This query may fail due to bug in clickhouse-client. -# run "$CLICKHOUSE_CLIENT -q 'SELECT 1' --server_logs_file=- >$file_name" +run "$CLICKHOUSE_CLIENT -q 'SELECT 1' --server_logs_file=- >$file_name" rm -f "$file_name" From b9d7cd6a5d7c5b22be2cf2e5e6055313dfd25f14 Mon Sep 17 00:00:00 2001 From: Constantine Peresypkin Date: Thu, 28 Jul 2022 19:54:46 +0200 Subject: [PATCH 09/35] add settings for executable table func SELECT * FROM executable('