Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
bc9ee549
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,发现更多精彩内容 >>
提交
bc9ee549
编写于
7月 24, 2017
作者:
V
Vitaliy Lyudvichenko
提交者:
alexey-milovidov
7月 24, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't throw exception in case of clearing empty part. [#CLICKHOUSE-2896]
上级
8763567e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
3 deletion
+22
-3
dbms/src/Storages/StorageReplicatedMergeTree.cpp
dbms/src/Storages/StorageReplicatedMergeTree.cpp
+15
-3
dbms/src/Storages/StorageReplicatedMergeTree.h
dbms/src/Storages/StorageReplicatedMergeTree.h
+1
-0
dbms/tests/queries/0_stateless/00446_clear_column_in_partition.sql
...s/queries/0_stateless/00446_clear_column_in_partition.sql
+6
-0
未找到文件。
dbms/src/Storages/StorageReplicatedMergeTree.cpp
浏览文件 @
bc9ee549
...
...
@@ -2617,11 +2617,11 @@ String StorageReplicatedMergeTree::getFakePartNameCoveringAllPartsInPartition(co
block_number_lock
.
unlock
();
}
///
This should never happe
n.
///
Empty partitio
n.
if
(
right
==
0
)
throw
Exception
(
"Logical error: newly allocated block number is zero"
,
ErrorCodes
::
LOGICAL_ERROR
);
--
right
;
return
{};
--
right
;
return
getFakePartNameCoveringPartRange
(
month_name
,
left
,
right
);
}
...
...
@@ -2636,6 +2636,12 @@ void StorageReplicatedMergeTree::clearColumnInPartition(
String
month_name
=
MergeTreeData
::
getMonthName
(
partition
);
String
fake_part_name
=
getFakePartNameCoveringAllPartsInPartition
(
month_name
);
if
(
fake_part_name
.
empty
())
{
LOG_INFO
(
log
,
"Will not clear partition "
<<
month_name
<<
", it is empty."
);
return
;
}
/// We allocated new block number for this part, so new merges can't merge clearing parts with new ones
LogEntry
entry
;
...
...
@@ -2670,6 +2676,12 @@ void StorageReplicatedMergeTree::dropPartition(const ASTPtr & query, const Field
String
month_name
=
MergeTreeData
::
getMonthName
(
partition
);
String
fake_part_name
=
getFakePartNameCoveringAllPartsInPartition
(
month_name
);
if
(
fake_part_name
.
empty
())
{
LOG_INFO
(
log
,
"Will not drop partition "
<<
month_name
<<
", it is empty."
);
return
;
}
/** Forbid to choose the parts to be deleted for merging.
* Invariant: after the `DROP_RANGE` entry appears in the log, merge of deleted parts will not appear in the log.
*/
...
...
dbms/src/Storages/StorageReplicatedMergeTree.h
浏览文件 @
bc9ee549
...
...
@@ -468,6 +468,7 @@ private:
void
assertNotReadonly
()
const
;
/// The name of an imaginary part covering all parts in the specified partition (at the call moment).
/// Returns empty string if partition is empy.
String
getFakePartNameCoveringAllPartsInPartition
(
const
String
&
month_name
);
/// Check for a node in ZK. If it is, remember this information, and then immediately answer true.
...
...
dbms/tests/queries/0_stateless/00446_clear_column_in_partition.sql
浏览文件 @
bc9ee549
...
...
@@ -49,6 +49,12 @@ SELECT sum(data_uncompressed_bytes) FROM system.columns WHERE database='test' AN
ALTER
TABLE
test
.
clear_column1
CLEAR
COLUMN
s
IN
PARTITION
'200001'
;
ALTER
TABLE
test
.
clear_column1
CLEAR
COLUMN
s
IN
PARTITION
'200002'
;
-- clear column in empty partition should be Ok
ALTER
TABLE
test
.
clear_column1
CLEAR
COLUMN
s
IN
PARTITION
'200012'
,
CLEAR
COLUMN
i
IN
PARTITION
'200012'
;
-- Drop empty partition also Ok
ALTER
TABLE
test
.
clear_column1
DROP
PARTITION
'200012'
,
DROP
PARTITION
'200011'
;
-- check optimize for non-leader replica (it is not related with CLEAR COLUMN)
OPTIMIZE
TABLE
test
.
clear_column1
;
OPTIMIZE
TABLE
test
.
clear_column2
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录