Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
6c0db94e
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,发现更多精彩内容 >>
未验证
提交
6c0db94e
编写于
2月 28, 2020
作者:
A
alexey-milovidov
提交者:
GitHub
2月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9394 from nikitamikhaylov/last_successful_update_time
last_successful_update_time in system.dictionaries
上级
ae8a7013
ab037044
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
1 deletion
+18
-1
dbms/src/Interpreters/ExternalLoader.cpp
dbms/src/Interpreters/ExternalLoader.cpp
+6
-1
dbms/src/Interpreters/ExternalLoader.h
dbms/src/Interpreters/ExternalLoader.h
+1
-0
dbms/src/Storages/System/StorageSystemDictionaries.cpp
dbms/src/Storages/System/StorageSystemDictionaries.cpp
+2
-0
dbms/tests/integration/test_dictionaries_update_and_reload/test.py
...s/integration/test_dictionaries_update_and_reload/test.py
+9
-0
未找到文件。
dbms/src/Interpreters/ExternalLoader.cpp
浏览文件 @
6c0db94e
...
...
@@ -696,6 +696,7 @@ private:
result
.
object
=
object
;
result
.
exception
=
exception
;
result
.
loading_start_time
=
loading_start_time
;
result
.
last_successful_update_time
=
last_successful_update_time
;
result
.
loading_duration
=
loadingDuration
();
result
.
origin
=
object_config
.
path
;
result
.
repository_name
=
object_config
.
repository_name
;
...
...
@@ -713,6 +714,7 @@ private:
ObjectConfig
object_config
;
TimePoint
loading_start_time
;
TimePoint
loading_end_time
;
TimePoint
last_successful_update_time
;
size_t
state_id
=
0
;
/// Index of the current state of this `info`, this index is incremented every loading.
size_t
loading_id
=
0
;
/// The value which will be stored in `state_id` after finishing the current loading.
size_t
error_count
=
0
;
/// Numbers of errors since last successful loading.
...
...
@@ -1010,7 +1012,10 @@ private:
info
->
exception
=
new_exception
;
info
->
error_count
=
error_count
;
info
->
loading_end_time
=
std
::
chrono
::
system_clock
::
now
();
const
auto
current_time
=
std
::
chrono
::
system_clock
::
now
();
info
->
loading_end_time
=
current_time
;
if
(
!
info
->
exception
)
info
->
last_successful_update_time
=
current_time
;
info
->
state_id
=
info
->
loading_id
;
info
->
next_update_time
=
next_update_time
;
}
...
...
dbms/src/Interpreters/ExternalLoader.h
浏览文件 @
6c0db94e
...
...
@@ -71,6 +71,7 @@ public:
LoadablePtr
object
;
String
origin
;
TimePoint
loading_start_time
;
TimePoint
last_successful_update_time
;
Duration
loading_duration
;
std
::
exception_ptr
exception
;
std
::
string
repository_name
;
...
...
dbms/src/Storages/System/StorageSystemDictionaries.cpp
浏览文件 @
6c0db94e
...
...
@@ -40,6 +40,7 @@ NamesAndTypesList StorageSystemDictionaries::getNamesAndTypes()
{
"lifetime_min"
,
std
::
make_shared
<
DataTypeUInt64
>
()},
{
"lifetime_max"
,
std
::
make_shared
<
DataTypeUInt64
>
()},
{
"loading_start_time"
,
std
::
make_shared
<
DataTypeDateTime
>
()},
{
"last_successful_update_time"
,
std
::
make_shared
<
DataTypeDateTime
>
()},
{
"loading_duration"
,
std
::
make_shared
<
DataTypeFloat32
>
()},
//{ "creation_time", std::make_shared<DataTypeDateTime>() },
{
"last_exception"
,
std
::
make_shared
<
DataTypeString
>
()}
...
...
@@ -112,6 +113,7 @@ void StorageSystemDictionaries::fillData(MutableColumns & res_columns, const Con
}
res_columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
std
::
chrono
::
system_clock
::
to_time_t
(
load_result
.
loading_start_time
)));
res_columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
std
::
chrono
::
system_clock
::
to_time_t
(
load_result
.
last_successful_update_time
)));
res_columns
[
i
++
]
->
insert
(
std
::
chrono
::
duration_cast
<
std
::
chrono
::
duration
<
float
>>
(
load_result
.
loading_duration
).
count
());
if
(
last_exception
)
...
...
dbms/tests/integration/test_dictionaries_update_and_reload/test.py
浏览文件 @
6c0db94e
...
...
@@ -38,6 +38,12 @@ def get_loading_start_time(dictionary_name):
return
None
return
time
.
strptime
(
s
,
"%Y-%m-%d %H:%M:%S"
)
def
get_last_successful_update_time
(
dictionary_name
):
s
=
instance
.
query
(
"SELECT last_successful_update_time FROM system.dictionaries WHERE name='"
+
dictionary_name
+
"'"
).
rstrip
(
"
\n
"
)
if
s
==
"0000-00-00 00:00:00"
:
return
None
return
time
.
strptime
(
s
,
"%Y-%m-%d %H:%M:%S"
)
def
get_loading_duration
(
dictionary_name
):
return
float
(
instance
.
query
(
"SELECT loading_duration FROM system.dictionaries WHERE name='"
+
dictionary_name
+
"'"
))
...
...
@@ -92,6 +98,9 @@ def test_reload_while_loading(started_cluster):
# This time loading should finish quickly.
assert
get_status
(
'slow'
)
==
"LOADED"
last_successful_update_time
=
get_last_successful_update_time
(
'slow'
)
assert
last_successful_update_time
>
start_time
assert
query
(
"SELECT dictGetInt32('slow', 'a', toUInt64(5))"
)
==
"6
\n
"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录