Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
3bee98c6
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,发现更多精彩内容 >>
提交
3bee98c6
编写于
7月 12, 2020
作者:
A
Azat Khuzhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix lifetime_bytes/lifetime_rows for Buffer direct block write
上级
32a45d0d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
12 deletion
+14
-12
src/Storages/StorageBuffer.cpp
src/Storages/StorageBuffer.cpp
+5
-5
src/Storages/StorageBuffer.h
src/Storages/StorageBuffer.h
+6
-7
tests/queries/0_stateless/00753_system_columns_and_system_tables.reference
...tateless/00753_system_columns_and_system_tables.reference
+1
-0
tests/queries/0_stateless/00753_system_columns_and_system_tables.sql
...es/0_stateless/00753_system_columns_and_system_tables.sql
+2
-0
未找到文件。
src/Storages/StorageBuffer.cpp
浏览文件 @
3bee98c6
...
...
@@ -279,7 +279,7 @@ Pipes StorageBuffer::read(
}
static
void
appendBlock
(
StorageBuffer
::
LifeTimeWrites
&
writes
,
const
Block
&
from
,
Block
&
to
)
static
void
appendBlock
(
const
Block
&
from
,
Block
&
to
)
{
if
(
!
to
)
throw
Exception
(
"Cannot append to empty block"
,
ErrorCodes
::
LOGICAL_ERROR
);
...
...
@@ -295,9 +295,6 @@ static void appendBlock(StorageBuffer::LifeTimeWrites &writes, const Block & fro
CurrentMetrics
::
add
(
CurrentMetrics
::
StorageBufferRows
,
rows
);
CurrentMetrics
::
add
(
CurrentMetrics
::
StorageBufferBytes
,
bytes
);
writes
.
rows
+=
rows
;
writes
.
bytes
+=
bytes
;
size_t
old_rows
=
to
.
rows
();
auto
temporarily_disable_memory_tracker
=
getCurrentMemoryTrackerActionLock
();
...
...
@@ -371,6 +368,9 @@ public:
size_t
bytes
=
block
.
bytes
();
storage
.
writes
.
rows
+=
rows
;
storage
.
writes
.
bytes
+=
bytes
;
/// If the block already exceeds the maximum limit, then we skip the buffer.
if
(
rows
>
storage
.
max_thresholds
.
rows
||
bytes
>
storage
.
max_thresholds
.
bytes
)
{
...
...
@@ -449,7 +449,7 @@ private:
if
(
!
buffer
.
first_write_time
)
buffer
.
first_write_time
=
current_time
;
appendBlock
(
s
torage
.
writes
,
s
orted_block
,
buffer
.
data
);
appendBlock
(
sorted_block
,
buffer
.
data
);
}
};
...
...
src/Storages/StorageBuffer.h
浏览文件 @
3bee98c6
...
...
@@ -51,12 +51,6 @@ public:
size_t
rows
;
/// The number of rows in the block.
size_t
bytes
;
/// The number of (uncompressed) bytes in the block.
};
/// Lifetime
struct
LifeTimeWrites
{
std
::
atomic
<
size_t
>
rows
=
0
;
std
::
atomic
<
size_t
>
bytes
=
0
;
};
std
::
string
getName
()
const
override
{
return
"Buffer"
;
}
...
...
@@ -125,7 +119,12 @@ private:
StorageID
destination_id
;
bool
allow_materialized
;
LifeTimeWrites
writes
;
/// Lifetime
struct
LifeTimeWrites
{
std
::
atomic
<
size_t
>
rows
=
0
;
std
::
atomic
<
size_t
>
bytes
=
0
;
}
writes
;
Poco
::
Logger
*
log
;
...
...
tests/queries/0_stateless/00753_system_columns_and_system_tables.reference
浏览文件 @
3bee98c6
...
...
@@ -38,3 +38,4 @@ Check lifetime_bytes/lifetime_rows for Buffer
100 50
200 100
200 100
402 201
tests/queries/0_stateless/00753_system_columns_and_system_tables.sql
浏览文件 @
3bee98c6
...
...
@@ -107,5 +107,7 @@ INSERT INTO check_system_tables SELECT * FROM numbers_mt(50);
SELECT
lifetime_bytes
,
lifetime_rows
FROM
system
.
tables
WHERE
name
=
'check_system_tables'
;
OPTIMIZE
TABLE
check_system_tables
;
-- flush
SELECT
lifetime_bytes
,
lifetime_rows
FROM
system
.
tables
WHERE
name
=
'check_system_tables'
;
INSERT
INTO
check_system_tables
SELECT
*
FROM
numbers_mt
(
101
);
-- direct block write (due to min_rows exceeded)
SELECT
lifetime_bytes
,
lifetime_rows
FROM
system
.
tables
WHERE
name
=
'check_system_tables'
;
DROP
TABLE
check_system_tables
;
DROP
TABLE
check_system_tables_null
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录