Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
6bddd4c1
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,发现更多精彩内容 >>
提交
6bddd4c1
编写于
6月 01, 2017
作者:
V
Vitaliy Lyudvichenko
提交者:
alexey-milovidov
6月 02, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean incomplete part nodes in ZooKeeper. [#CLICKHOUSE-3040]
上级
ba499585
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
7 deletion
+33
-7
dbms/src/Storages/StorageReplicatedMergeTree.cpp
dbms/src/Storages/StorageReplicatedMergeTree.cpp
+29
-7
dbms/src/Storages/StorageReplicatedMergeTree.h
dbms/src/Storages/StorageReplicatedMergeTree.h
+4
-0
未找到文件。
dbms/src/Storages/StorageReplicatedMergeTree.cpp
浏览文件 @
6bddd4c1
...
@@ -878,7 +878,7 @@ void StorageReplicatedMergeTree::checkParts(bool skip_sanity_checks)
...
@@ -878,7 +878,7 @@ void StorageReplicatedMergeTree::checkParts(bool skip_sanity_checks)
LOG_ERROR
(
log
,
"Removing unexpectedly merged local part from ZooKeeper: "
<<
name
);
LOG_ERROR
(
log
,
"Removing unexpectedly merged local part from ZooKeeper: "
<<
name
);
zkutil
::
Ops
ops
;
zkutil
::
Ops
ops
;
removeP
artFromZooKeeper
(
name
,
ops
);
removeP
ossiblyIncompletePartNodeFromZooKeeper
(
name
,
ops
,
zookeeper
);
zookeeper
->
multi
(
ops
);
zookeeper
->
multi
(
ops
);
}
}
...
@@ -895,7 +895,7 @@ void StorageReplicatedMergeTree::checkParts(bool skip_sanity_checks)
...
@@ -895,7 +895,7 @@ void StorageReplicatedMergeTree::checkParts(bool skip_sanity_checks)
/// We assume that this occurs before the queue is loaded (queue.initialize).
/// We assume that this occurs before the queue is loaded (queue.initialize).
zkutil
::
Ops
ops
;
zkutil
::
Ops
ops
;
removeP
artFromZooKeeper
(
name
,
ops
);
removeP
ossiblyIncompletePartNodeFromZooKeeper
(
name
,
ops
,
zookeeper
);
ops
.
emplace_back
(
std
::
make_unique
<
zkutil
::
Op
::
Create
>
(
ops
.
emplace_back
(
std
::
make_unique
<
zkutil
::
Op
::
Create
>
(
replica_path
+
"/queue/queue-"
,
log_entry
.
toString
(),
zookeeper
->
getDefaultACL
(),
zkutil
::
CreateMode
::
PersistentSequential
));
replica_path
+
"/queue/queue-"
,
log_entry
.
toString
(),
zookeeper
->
getDefaultACL
(),
zkutil
::
CreateMode
::
PersistentSequential
));
zookeeper
->
multi
(
ops
);
zookeeper
->
multi
(
ops
);
...
@@ -1876,6 +1876,23 @@ void StorageReplicatedMergeTree::removePartFromZooKeeper(const String & part_nam
...
@@ -1876,6 +1876,23 @@ void StorageReplicatedMergeTree::removePartFromZooKeeper(const String & part_nam
}
}
/// Workarond for known ZooKeeper problem, see CLICKHOUSE-3040 and ZOOKEEPER-2362
void
StorageReplicatedMergeTree
::
removePossiblyIncompletePartNodeFromZooKeeper
(
const
String
&
part_name
,
zkutil
::
Ops
&
ops
,
const
zkutil
::
ZooKeeperPtr
&
zookeeper
)
{
String
part_path
=
replica_path
+
"/parts/"
+
part_name
;
Names
children_
=
zookeeper
->
getChildren
(
part_path
);
NameSet
children
(
children_
.
begin
(),
children_
.
end
());
if
(
children
.
size
()
!=
2
)
LOG_WARNING
(
log
,
"Will remove incomplete part node "
<<
part_path
<<
" from ZooKeeper"
);
if
(
children
.
count
(
"checksums"
))
ops
.
emplace_back
(
std
::
make_unique
<
zkutil
::
Op
::
Remove
>
(
part_path
+
"/checksums"
,
-
1
));
if
(
children
.
count
(
"columns"
))
ops
.
emplace_back
(
std
::
make_unique
<
zkutil
::
Op
::
Remove
>
(
part_path
+
"/columns"
,
-
1
));
ops
.
emplace_back
(
std
::
make_unique
<
zkutil
::
Op
::
Remove
>
(
part_path
,
-
1
));
}
void
StorageReplicatedMergeTree
::
removePartAndEnqueueFetch
(
const
String
&
part_name
)
void
StorageReplicatedMergeTree
::
removePartAndEnqueueFetch
(
const
String
&
part_name
)
{
{
auto
zookeeper
=
getZooKeeper
();
auto
zookeeper
=
getZooKeeper
();
...
@@ -3784,11 +3801,16 @@ void StorageReplicatedMergeTree::clearOldPartsAndRemoveFromZK(Logger * log_)
...
@@ -3784,11 +3801,16 @@ void StorageReplicatedMergeTree::clearOldPartsAndRemoveFromZK(Logger * log_)
LOG_DEBUG
(
log
,
"Removing "
<<
part
->
name
);
LOG_DEBUG
(
log
,
"Removing "
<<
part
->
name
);
zkutil
::
Ops
ops
;
try
removePartFromZooKeeper
(
part
->
name
,
ops
);
{
auto
code
=
zookeeper
->
tryMulti
(
ops
);
zkutil
::
Ops
ops
;
if
(
code
!=
ZOK
)
removePossiblyIncompletePartNodeFromZooKeeper
(
part
->
name
,
ops
,
zookeeper
);
LOG_WARNING
(
log
,
"Couldn't remove "
<<
part
->
name
<<
" from ZooKeeper: "
<<
zkutil
::
ZooKeeper
::
error2string
(
code
));
zookeeper
->
multi
(
ops
);
}
catch
(
const
zkutil
::
KeeperException
&
e
)
{
LOG_WARNING
(
log
,
"Couldn't remove "
<<
part
->
name
<<
" from ZooKeeper: "
<<
zkutil
::
ZooKeeper
::
error2string
(
e
.
code
));
}
part
->
remove
();
part
->
remove
();
parts
.
pop_back
();
parts
.
pop_back
();
...
...
dbms/src/Storages/StorageReplicatedMergeTree.h
浏览文件 @
6bddd4c1
...
@@ -378,6 +378,10 @@ private:
...
@@ -378,6 +378,10 @@ private:
/// Adds actions to `ops` that remove a part from ZooKeeper.
/// Adds actions to `ops` that remove a part from ZooKeeper.
void
removePartFromZooKeeper
(
const
String
&
part_name
,
zkutil
::
Ops
&
ops
);
void
removePartFromZooKeeper
(
const
String
&
part_name
,
zkutil
::
Ops
&
ops
);
/// Like removePartFromZooKeeper, but handles NONODE and remove node anyway, see CLICKHOUSE-3040
/// Use it only in non-critical places for cleaning.
void
removePossiblyIncompletePartNodeFromZooKeeper
(
const
String
&
part_name
,
zkutil
::
Ops
&
ops
,
const
zkutil
::
ZooKeeperPtr
&
zookeeper
);
/// Removes a part from ZooKeeper and adds a task to the queue to download it. It is supposed to do this with broken parts.
/// Removes a part from ZooKeeper and adds a task to the queue to download it. It is supposed to do this with broken parts.
void
removePartAndEnqueueFetch
(
const
String
&
part_name
);
void
removePartAndEnqueueFetch
(
const
String
&
part_name
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录