Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
d8c69219
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,发现更多精彩内容 >>
未验证
提交
d8c69219
编写于
2月 26, 2020
作者:
A
alexey-milovidov
提交者:
GitHub
2月 26, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9365 from ClickHouse/ubsan-index-set
Fixed UBSan report in MergeTreeIndexSet
上级
65f5435e
757be552
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
34 addition
and
25 deletion
+34
-25
dbms/src/Disks/DiskSpaceMonitor.cpp
dbms/src/Disks/DiskSpaceMonitor.cpp
+12
-2
dbms/src/Disks/DiskSpaceMonitor.h
dbms/src/Disks/DiskSpaceMonitor.h
+0
-11
dbms/src/Functions/bitWrapperFunc.cpp
dbms/src/Functions/bitWrapperFunc.cpp
+0
-1
dbms/src/Storages/MergeTree/MergeTreeData.cpp
dbms/src/Storages/MergeTree/MergeTreeData.cpp
+2
-0
dbms/src/Storages/MergeTree/MergeTreeIndexSet.cpp
dbms/src/Storages/MergeTree/MergeTreeIndexSet.cpp
+9
-5
dbms/src/Storages/MergeTree/MergeTreeIndexSet.h
dbms/src/Storages/MergeTree/MergeTreeIndexSet.h
+1
-1
dbms/src/Storages/StorageMergeTree.cpp
dbms/src/Storages/StorageMergeTree.cpp
+1
-5
dbms/tests/queries/0_stateless/01087_index_set_ubsan.reference
...tests/queries/0_stateless/01087_index_set_ubsan.reference
+4
-0
dbms/tests/queries/0_stateless/01087_index_set_ubsan.sql
dbms/tests/queries/0_stateless/01087_index_set_ubsan.sql
+5
-0
未找到文件。
dbms/src/Disks/DiskSpaceMonitor.cpp
浏览文件 @
d8c69219
...
...
@@ -12,6 +12,16 @@
namespace
DB
{
namespace
ErrorCodes
{
extern
const
int
EXCESSIVE_ELEMENT_IN_CONFIG
;
extern
const
int
UNKNOWN_DISK
;
extern
const
int
UNKNOWN_POLICY
;
extern
const
int
LOGICAL_ERROR
;
}
DiskSelector
::
DiskSelector
(
const
Poco
::
Util
::
AbstractConfiguration
&
config
,
const
String
&
config_prefix
,
const
Context
&
context
)
{
Poco
::
Util
::
AbstractConfiguration
::
Keys
keys
;
...
...
@@ -253,10 +263,10 @@ DiskPtr StoragePolicy::getAnyDisk() const
/// StoragePolicy must contain at least one Volume
/// Volume must contain at least one Disk
if
(
volumes
.
empty
())
throw
Exception
(
"StoragePolicy has no volumes. It's a bug."
,
ErrorCodes
::
NOT_ENOUGH_SPACE
);
throw
Exception
(
"StoragePolicy has no volumes. It's a bug."
,
ErrorCodes
::
LOGICAL_ERROR
);
if
(
volumes
[
0
]
->
disks
.
empty
())
throw
Exception
(
"Volume '"
+
volumes
[
0
]
->
getName
()
+
"' has no disks. It's a bug."
,
ErrorCodes
::
NOT_ENOUGH_SPACE
);
throw
Exception
(
"Volume '"
+
volumes
[
0
]
->
getName
()
+
"' has no disks. It's a bug."
,
ErrorCodes
::
LOGICAL_ERROR
);
return
volumes
[
0
]
->
disks
[
0
];
}
...
...
dbms/src/Disks/DiskSpaceMonitor.h
浏览文件 @
d8c69219
...
...
@@ -16,17 +16,6 @@
namespace
DB
{
namespace
ErrorCodes
{
extern
const
int
LOGICAL_ERROR
;
extern
const
int
NOT_ENOUGH_SPACE
;
extern
const
int
NOT_IMPLEMENTED
;
extern
const
int
SYSTEM_ERROR
;
extern
const
int
UNKNOWN_ELEMENT_IN_CONFIG
;
extern
const
int
EXCESSIVE_ELEMENT_IN_CONFIG
;
extern
const
int
UNKNOWN_POLICY
;
extern
const
int
UNKNOWN_DISK
;
}
/// Parse .xml configuration and store information about disks
/// Mostly used for introspection.
...
...
dbms/src/Functions/bitWrapperFunc.cpp
浏览文件 @
d8c69219
...
...
@@ -27,7 +27,6 @@ namespace DB
#if USE_EMBEDDED_COMPILER
static
constexpr
bool
compilable
=
false
;
#endif
};
...
...
dbms/src/Storages/MergeTree/MergeTreeData.cpp
浏览文件 @
d8c69219
...
...
@@ -104,6 +104,8 @@ namespace ErrorCodes
extern
const
int
ABORTED
;
extern
const
int
UNKNOWN_PART_TYPE
;
extern
const
int
UNEXPECTED_AST_STRUCTURE
;
extern
const
int
UNKNOWN_DISK
;
extern
const
int
NOT_ENOUGH_SPACE
;
}
...
...
dbms/src/Storages/MergeTree/MergeTreeIndexSet.cpp
浏览文件 @
d8c69219
...
...
@@ -18,7 +18,7 @@ namespace ErrorCodes
}
/// 0b11 -- can be true and false at the same time
const
Field
UNKNOWN_FIELD
(
3u
);
static
const
Field
UNKNOWN_FIELD
(
3u
);
MergeTreeIndexGranuleSet
::
MergeTreeIndexGranuleSet
(
const
MergeTreeIndexSet
&
index_
)
...
...
@@ -236,8 +236,6 @@ MergeTreeIndexConditionSet::MergeTreeIndexConditionSet(
expression_ast
=
select
.
where
()
->
clone
();
else
if
(
select
.
prewhere
())
expression_ast
=
select
.
prewhere
()
->
clone
();
else
expression_ast
=
std
::
make_shared
<
ASTLiteral
>
(
UNKNOWN_FIELD
);
useless
=
checkASTUseless
(
expression_ast
);
/// Do not proceed if index is useless for this query.
...
...
@@ -260,6 +258,9 @@ bool MergeTreeIndexConditionSet::alwaysUnknownOrTrue() const
bool
MergeTreeIndexConditionSet
::
mayBeTrueOnGranule
(
MergeTreeIndexGranulePtr
idx_granule
)
const
{
if
(
useless
)
return
true
;
auto
granule
=
std
::
dynamic_pointer_cast
<
MergeTreeIndexGranuleSet
>
(
idx_granule
);
if
(
!
granule
)
throw
Exception
(
...
...
@@ -405,8 +406,11 @@ bool MergeTreeIndexConditionSet::operatorFromAST(ASTPtr & node) const
return
true
;
}
bool
MergeTreeIndexConditionSet
::
checkASTUseless
(
const
ASTPtr
&
node
,
bool
atomic
)
const
bool
MergeTreeIndexConditionSet
::
checkASTUseless
(
const
ASTPtr
&
node
,
bool
atomic
)
const
{
if
(
!
node
)
return
true
;
if
(
const
auto
*
func
=
node
->
as
<
ASTFunction
>
())
{
if
(
key_columns
.
count
(
func
->
getColumnName
()))
...
...
@@ -422,7 +426,7 @@ bool MergeTreeIndexConditionSet::checkASTUseless(const ASTPtr &node, bool atomic
return
checkASTUseless
(
args
[
0
],
atomic
);
else
return
std
::
any_of
(
args
.
begin
(),
args
.
end
(),
[
this
](
const
auto
&
arg
)
{
return
checkASTUseless
(
arg
,
true
);
});
[
this
](
const
auto
&
arg
)
{
return
checkASTUseless
(
arg
,
true
);
});
}
else
if
(
const
auto
*
literal
=
node
->
as
<
ASTLiteral
>
())
return
!
atomic
&&
literal
->
value
.
get
<
bool
>
();
...
...
dbms/src/Storages/MergeTree/MergeTreeIndexSet.h
浏览文件 @
d8c69219
...
...
@@ -80,7 +80,7 @@ private:
bool
atomFromAST
(
ASTPtr
&
node
)
const
;
bool
operatorFromAST
(
ASTPtr
&
node
)
const
;
bool
checkASTUseless
(
const
ASTPtr
&
node
,
bool
atomic
=
false
)
const
;
bool
checkASTUseless
(
const
ASTPtr
&
node
,
bool
atomic
=
false
)
const
;
const
MergeTreeIndexSet
&
index
;
...
...
dbms/src/Storages/StorageMergeTree.cpp
浏览文件 @
d8c69219
...
...
@@ -36,12 +36,8 @@ namespace ErrorCodes
extern
const
int
ABORTED
;
extern
const
int
BAD_ARGUMENTS
;
extern
const
int
INCORRECT_DATA
;
extern
const
int
INCORRECT_FILE_NAME
;
extern
const
int
CANNOT_ASSIGN_OPTIMIZE
;
extern
const
int
INCOMPATIBLE_COLUMNS
;
extern
const
int
PART_IS_TEMPORARILY_LOCKED
;
extern
const
int
UNKNOWN_SETTING
;
extern
const
int
TOO_BIG_AST
;
extern
const
int
NOT_ENOUGH_SPACE
;
}
namespace
ActionLocks
...
...
dbms/tests/queries/0_stateless/01087_index_set_ubsan.reference
0 → 100644
浏览文件 @
d8c69219
1 1
1 2
1 3
1 4
dbms/tests/queries/0_stateless/01087_index_set_ubsan.sql
0 → 100644
浏览文件 @
d8c69219
DROP
TABLE
IF
EXISTS
t
;
create
table
t
(
i
Int
,
a
Int
,
s
String
,
index
ind_s
(
s
)
type
set
(
1
)
granularity
1
)
engine
=
MergeTree
order
by
i
;
insert
into
t
values
(
1
,
1
,
'a'
)
(
2
,
1
,
'a'
)
(
3
,
1
,
'a'
)
(
4
,
1
,
'a'
);
SELECT
a
,
i
from
t
ORDER
BY
a
,
i
;
DROP
TABLE
t
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录