Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
288b407d
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,发现更多精彩内容 >>
提交
288b407d
编写于
6月 30, 2020
作者:
V
Vladimir Chebotarev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added test for automatic start of background move task.
上级
bb8da71e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
61 addition
and
0 deletion
+61
-0
tests/integration/test_ttl_move/configs/config.d/storage_configuration.xml
.../test_ttl_move/configs/config.d/storage_configuration.xml
+14
-0
tests/integration/test_ttl_move/test.py
tests/integration/test_ttl_move/test.py
+47
-0
未找到文件。
tests/integration/test_ttl_move/configs/config.d/storage_configuration.xml
浏览文件 @
288b407d
...
...
@@ -40,6 +40,20 @@
</volumes>
</jbods_with_external>
<default_with_small_jbod_with_external>
<volumes>
<default>
<disk>
default
</disk>
</default>
<main>
<disk>
jbod1
</disk>
</main>
<external>
<disk>
external
</disk>
</external>
</volumes>
</default_with_small_jbod_with_external>
<small_jbod_with_external>
<volumes>
<main>
...
...
tests/integration/test_ttl_move/test.py
浏览文件 @
288b407d
...
...
@@ -160,6 +160,53 @@ def test_inserts_to_disk_work(started_cluster, name, engine, positive):
pass
@
pytest
.
mark
.
parametrize
(
"name,engine"
,
[
(
"mt_test_moves_work_after_storage_policy_change"
,
"MergeTree()"
),
(
"replicated_mt_test_moves_work_after_storage_policy_change"
,
"ReplicatedMergeTree('/clickhouse/test_moves_work_after_storage_policy_change', '1')"
),
])
def
test_moves_work_after_storage_policy_change
(
started_cluster
,
name
,
engine
):
try
:
node1
.
query
(
"""
CREATE TABLE {name} (
s1 String,
d1 DateTime
) ENGINE = {engine}
ORDER BY tuple()
"""
.
format
(
name
=
name
,
engine
=
engine
))
node1
.
query
(
"""ALTER TABLE {name} MODIFY SETTING storage_policy='default_with_small_jbod_with_external'"""
.
format
(
name
=
name
))
# Second expression is preferred because d1 > now()-3600.
node1
.
query
(
"""ALTER TABLE {name} MODIFY TTL now()-3600 TO DISK 'jbod1', d1 TO DISK 'external'"""
.
format
(
name
=
name
))
wait_expire_1
=
12
wait_expire_2
=
4
time_1
=
time
.
time
()
+
wait_expire_1
time_2
=
time
.
time
()
+
wait_expire_1
+
wait_expire_2
wait_expire_1_thread
=
threading
.
Thread
(
target
=
time
.
sleep
,
args
=
(
wait_expire_1
,))
wait_expire_1_thread
.
start
()
data
=
[]
# 10MB in total
for
i
in
range
(
10
):
data
.
append
((
"'{}'"
.
format
(
get_random_string
(
1024
*
1024
)),
"toDateTime({})"
.
format
(
time_1
)))
# 1MB row
node1
.
query
(
"INSERT INTO {} (s1, d1) VALUES {}"
.
format
(
name
,
","
.
join
([
"("
+
","
.
join
(
x
)
+
")"
for
x
in
data
])))
used_disks
=
get_used_disks_for_table
(
node1
,
name
)
assert
set
(
used_disks
)
==
{
"jbod1"
}
wait_expire_1_thread
.
join
()
time
.
sleep
(
wait_expire_2
/
2
)
used_disks
=
get_used_disks_for_table
(
node1
,
name
)
assert
set
(
used_disks
)
==
{
"external"
}
assert
node1
.
query
(
"SELECT count() FROM {name}"
.
format
(
name
=
name
)).
strip
()
==
"10"
finally
:
node1
.
query
(
"DROP TABLE IF EXISTS {}"
.
format
(
name
))
@
pytest
.
mark
.
parametrize
(
"name,engine,positive"
,
[
(
"mt_test_moves_to_disk_do_not_work"
,
"MergeTree()"
,
0
),
(
"replicated_mt_test_moves_to_disk_do_not_work"
,
"ReplicatedMergeTree('/clickhouse/replicated_test_moves_to_disk_do_not_work', '1')"
,
0
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录