Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
50362840
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,发现更多精彩内容 >>
未验证
提交
50362840
编写于
2月 03, 2021
作者:
T
tavplubix
提交者:
GitHub
2月 03, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19924 from amosbird/ddlworker2
Initialize MaxDDLEntryID upon restarting
上级
bb9a7e89
37c178f5
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
23 addition
and
15 deletion
+23
-15
src/Interpreters/DDLWorker.cpp
src/Interpreters/DDLWorker.cpp
+22
-15
src/Interpreters/DDLWorker.h
src/Interpreters/DDLWorker.h
+1
-0
未找到文件。
src/Interpreters/DDLWorker.cpp
浏览文件 @
50362840
...
...
@@ -462,6 +462,7 @@ void DDLWorker::scheduleTasks()
else
{
LOG_DEBUG
(
log
,
"Task {} ({}) has been already processed"
,
entry_name
,
task
->
entry
.
query
);
updateMaxDDLEntryID
(
*
task
);
}
saveTask
(
entry_name
);
...
...
@@ -680,6 +681,26 @@ void DDLWorker::enqueueTask(DDLTaskPtr task_ptr)
}
}
}
void
DDLWorker
::
updateMaxDDLEntryID
(
const
DDLTask
&
task
)
{
DB
::
ReadBufferFromString
in
(
task
.
entry_name
);
DB
::
assertString
(
"query-"
,
in
);
UInt64
id
;
readText
(
id
,
in
);
auto
prev_id
=
max_id
.
load
(
std
::
memory_order_relaxed
);
while
(
prev_id
<
id
)
{
if
(
max_id
.
compare_exchange_weak
(
prev_id
,
id
))
{
CurrentMetrics
::
set
(
CurrentMetrics
::
MaxDDLEntryID
,
id
);
break
;
}
}
}
void
DDLWorker
::
processTask
(
DDLTask
&
task
)
{
auto
zookeeper
=
tryGetZooKeeper
();
...
...
@@ -754,21 +775,7 @@ void DDLWorker::processTask(DDLTask & task)
task
.
was_executed
=
true
;
}
{
DB
::
ReadBufferFromString
in
(
task
.
entry_name
);
DB
::
assertString
(
"query-"
,
in
);
UInt64
id
;
readText
(
id
,
in
);
auto
prev_id
=
max_id
.
load
(
std
::
memory_order_relaxed
);
while
(
prev_id
<
id
)
{
if
(
max_id
.
compare_exchange_weak
(
prev_id
,
id
))
{
CurrentMetrics
::
set
(
CurrentMetrics
::
MaxDDLEntryID
,
id
);
break
;
}
}
}
updateMaxDDLEntryID
(
task
);
/// FIXME: if server fails right here, the task will be executed twice. We need WAL here.
...
...
src/Interpreters/DDLWorker.h
浏览文件 @
50362840
...
...
@@ -129,6 +129,7 @@ private:
/// Returns non-empty DDLTaskPtr if entry parsed and the check is passed
DDLTaskPtr
initAndCheckTask
(
const
String
&
entry_name
,
String
&
out_reason
,
const
ZooKeeperPtr
&
zookeeper
);
void
updateMaxDDLEntryID
(
const
DDLTask
&
task
);
void
enqueueTask
(
DDLTaskPtr
task
);
void
processTask
(
DDLTask
&
task
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录