Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
d1e2bce4
R
rocksdb
项目概览
kvdb
/
rocksdb
11 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rocksdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d1e2bce4
编写于
4月 07, 2014
作者:
I
Igor Canadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CallFlushDuringCompaction
上级
b42ceb95
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
14 deletion
+33
-14
db/db_impl.cc
db/db_impl.cc
+26
-14
db/db_impl.h
db/db_impl.h
+7
-0
未找到文件。
db/db_impl.cc
浏览文件 @
d1e2bce4
...
...
@@ -2206,9 +2206,6 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress,
status
=
versions_
->
LogAndApply
(
c
->
column_family_data
(),
c
->
edit
(),
&
mutex_
,
db_directory_
.
get
());
InstallSuperVersion
(
c
->
column_family_data
(),
deletion_state
);
if
(
options_
.
allow_thread_local
)
{
c
->
column_family_data
()
->
ResetThreadLocalSuperVersions
();
}
Version
::
LevelSummaryStorage
tmp
;
LogToBuffer
(
log_buffer
,
"Moved #%lld to level-%d %lld bytes %s: %s
\n
"
,
...
...
@@ -2465,7 +2462,6 @@ Status DBImpl::InstallCompactionResults(CompactionState* compact,
db_directory_
.
get
());
}
//
// Given a sequence number, return the sequence number of the
// earliest snapshot that this sequence number is visible in.
// The snapshots themselves are arranged in ascending order of
...
...
@@ -2493,6 +2489,25 @@ inline SequenceNumber DBImpl::findEarliestVisibleSnapshot(
return
0
;
}
uint64_t
DBImpl
::
CallFlushDuringCompaction
(
ColumnFamilyData
*
cfd
,
DeletionState
&
deletion_state
,
LogBuffer
*
log_buffer
)
{
if
(
cfd
->
imm
()
->
imm_flush_needed
.
NoBarrier_Load
()
!=
nullptr
)
{
const
uint64_t
imm_start
=
env_
->
NowMicros
();
mutex_
.
Lock
();
if
(
cfd
->
imm
()
->
IsFlushPending
())
{
cfd
->
Ref
();
FlushMemTableToOutputFile
(
cfd
,
nullptr
,
deletion_state
,
log_buffer
);
cfd
->
Unref
();
bg_cv_
.
SignalAll
();
// Wakeup MakeRoomForWrite() if necessary
}
mutex_
.
Unlock
();
log_buffer
->
FlushBufferToLog
();
return
env_
->
NowMicros
()
-
imm_start
;
}
return
0
;
}
Status
DBImpl
::
ProcessKeyValueCompaction
(
SequenceNumber
visible_at_tip
,
SequenceNumber
earliest_snapshot
,
...
...
@@ -2535,16 +2550,7 @@ Status DBImpl::ProcessKeyValueCompaction(
// TODO(icanadi) this currently only checks if flush is necessary on
// compacting column family. we should also check if flush is necessary on
// other column families, too
if
(
cfd
->
imm
()
->
imm_flush_needed
.
NoBarrier_Load
()
!=
nullptr
)
{
const
uint64_t
imm_start
=
env_
->
NowMicros
();
mutex_
.
Lock
();
if
(
cfd
->
imm
()
->
IsFlushPending
())
{
FlushMemTableToOutputFile
(
cfd
,
nullptr
,
deletion_state
,
log_buffer
);
bg_cv_
.
SignalAll
();
// Wakeup MakeRoomForWrite() if necessary
}
mutex_
.
Unlock
();
imm_micros
+=
(
env_
->
NowMicros
()
-
imm_start
);
}
imm_micros
+=
CallFlushDuringCompaction
(
cfd
,
deletion_state
,
log_buffer
);
Slice
key
;
Slice
value
;
...
...
@@ -2944,6 +2950,12 @@ Status DBImpl::DoCompactionWork(CompactionState* compact,
if
(
compaction_filter_v2
)
{
while
(
backup_input
->
Valid
()
&&
!
shutting_down_
.
Acquire_Load
()
&&
!
cfd
->
IsDropped
())
{
// FLUSH preempts compaction
// TODO(icanadi) this currently only checks if flush is necessary on
// compacting column family. we should also check if flush is necessary on
// other column families, too
imm_micros
+=
CallFlushDuringCompaction
(
cfd
,
deletion_state
,
log_buffer
);
Slice
key
=
backup_input
->
key
();
Slice
value
=
backup_input
->
value
();
...
...
db/db_impl.h
浏览文件 @
d1e2bce4
...
...
@@ -343,6 +343,13 @@ class DBImpl : public DB {
DeletionState
&
deletion_state
,
LogBuffer
*
log_buffer
);
// This function is called as part of compaction. It enables Flush process to
// preempt compaction, since it's higher prioirty
// Returns: micros spent executing
uint64_t
CallFlushDuringCompaction
(
ColumnFamilyData
*
cfd
,
DeletionState
&
deletion_state
,
LogBuffer
*
log_buffer
);
// Call compaction filter if is_compaction_v2 is not true. Then iterate
// through input and compact the kv-pairs
Status
ProcessKeyValueCompaction
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录