Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
061cfe9f
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
061cfe9f
编写于
4月 20, 2020
作者:
A
alexey-milovidov
提交者:
GitHub
4月 20, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10359 from ClickHouse/system-tables-lazy-load
System tables eager creation, continuation
上级
a7d360b7
237db266
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
1 deletion
+47
-1
src/Interpreters/SystemLog.cpp
src/Interpreters/SystemLog.cpp
+8
-0
src/Interpreters/SystemLog.h
src/Interpreters/SystemLog.h
+11
-1
tests/integration/test_system_tables_non_lazy_load/configs/config_non_lazy.xml
...t_system_tables_non_lazy_load/configs/config_non_lazy.xml
+4
-0
tests/integration/test_system_tables_non_lazy_load/test_system_tables_non_lazy_load.py
..._tables_non_lazy_load/test_system_tables_non_lazy_load.py
+24
-0
未找到文件。
src/Interpreters/SystemLog.cpp
浏览文件 @
061cfe9f
...
...
@@ -96,6 +96,14 @@ SystemLogs::SystemLogs(Context & global_context, const Poco::Util::AbstractConfi
logs
.
emplace_back
(
text_log
.
get
());
if
(
metric_log
)
logs
.
emplace_back
(
metric_log
.
get
());
bool
lazy_load
=
config
.
getBool
(
"system_tables_lazy_load"
,
true
);
for
(
auto
&
log
:
logs
)
{
if
(
!
lazy_load
)
log
->
prepareTable
();
log
->
startup
();
}
}
...
...
src/Interpreters/SystemLog.h
浏览文件 @
061cfe9f
...
...
@@ -73,6 +73,8 @@ public:
virtual
String
getName
()
=
0
;
virtual
ASTPtr
getCreateTableQuery
()
=
0
;
virtual
void
flush
()
=
0
;
virtual
void
prepareTable
()
=
0
;
virtual
void
startup
()
=
0
;
virtual
void
shutdown
()
=
0
;
virtual
~
ISystemLog
()
=
default
;
};
...
...
@@ -129,6 +131,9 @@ public:
/// Flush data in the buffer to disk
void
flush
()
override
;
/// Start the background thread.
void
startup
()
override
;
/// Stop the background flush thread before destructor. No more data will be written.
void
shutdown
()
override
{
...
...
@@ -177,7 +182,7 @@ private:
* Renames old table if its structure is not suitable.
* This cannot be done in constructor to avoid deadlock while renaming a table under locked Context when SystemLog object is created.
*/
void
prepareTable
();
void
prepareTable
()
override
;
/// flushImpl can be executed only in saving_thread.
void
flushImpl
(
const
std
::
vector
<
LogElement
>
&
to_flush
,
uint64_t
to_flush_end
);
...
...
@@ -197,7 +202,12 @@ SystemLog<LogElement>::SystemLog(Context & context_,
{
assert
(
database_name_
==
DatabaseCatalog
::
SYSTEM_DATABASE
);
log
=
&
Logger
::
get
(
"SystemLog ("
+
database_name_
+
"."
+
table_name_
+
")"
);
}
template
<
typename
LogElement
>
void
SystemLog
<
LogElement
>::
startup
()
{
saving_thread
=
ThreadFromGlobalPool
([
this
]
{
savingThreadFunction
();
});
}
...
...
tests/integration/test_system_tables_non_lazy_load/configs/config_non_lazy.xml
0 → 100644
浏览文件 @
061cfe9f
<?xml version="1.0"?>
<yandex>
<system_tables_lazy_load>
false
</system_tables_lazy_load>
</yandex>
tests/integration/test_system_tables_non_lazy_load/test_system_tables_non_lazy_load.py
0 → 100644
浏览文件 @
061cfe9f
import
time
import
pytest
import
os
from
helpers.cluster
import
ClickHouseCluster
cluster
=
ClickHouseCluster
(
__file__
)
node1
=
cluster
.
add_instance
(
'node1'
,
config_dir
=
"configs"
)
@
pytest
.
fixture
(
scope
=
"module"
)
def
start_cluster
():
try
:
cluster
.
start
()
yield
cluster
finally
:
cluster
.
shutdown
()
def
test_system_tables_non_lazy_load
(
start_cluster
):
assert
node1
.
query_and_get_error
(
"SELECT * FROM system.part_log"
)
==
""
assert
node1
.
query_and_get_error
(
"SELECT * FROM system.query_log"
)
==
""
assert
node1
.
query_and_get_error
(
"SELECT * FROM system.query_thread_log"
)
==
""
assert
node1
.
query_and_get_error
(
"SELECT * FROM system.text_log"
)
==
""
assert
node1
.
query_and_get_error
(
"SELECT * FROM system.trace_log"
)
==
""
assert
node1
.
query_and_get_error
(
"SELECT * FROM system.metric_log"
)
==
""
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录