Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
07d8db9f
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,发现更多精彩内容 >>
提交
07d8db9f
编写于
3月 03, 2018
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Explicit semantic for TSan [#CLICKHOUSE-2]
上级
368f46d7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
10 deletion
+12
-10
dbms/src/Storages/MergeTree/MergeTreeData.cpp
dbms/src/Storages/MergeTree/MergeTreeData.cpp
+9
-7
dbms/src/Storages/MergeTree/MergeTreeDataPart.h
dbms/src/Storages/MergeTree/MergeTreeDataPart.h
+1
-1
dbms/src/Storages/System/StorageSystemParts.cpp
dbms/src/Storages/System/StorageSystemParts.cpp
+1
-1
dbms/src/Storages/System/StorageSystemPartsColumns.cpp
dbms/src/Storages/System/StorageSystemPartsColumns.cpp
+1
-1
未找到文件。
dbms/src/Storages/MergeTree/MergeTreeData.cpp
浏览文件 @
07d8db9f
...
...
@@ -561,7 +561,7 @@ void MergeTreeData::loadDataParts(bool skip_sanity_checks)
auto
deactivate_part
=
[
&
]
(
DataPartIteratorByStateAndInfo
it
)
{
(
*
it
)
->
remove_time
=
(
*
it
)
->
modification_time
;
(
*
it
)
->
remove_time
.
store
((
*
it
)
->
modification_time
,
std
::
memory_order_relaxed
)
;
modifyPartState
(
it
,
DataPartState
::
Outdated
);
};
...
...
@@ -677,9 +677,11 @@ MergeTreeData::DataPartsVector MergeTreeData::grabOldParts()
{
const
DataPartPtr
&
part
=
*
it
;
auto
part_remove_time
=
part
->
remove_time
.
load
(
std
::
memory_order_relaxed
);
if
(
part
.
unique
()
&&
/// Grab only parts that are not used by anyone (SELECTs for example).
part
->
remove_time
<
now
&&
now
-
part
->
remove_time
>
settings
.
old_parts_lifetime
.
totalSeconds
())
part
_
remove_time
<
now
&&
now
-
part
_
remove_time
>
settings
.
old_parts_lifetime
.
totalSeconds
())
{
parts_to_delete
.
emplace_back
(
it
);
}
...
...
@@ -1519,7 +1521,7 @@ MergeTreeData::DataPartsVector MergeTreeData::renameTempPartAndReplace(
auto
current_time
=
time
(
nullptr
);
for
(
const
DataPartPtr
&
covered_part
:
covered_parts
)
{
covered_part
->
remove_time
=
current_time
;
covered_part
->
remove_time
.
store
(
current_time
,
std
::
memory_order_relaxed
)
;
modifyPartState
(
covered_part
,
DataPartState
::
Outdated
);
removePartContributionToColumnSizes
(
covered_part
);
}
...
...
@@ -1550,7 +1552,7 @@ void MergeTreeData::removePartsFromWorkingSet(const DataPartsVector & remove, bo
removePartContributionToColumnSizes
(
part
);
modifyPartState
(
part
,
DataPartState
::
Outdated
);
part
->
remove_time
=
remove_time
;
part
->
remove_time
.
store
(
remove_time
,
std
::
memory_order_relaxed
)
;
}
}
...
...
@@ -2175,7 +2177,7 @@ MergeTreeData::DataPartsVector MergeTreeData::Transaction::commit()
LOG_WARNING
(
data
->
log
,
"Tried to commit obsolete part "
<<
part
->
name
<<
" covered by "
<<
covering_part
->
getNameWithState
());
part
->
remove_time
=
0
;
/// The part will be removed without waiting for old_parts_lifetime seconds.
part
->
remove_time
.
store
(
0
,
std
::
memory_order_relaxed
)
;
/// The part will be removed without waiting for old_parts_lifetime seconds.
data
->
modifyPartState
(
part
,
DataPartState
::
Outdated
);
}
else
...
...
@@ -2183,7 +2185,7 @@ MergeTreeData::DataPartsVector MergeTreeData::Transaction::commit()
total_covered_parts
.
insert
(
total_covered_parts
.
end
(),
covered_parts
.
begin
(),
covered_parts
.
end
());
for
(
const
DataPartPtr
&
covered_part
:
covered_parts
)
{
covered_part
->
remove_time
=
current_time
;
covered_part
->
remove_time
.
store
(
current_time
,
std
::
memory_order_relaxed
)
;
data
->
modifyPartState
(
covered_part
,
DataPartState
::
Outdated
);
data
->
removePartContributionToColumnSizes
(
covered_part
);
}
...
...
dbms/src/Storages/MergeTree/MergeTreeDataPart.h
浏览文件 @
07d8db9f
...
...
@@ -139,7 +139,7 @@ struct MergeTreeDataPart
std
::
atomic
<
UInt64
>
size_in_bytes
{
0
};
/// size in bytes, 0 - if not counted;
/// is used from several threads without locks (it is changed with ALTER).
time_t
modification_time
=
0
;
mutable
time_t
remove_time
=
std
::
numeric_limits
<
time_t
>::
max
();
/// When the part is removed from the working set
.
mutable
std
::
atomic
<
time_t
>
remove_time
{
std
::
numeric_limits
<
time_t
>::
max
()
};
/// When the part is removed from the working set. Changes once
.
/// If true, the destructor will delete the directory with the part.
bool
is_temp
=
false
;
...
...
dbms/src/Storages/System/StorageSystemParts.cpp
浏览文件 @
07d8db9f
...
...
@@ -66,7 +66,7 @@ void StorageSystemParts::processNextStorage(MutableColumns & columns, const Stor
columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
part
->
rows_count
));
columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
part
->
size_in_bytes
));
columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
part
->
modification_time
));
columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
part
->
remove_time
));
columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
part
->
remove_time
.
load
(
std
::
memory_order_relaxed
)
));
/// For convenience, in returned refcount, don't add references that was due to local variables in this method: all_parts, active_parts.
columns
[
i
++
]
->
insert
(
static_cast
<
UInt64
>
(
part
.
use_count
()
-
1
));
...
...
dbms/src/Storages/System/StorageSystemPartsColumns.cpp
浏览文件 @
07d8db9f
...
...
@@ -112,7 +112,7 @@ void StorageSystemPartsColumns::processNextStorage(MutableColumns & columns, con
columns
[
j
++
]
->
insert
(
static_cast
<
UInt64
>
(
part
->
rows_count
));
columns
[
j
++
]
->
insert
(
static_cast
<
UInt64
>
(
part
->
size_in_bytes
));
columns
[
j
++
]
->
insert
(
static_cast
<
UInt64
>
(
part
->
modification_time
));
columns
[
j
++
]
->
insert
(
static_cast
<
UInt64
>
(
part
->
remove_time
));
columns
[
j
++
]
->
insert
(
static_cast
<
UInt64
>
(
part
->
remove_time
.
load
(
std
::
memory_order_relaxed
)
));
columns
[
j
++
]
->
insert
(
static_cast
<
UInt64
>
(
use_count
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录