Merge pull request #11307 from ClickHouse/remove-system-tables-lazy-load

Remove "system_tables_lazy_load" option
This commit is contained in:
alexey-milovidov 2020-06-01 16:26:23 +03:00 committed by GitHub
commit 19c6e0e5ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 52 deletions

View File

@ -191,7 +191,7 @@
<!-- Path to folder where users and roles created by SQL commands are stored. -->
<access_control_path>/var/lib/clickhouse/access/</access_control_path>
<!-- Path to configuration file with users, access rights, profiles of settings, quotas. -->
<users_config>users.xml</users_config>
@ -405,9 +405,6 @@
</prometheus>
-->
<!-- Lazy system.*_log table creation -->
<!-- <system_tables_lazy_load>false</system_tables_lazy_load> -->
<!-- Query log. Used only for queries with setting log_queries = 1. -->
<query_log>
<!-- What table to insert data. If table is not exist, it will be created.

View File

@ -89,16 +89,10 @@ SystemLogs::SystemLogs(Context & global_context, const Poco::Util::AbstractConfi
if (metric_log)
logs.emplace_back(metric_log.get());
bool lazy_load = config.getBool("system_tables_lazy_load", false);
try
{
for (auto & log : logs)
{
if (!lazy_load)
log->prepareTable();
log->startup();
}
}
catch (...)
{

View File

@ -24,18 +24,16 @@ def test_config_without_part_log(start_cluster):
node1.query("SYSTEM FLUSH LOGS")
assert "Table system.part_log doesn't exist" in node1.query_and_get_error("SELECT * FROM system.part_log")
# Note: if part_log is defined, we cannot say when the table will be created - because of metric_log, trace_log, text_log, query_log...
def test_config_with_standard_part_log(start_cluster):
assert node2.query("SELECT * FROM system.part_log") == ''
node2.query("CREATE TABLE test_table(word String, value UInt64) ENGINE=MergeTree() Order by value")
assert node2.query("SELECT * FROM system.part_log") == ''
node2.query("INSERT INTO test_table VALUES ('name', 1)")
node2.query("SYSTEM FLUSH LOGS")
assert int(node2.query("SELECT count() FROM system.part_log")) == 1
assert node2.query("SELECT * FROM system.part_log") != ""
def test_config_with_non_standard_part_log(start_cluster):
assert node3.query("SELECT * FROM system.own_part_log") == ''
node3.query("CREATE TABLE test_table(word String, value UInt64) ENGINE=MergeTree() Order by value")
assert node3.query("SELECT * FROM system.own_part_log") == ''
node3.query("INSERT INTO test_table VALUES ('name', 1)")
node3.query("SYSTEM FLUSH LOGS")
assert int(node3.query("SELECT count() FROM system.own_part_log")) == 1
assert node3.query("SELECT * FROM system.own_part_log") != ""

View File

@ -1,4 +0,0 @@
<?xml version="1.0"?>
<yandex>
<system_tables_lazy_load>true</system_tables_lazy_load>
</yandex>

View File

@ -1,32 +0,0 @@
import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node_default = cluster.add_instance('node_default')
# main_configs is mandatory ,since system_tables_lazy_load will be read earlier then parsing of config_lazy.xml
node_lazy = cluster.add_instance('node_lazy', config_dir='configs', main_configs=['configs/config_lazy.xml'])
system_logs = [
# disabled by default
# ('system.part_log'),
# ('system.text_log'),
# enabled by default
('system.query_log'),
('system.query_thread_log'),
('system.trace_log'),
('system.metric_log'),
]
@pytest.fixture(scope='module')
def start_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
@pytest.mark.parametrize('table', system_logs)
def test_system_table(start_cluster, table):
node_default.query('SELECT * FROM {}'.format(table))
assert "Table {} doesn't exist".format(table) in node_lazy.query_and_get_error('SELECT * FROM {}'.format(table))