Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
605f3b21
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,发现更多精彩内容 >>
提交
605f3b21
编写于
4月 16, 2020
作者:
A
Alexander Tokmakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix DROP vs OPTIMIZE race in ReplicatedMergeTree
上级
fa8e4e47
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
6 deletion
+18
-6
src/Storages/MergeTree/ReplicatedMergeTreeQueue.cpp
src/Storages/MergeTree/ReplicatedMergeTreeQueue.cpp
+3
-0
src/Storages/MergeTree/ReplicatedMergeTreeQueue.h
src/Storages/MergeTree/ReplicatedMergeTreeQueue.h
+3
-0
src/Storages/StorageReplicatedMergeTree.cpp
src/Storages/StorageReplicatedMergeTree.cpp
+8
-2
tests/queries/0_stateless/00993_system_parts_race_condition_drop_zookeeper.sh
...eless/00993_system_parts_race_condition_drop_zookeeper.sh
+4
-4
未找到文件。
src/Storages/MergeTree/ReplicatedMergeTreeQueue.cpp
浏览文件 @
605f3b21
...
...
@@ -16,6 +16,7 @@ namespace ErrorCodes
extern
const
int
LOGICAL_ERROR
;
extern
const
int
UNEXPECTED_NODE_IN_ZOOKEEPER
;
extern
const
int
UNFINISHED
;
extern
const
int
ABORTED
;
}
...
...
@@ -426,6 +427,8 @@ bool ReplicatedMergeTreeQueue::removeFromVirtualParts(const MergeTreePartInfo &
void
ReplicatedMergeTreeQueue
::
pullLogsToQueue
(
zkutil
::
ZooKeeperPtr
zookeeper
,
Coordination
::
WatchCallback
watch_callback
)
{
std
::
lock_guard
lock
(
pull_logs_to_queue_mutex
);
if
(
pull_log_blocker
.
isCancelled
())
throw
Exception
(
"Log pulling is cancelled"
,
ErrorCodes
::
ABORTED
);
String
index_str
=
zookeeper
->
get
(
replica_path
+
"/log_pointer"
);
UInt64
index
;
...
...
src/Storages/MergeTree/ReplicatedMergeTreeQueue.h
浏览文件 @
605f3b21
...
...
@@ -356,6 +356,9 @@ public:
/// A blocker that stops selects from the queue
ActionBlocker
actions_blocker
;
/// A blocker that stops pulling entries from replication log to queue
ActionBlocker
pull_log_blocker
;
/// Adds a subscriber
SubscriberHandler
addSubscriber
(
SubscriberCallBack
&&
callback
);
...
...
src/Storages/StorageReplicatedMergeTree.cpp
浏览文件 @
605f3b21
...
...
@@ -300,8 +300,6 @@ StorageReplicatedMergeTree::StorageReplicatedMergeTree(
}
createNewZooKeeperNodes
();
}
...
...
@@ -2905,6 +2903,7 @@ void StorageReplicatedMergeTree::shutdown()
fetcher
.
blocker
.
cancelForever
();
merger_mutator
.
merges_blocker
.
cancelForever
();
parts_mover
.
moves_blocker
.
cancelForever
();
queue
.
pull_log_blocker
.
cancelForever
();
restarting_thread
.
shutdown
();
...
...
@@ -3641,7 +3640,11 @@ void StorageReplicatedMergeTree::drop(TableStructureWriteLockHolder &)
LOG_INFO
(
log
,
"Removing replica "
<<
replica_path
);
replica_is_active_node
=
nullptr
;
/// It may left some garbage if replica_path subtree are concurently modified
zookeeper
->
tryRemoveRecursive
(
replica_path
);
if
(
zookeeper
->
exists
(
replica_path
))
LOG_ERROR
(
log
,
"Replica was not completely removed from ZooKeeper, "
<<
replica_path
<<
" still exists and may contain some garbage."
);
/// Check that `zookeeper_path` exists: it could have been deleted by another replica after execution of previous line.
Strings
replicas
;
...
...
@@ -3649,6 +3652,9 @@ void StorageReplicatedMergeTree::drop(TableStructureWriteLockHolder &)
{
LOG_INFO
(
log
,
"Removing table "
<<
zookeeper_path
<<
" (this might take several minutes)"
);
zookeeper
->
tryRemoveRecursive
(
zookeeper_path
);
if
(
zookeeper
->
exists
(
zookeeper_path
))
LOG_ERROR
(
log
,
"Table was not completely removed from ZooKeeper, "
<<
zookeeper_path
<<
" still exists and may contain some garbage."
);
}
}
...
...
tests/queries/0_stateless/00993_system_parts_race_condition_drop_zookeeper.sh
浏览文件 @
605f3b21
...
...
@@ -72,28 +72,28 @@ timeout $TIMEOUT bash -c thread2 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread3 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread4 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread5 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread6 2>
/dev/null
&
timeout
$TIMEOUT
bash
-c
thread6 2>
&1 |
grep
"was not completely removed from ZooKeeper"
&
timeout
$TIMEOUT
bash
-c
thread1 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread2 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread3 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread4 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread5 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread6 2>
/dev/null
&
timeout
$TIMEOUT
bash
-c
thread6 2>
&1 |
grep
"was not completely removed from ZooKeeper"
&
timeout
$TIMEOUT
bash
-c
thread1 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread2 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread3 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread4 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread5 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread6 2>
/dev/null
&
timeout
$TIMEOUT
bash
-c
thread6 2>
&1 |
grep
"was not completely removed from ZooKeeper"
&
timeout
$TIMEOUT
bash
-c
thread1 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread2 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread3 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread4 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread5 2> /dev/null &
timeout
$TIMEOUT
bash
-c
thread6 2>
/dev/null
&
timeout
$TIMEOUT
bash
-c
thread6 2>
&1 |
grep
"was not completely removed from ZooKeeper"
&
wait
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录