Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
indiff7643
Terarkdb
提交
14c57164
T
Terarkdb
项目概览
indiff7643
/
Terarkdb
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Terarkdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
14c57164
编写于
9月 14, 2020
作者:
Z
ZhaoMing
提交者:
guokuankuan
9月 18, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix FlushLargest write stop
上级
8bae0769
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
16 addition
and
8 deletion
+16
-8
db/column_family.cc
db/column_family.cc
+2
-2
db/column_family.h
db/column_family.h
+7
-3
db/db_impl.cc
db/db_impl.cc
+1
-0
db/db_impl_compaction_flush.cc
db/db_impl_compaction_flush.cc
+3
-0
db/db_impl_write.cc
db/db_impl_write.cc
+3
-3
未找到文件。
db/column_family.cc
浏览文件 @
14c57164
...
...
@@ -455,7 +455,7 @@ ColumnFamilyData::ColumnFamilyData(
log_number_
(
0
),
flush_reason_
(
FlushReason
::
kOthers
),
column_family_set_
(
column_family_set
),
queued_for_flush_
(
false
),
queued_for_flush_
(
0
),
queued_for_compaction_
(
false
),
queued_for_garbage_collection_
(
false
),
prev_compaction_needed_bytes_
(
0
),
...
...
@@ -533,7 +533,7 @@ ColumnFamilyData::~ColumnFamilyData() {
// It would be wrong if this ColumnFamilyData is in flush_queue_ or
// compaction_queue_ and we destroyed it
assert
(
!
queued_for_flush_
);
assert
(
queued_for_flush_
==
0
);
assert
(
!
queued_for_compaction_
);
assert
(
!
queued_for_garbage_collection_
);
...
...
db/column_family.h
浏览文件 @
14c57164
...
...
@@ -360,12 +360,16 @@ class ColumnFamilyData {
void
ResetThreadLocalSuperVersions
();
// Protected by DB mutex
void
set_queued_for_flush
(
bool
value
)
{
queued_for_flush_
=
value
;
}
void
inc_queued_for_flush
()
{
++
queued_for_flush_
;
}
void
dec_queued_for_flush
()
{
--
queued_for_flush_
;
assert
(
queued_for_flush_
>=
0
);
}
void
set_queued_for_compaction
(
bool
value
)
{
queued_for_compaction_
=
value
;
}
void
set_queued_for_garbage_collection
(
bool
value
)
{
queued_for_garbage_collection_
=
value
;
}
bool
queued_for_flush
()
{
return
queued_for_flush_
;
}
bool
queued_for_flush
()
{
return
queued_for_flush_
>
0
;
}
bool
queued_for_compaction
()
{
return
queued_for_compaction_
;
}
bool
queued_for_garbage_collection
()
{
return
queued_for_garbage_collection_
;
...
...
@@ -477,7 +481,7 @@ class ColumnFamilyData {
std
::
unique_ptr
<
WriteControllerToken
>
write_controller_token_
;
// If true --> this ColumnFamily is currently present in DBImpl::flush_queue_
bool
queued_for_flush_
;
int
queued_for_flush_
;
// If true --> this ColumnFamily is currently present in
// DBImpl::compaction_queue_
...
...
db/db_impl.cc
浏览文件 @
14c57164
...
...
@@ -583,6 +583,7 @@ Status DBImpl::CloseHelper() {
const
FlushRequest
&
flush_req
=
PopFirstFromFlushQueue
();
for
(
const
auto
&
iter
:
flush_req
)
{
ColumnFamilyData
*
cfd
=
iter
.
first
;
cfd
->
dec_queued_for_flush
();
if
(
cfd
->
Unref
())
{
delete
cfd
;
}
...
...
db/db_impl_compaction_flush.cc
浏览文件 @
14c57164
...
...
@@ -2009,6 +2009,7 @@ void DBImpl::SchedulePendingFlush(const FlushRequest& flush_req,
ColumnFamilyData
*
cfd
=
iter
.
first
;
cfd
->
Ref
();
cfd
->
SetFlushReason
(
flush_reason
);
cfd
->
inc_queued_for_flush
();
}
unscheduled_flushes_
+=
static_cast
<
int
>
(
flush_req
.
size
());
flush_queue_
.
push_back
(
flush_req
);
...
...
@@ -2132,6 +2133,7 @@ Status DBImpl::BackgroundFlush(bool* made_progress, JobContext* job_context,
if
(
cfd
->
IsDropped
()
||
!
cfd
->
imm
()
->
IsFlushPending
())
{
// can't flush this CF, try next one
if
(
cfd
->
Unref
())
{
cfd
->
dec_queued_for_flush
();
delete
cfd
;
}
continue
;
...
...
@@ -2166,6 +2168,7 @@ Status DBImpl::BackgroundFlush(bool* made_progress, JobContext* job_context,
*
reason
=
bg_flush_args
[
0
].
cfd_
->
GetFlushReason
();
for
(
auto
&
arg
:
bg_flush_args
)
{
ColumnFamilyData
*
cfd
=
arg
.
cfd_
;
cfd
->
dec_queued_for_flush
();
if
(
cfd
->
Unref
())
{
delete
cfd
;
arg
.
cfd_
=
nullptr
;
...
...
db/db_impl_write.cc
浏览文件 @
14c57164
...
...
@@ -1180,14 +1180,14 @@ Status DBImpl::HandleWriteBufferFull(WriteContext* write_context) {
if
(
!
cfd
->
mem
()
->
IsEmpty
())
{
// We only consider active mem table, hoping immutable memtable is
// already in the process of flushing.
if
(
immutable_db_options_
.
write_buffer_
flush_pri
==
kFlushOldest
)
{
if
(
flush_pri
==
kFlushOldest
)
{
uint64_t
seq
=
cfd
->
mem
()
->
GetCreationSeq
();
if
(
cfd_picked
==
nullptr
||
seq
<
seq_num_for_cf_picked
)
{
cfd_picked
=
cfd
;
seq_num_for_cf_picked
=
seq
;
}
}
else
{
assert
(
immutable_db_options_
.
write_buffer_
flush_pri
==
kFlushLargest
);
}
else
if
(
!
cfd
->
queued_for_flush
())
{
assert
(
flush_pri
==
kFlushLargest
);
size_t
cfd_size
=
cfd
->
mem
()
->
ApproximateMemoryUsage
();
if
(
cfd_picked
==
nullptr
||
cfd_size
>
largest_cfd_size
)
{
cfd_picked
=
cfd
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录