Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
168ca224
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,发现更多精彩内容 >>
提交
168ca224
编写于
6月 06, 2016
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed error when too long merges cannot be successful [#METR-21616].
上级
3144117b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
1 deletion
+26
-1
dbms/include/DB/Storages/MergeTree/MergeTreeSettings.h
dbms/include/DB/Storages/MergeTree/MergeTreeSettings.h
+3
-0
dbms/src/Storages/MergeTree/MergeTreeData.cpp
dbms/src/Storages/MergeTree/MergeTreeData.cpp
+23
-1
未找到文件。
dbms/include/DB/Storages/MergeTree/MergeTreeSettings.h
浏览文件 @
168ca224
...
...
@@ -47,6 +47,9 @@ struct MergeTreeSettings
/// Через сколько секунд удалять ненужные куски.
time_t
old_parts_lifetime
=
8
*
60
;
/// Через сколько секунд удалять tmp_-директории.
time_t
temporary_directories_lifetime
=
86400
;
/** Настройки вставок. */
/// Если в таблице хотя бы столько активных кусков, искусственно замедлять вставки в таблицу.
...
...
dbms/src/Storages/MergeTree/MergeTreeData.cpp
浏览文件 @
168ca224
...
...
@@ -379,6 +379,26 @@ void MergeTreeData::loadDataParts(bool skip_sanity_checks)
}
/** Является ли директория куска старой.
* Это так, если её дата модификации,
* и одновременно дата модификации всех файлов внутри неё
* (рассматриваются файлы только на одном уровне вложенности),
* меньше threshold.
*/
static
bool
isOldPartDirectory
(
Poco
::
File
&
directory
,
time_t
threshold
)
{
if
(
directory
.
getLastModified
().
epochTime
()
>=
threshold
)
return
false
;
Poco
::
DirectoryIterator
end
;
for
(
Poco
::
DirectoryIterator
it
(
directory
);
it
!=
end
;
++
it
)
if
(
it
->
getLastModified
().
epochTime
()
>=
threshold
)
return
false
;
return
true
;
}
void
MergeTreeData
::
clearOldTemporaryDirectories
()
{
/// Если метод уже вызван из другого потока, то можно ничего не делать.
...
...
@@ -386,6 +406,8 @@ void MergeTreeData::clearOldTemporaryDirectories()
if
(
!
lock
.
try_lock
())
return
;
time_t
current_time
=
time
(
0
);
/// Удаляем временные директории старше суток.
Poco
::
DirectoryIterator
end
;
for
(
Poco
::
DirectoryIterator
it
{
full_path
};
it
!=
end
;
++
it
)
...
...
@@ -396,7 +418,7 @@ void MergeTreeData::clearOldTemporaryDirectories()
try
{
if
(
tmp_dir
.
isDirectory
()
&&
tmp_dir
.
getLastModified
().
epochTime
()
+
86400
<
time
(
0
))
if
(
tmp_dir
.
isDirectory
()
&&
isOldPartDirectory
(
tmp_dir
,
current_time
-
settings
.
temporary_directories_lifetime
))
{
LOG_WARNING
(
log
,
"Removing temporary directory "
<<
full_path
<<
it
.
name
());
Poco
::
File
(
full_path
+
it
.
name
()).
remove
(
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录