Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
3816a8ae
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,发现更多精彩内容 >>
提交
3816a8ae
编写于
5月 31, 2017
作者:
A
alexey-milovidov
提交者:
GitHub
5月 31, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #837 from yandex/CLICKHOUSE-3044
Remove tmp part directories on server start. [#CLICKHOUSE-3044]
上级
0b2e2ec2
1a4b0eb3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
4 deletion
+17
-4
dbms/src/Storages/MergeTree/MergeTreeData.cpp
dbms/src/Storages/MergeTree/MergeTreeData.cpp
+5
-2
dbms/src/Storages/MergeTree/MergeTreeData.h
dbms/src/Storages/MergeTree/MergeTreeData.h
+3
-1
dbms/src/Storages/StorageMergeTree.cpp
dbms/src/Storages/StorageMergeTree.cpp
+5
-1
dbms/src/Storages/StorageReplicatedMergeTree.cpp
dbms/src/Storages/StorageReplicatedMergeTree.cpp
+4
-0
未找到文件。
dbms/src/Storages/MergeTree/MergeTreeData.cpp
浏览文件 @
3816a8ae
...
...
@@ -472,7 +472,7 @@ static bool isOldPartDirectory(Poco::File & directory, time_t threshold)
}
void
MergeTreeData
::
clearOldTemporaryDirectories
()
void
MergeTreeData
::
clearOldTemporaryDirectories
(
ssize_t
custom_directories_lifetime_seconds
)
{
/// If the method is already called from another thread, then we don't need to do anything.
std
::
unique_lock
<
std
::
mutex
>
lock
(
clear_old_temporary_directories_mutex
,
std
::
defer_lock
);
...
...
@@ -480,6 +480,9 @@ void MergeTreeData::clearOldTemporaryDirectories()
return
;
time_t
current_time
=
time
(
0
);
ssize_t
deadline
=
(
custom_directories_lifetime_seconds
>=
0
)
?
current_time
-
custom_directories_lifetime_seconds
:
current_time
-
settings
.
temporary_directories_lifetime
;
/// Delete temporary directories older than a day.
Poco
::
DirectoryIterator
end
;
...
...
@@ -491,7 +494,7 @@ void MergeTreeData::clearOldTemporaryDirectories()
try
{
if
(
tmp_dir
.
isDirectory
()
&&
isOldPartDirectory
(
tmp_dir
,
current_time
-
settings
.
temporary_directories_lifetim
e
))
if
(
tmp_dir
.
isDirectory
()
&&
isOldPartDirectory
(
tmp_dir
,
deadlin
e
))
{
LOG_WARNING
(
log
,
"Removing temporary directory "
<<
full_path
<<
it
.
name
());
Poco
::
File
(
full_path
+
it
.
name
()).
remove
(
true
);
...
...
dbms/src/Storages/MergeTree/MergeTreeData.h
浏览文件 @
3816a8ae
...
...
@@ -354,7 +354,9 @@ public:
/// Delete irrelevant parts.
void
clearOldParts
();
void
clearOldTemporaryDirectories
();
/// Deleate all directories which names begin with "tmp"
/// Set non-negative parameter value to override MergeTreeSettings temporary_directories_lifetime
void
clearOldTemporaryDirectories
(
ssize_t
custom_directories_lifetime_seconds
=
-
1
);
/// After the call to dropAllData() no method can be called.
/// Deletes the data directory and flushes the uncompressed blocks cache and the marks cache.
...
...
dbms/src/Storages/StorageMergeTree.cpp
浏览文件 @
3816a8ae
...
...
@@ -57,7 +57,11 @@ StorageMergeTree::StorageMergeTree(
{
data
.
loadDataParts
(
has_force_restore_data_flag
);
data
.
clearOldParts
();
data
.
clearOldTemporaryDirectories
();
/// Temporary directories contain unfinalized results of Merges (after forced restart)
/// and don't allow to reinitialize them, so delete each of them immediately
data
.
clearOldTemporaryDirectories
(
0
);
increment
.
set
(
data
.
getMaxDataPartIndex
());
}
...
...
dbms/src/Storages/StorageReplicatedMergeTree.cpp
浏览文件 @
3816a8ae
...
...
@@ -289,6 +289,10 @@ StorageReplicatedMergeTree::StorageReplicatedMergeTree(
{
checkTableStructure
(
skip_sanity_checks
,
true
);
checkParts
(
skip_sanity_checks
);
/// Temporary directories contain unfinalized results of Merges or Fetches (after forced restart)
/// and don't allow to reinitialize them, so delete each of them immediately
data
.
clearOldTemporaryDirectories
(
0
);
}
createNewZooKeeperNodes
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录