Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
978aba0f
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,发现更多精彩内容 >>
提交
978aba0f
编写于
6月 11, 2015
作者:
A
Andrey Mironov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Merge
上级
cb883c57
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
11 deletion
+11
-11
dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp
dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp
+11
-11
未找到文件。
dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp
浏览文件 @
978aba0f
...
...
@@ -340,8 +340,10 @@ BlockInputStreams MergeTreeDataSelectExecutor::spreadMarkRangesAmongThreads(
const
Names
&
virt_columns
,
const
Settings
&
settings
)
{
size_t
min_marks_for_concurrent_read
=
(
settings
.
merge_tree_min_rows_for_concurrent_read
+
data
.
index_granularity
-
1
)
/
data
.
index_granularity
;
size_t
max_marks_to_use_cache
=
(
settings
.
merge_tree_max_rows_to_use_cache
+
data
.
index_granularity
-
1
)
/
data
.
index_granularity
;
const
size_t
min_marks_for_concurrent_read
=
(
settings
.
merge_tree_min_rows_for_concurrent_read
+
data
.
index_granularity
-
1
)
/
data
.
index_granularity
;
const
size_t
max_marks_to_use_cache
=
(
settings
.
merge_tree_max_rows_to_use_cache
+
data
.
index_granularity
-
1
)
/
data
.
index_granularity
;
/// На всякий случай перемешаем куски.
std
::
random_shuffle
(
parts
.
begin
(),
parts
.
end
());
...
...
@@ -354,12 +356,9 @@ BlockInputStreams MergeTreeDataSelectExecutor::spreadMarkRangesAmongThreads(
/// Пусть отрезки будут перечислены справа налево, чтобы можно было выбрасывать самый левый отрезок с помощью pop_back().
std
::
reverse
(
parts
[
i
].
ranges
.
begin
(),
parts
[
i
].
ranges
.
end
());
sum_marks_in_parts
[
i
]
=
0
;
for
(
size_t
j
=
0
;
j
<
parts
[
i
].
ranges
.
size
();
++
j
)
{
MarkRange
&
range
=
parts
[
i
].
ranges
[
j
];
for
(
const
auto
&
range
:
parts
[
i
].
ranges
)
sum_marks_in_parts
[
i
]
+=
range
.
end
-
range
.
begin
;
}
sum_marks
+=
sum_marks_in_parts
[
i
];
}
...
...
@@ -370,7 +369,7 @@ BlockInputStreams MergeTreeDataSelectExecutor::spreadMarkRangesAmongThreads(
if
(
sum_marks
>
0
)
{
size_t
min_marks_per_thread
=
(
sum_marks
-
1
)
/
threads
+
1
;
const
size_t
min_marks_per_thread
=
(
sum_marks
-
1
)
/
threads
+
1
;
for
(
size_t
i
=
0
;
i
<
threads
&&
!
parts
.
empty
();
++
i
)
{
...
...
@@ -415,10 +414,11 @@ BlockInputStreams MergeTreeDataSelectExecutor::spreadMarkRangesAmongThreads(
throw
Exception
(
"Unexpected end of ranges while spreading marks among threads"
,
ErrorCodes
::
LOGICAL_ERROR
);
MarkRange
&
range
=
part
.
ranges
.
back
();
size_t
marks_in_range
=
range
.
end
-
range
.
begin
;
size_t
marks_to_get_from_range
=
std
::
min
(
marks_in_range
,
need_marks
);
ranges_to_get_from_part
.
push_back
(
MarkRange
(
range
.
begin
,
range
.
begin
+
marks_to_get_from_range
));
const
size_t
marks_in_range
=
range
.
end
-
range
.
begin
;
const
size_t
marks_to_get_from_range
=
std
::
min
(
marks_in_range
,
need_marks
);
ranges_to_get_from_part
.
emplace_back
(
range
.
begin
,
range
.
begin
+
marks_to_get_from_range
);
range
.
begin
+=
marks_to_get_from_range
;
marks_in_part
-=
marks_to_get_from_range
;
need_marks
-=
marks_to_get_from_range
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录