Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
indiff7643
Terarkdb
提交
f85deb26
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,发现更多精彩内容 >>
提交
f85deb26
编写于
1月 20, 2021
作者:
U
ustcwelcome
提交者:
奏之章
2月 08, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bug] bug-fix and it's a runnable version for myrocks (#5)
上级
d341588b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
19 deletion
+41
-19
db/compaction_job.cc
db/compaction_job.cc
+19
-10
db/db_impl.cc
db/db_impl.cc
+9
-8
db/flush_job.cc
db/flush_job.cc
+7
-0
db/version_set.cc
db/version_set.cc
+6
-1
未找到文件。
db/compaction_job.cc
浏览文件 @
f85deb26
...
...
@@ -880,13 +880,22 @@ Status CompactionJob::Run() {
output
.
meta
.
prop
.
read_amp
=
tp
->
read_amp
;
output
.
meta
.
prop
.
dependence
=
tp
->
dependence
;
output
.
meta
.
prop
.
inheritance_chain
=
tp
->
inheritance_chain
;
output
.
meta
.
prop
.
ratio_expire_time
=
tp
->
ratio_expire_time
;
output
.
meta
.
prop
.
scan_gap_expire_time
=
tp
->
scan_gap_expire_time
;
// ROCKS_LOG_INFO(db_options_.info_log,
// "ratio:%" PRIu64 ", scan:%" PRIu64,
// tp->ratio_expire_time, tp->scan_gap_expire_time);
output
.
finished
=
true
;
c
->
AddOutputTableFileNumber
(
file_number
);
if
(
iopt
->
ttl_extractor_factory
!=
nullptr
)
{
output
.
meta
.
prop
.
ratio_expire_time
=
DecodeFixed64
(
tp
->
user_collected_properties
.
find
(
TablePropertiesNames
::
kEarliestTimeBeginCompact
)
->
second
.
c_str
());
output
.
meta
.
prop
.
scan_gap_expire_time
=
DecodeFixed64
(
tp
->
user_collected_properties
.
find
(
TablePropertiesNames
::
kLatestTimeEndCompact
)
->
second
.
c_str
());
ROCKS_LOG_INFO
(
db_options_
.
info_log
,
"compaction_run ratio:%"
PRIu64
", scan:%"
PRIu64
,
output
.
meta
.
prop
.
ratio_expire_time
,
output
.
meta
.
prop
.
scan_gap_expire_time
);
output
.
finished
=
true
;
c
->
AddOutputTableFileNumber
(
file_number
);
}
}
if
(
s
.
ok
())
{
sub_compact
.
actual_start
=
std
::
move
(
result
.
actual_start
);
...
...
@@ -2122,9 +2131,9 @@ Status CompactionJob::FinishCompactionOutputFile(
DecodeFixed64
(
tp
.
user_collected_properties
.
find
(
TablePropertiesNames
::
kLatestTimeEndCompact
)
->
second
.
c_str
());
ROCKS_LOG_INFO
(
db_options_
.
info_log
,
"ratio:%"
PRIu64
", scan:%"
PRIu64
,
meta
->
prop
.
ratio_expire_time
,
meta
->
prop
.
scan_gap_expire_time
);
ROCKS_LOG_INFO
(
db_options_
.
info_log
,
"fcof: ratio:%"
PRIu64
", scan:%"
PRIu64
,
meta
->
prop
.
ratio_expire_time
,
meta
->
prop
.
scan_gap_expire_time
);
}
}
...
...
db/db_impl.cc
浏览文件 @
f85deb26
...
...
@@ -893,17 +893,17 @@ void DBImpl::ScheduleTtlGC() {
LogBuffer
log_buffer_debug
(
InfoLogLevel
::
DEBUG_LEVEL
,
immutable_db_options_
.
info_log
.
get
());
auto
should_marked_for_compacted
=
[
&
](
uint64_t
file_number
,
auto
should_marked_for_compacted
=
[
&
](
int
level
,
uint64_t
file_number
,
uint64_t
ratio_expire_time
,
uint64_t
scan_gap_expire_time
,
uint64_t
now
)
{
bool
should_mark
=
std
::
min
(
ratio_expire_time
,
scan_gap_expire_time
)
<=
now
;
if
(
should_mark
)
{
ROCKS_LOG_BUFFER
(
&
log_buffer_info
,
"SST Table property
id = %"
PRIu64
", info : (
%"
PRIu64
" , %"
PRIu64
") now = %"
PRIu64
,
file_number
,
ratio_expire_time
,
scan_gap
_expire_time
,
now
);
"SST Table property
level=%d file-id =
%"
PRIu64
"
, info : (%"
PRIu64
"
, %"
PRIu64
") now = %"
PRIu64
,
level
,
file_number
,
ratio
_expire_time
,
scan_gap_expire_time
,
now
);
}
return
should_mark
;
};
...
...
@@ -920,20 +920,21 @@ void DBImpl::ScheduleTtlGC() {
VersionStorageInfo
*
vstorage
=
cfd
->
current
()
->
storage_info
();
for
(
int
l
=
0
;
l
<
vstorage
->
num_non_empty_levels
();
l
++
)
{
for
(
auto
meta
:
vstorage
->
LevelFiles
(
l
))
{
++
total_cnt
;
mark_count
+=
meta
->
marked_for_compaction
;
if
(
meta
->
being_compacted
)
{
continue
;
}
++
total_cnt
;
marked_count
+=
meta
->
marked_for_compaction
;
TEST_SYNC_POINT
(
"DBImpl:Exist-SST"
);
if
(
!
meta
->
marked_for_compaction
&&
should_marked_for_compacted
(
meta
->
fd
.
GetNumber
(),
meta
->
prop
.
ratio_expire_time
,
l
,
meta
->
fd
.
GetNumber
(),
meta
->
prop
.
ratio_expire_time
,
meta
->
prop
.
scan_gap_expire_time
,
nowSeconds
))
{
meta
->
marked_for_compaction
=
true
;
vstorage
->
AddFilesMarkedForCompaction
(
l
,
meta
);
}
if
(
meta
->
marked_for_compaction
)
{
mark_count
++
;
TEST_SYNC_POINT
(
"DBImpl:ScheduleTtlGC-mark"
);
}
}
...
...
db/flush_job.cc
浏览文件 @
f85deb26
...
...
@@ -384,6 +384,13 @@ Status FlushJob::WriteLevel0Table() {
TableFileCreationReason
::
kFlush
,
event_logger_
,
job_context_
->
job_id
,
Env
::
IO_HIGH
,
&
table_properties_
,
0
/* level */
,
flush_load_
,
current_time
,
oldest_key_time
,
write_hint
);
if
(
cfd_
->
ioptions
()
->
ttl_extractor_factory
!=
nullptr
)
{
ROCKS_LOG_INFO
(
db_options_
.
info_log
,
"Flush: ratio:%"
PRIu64
", scan:%"
PRIu64
,
meta_
[
0
].
prop
.
ratio_expire_time
,
meta_
[
0
].
prop
.
scan_gap_expire_time
);
}
LogFlush
(
db_options_
.
info_log
);
}
ROCKS_LOG_INFO
(
db_options_
.
info_log
,
...
...
db/version_set.cc
浏览文件 @
f85deb26
...
...
@@ -1814,7 +1814,12 @@ void VersionStorageInfo::ComputeFilesMarkedForCompaction() {
void
VersionStorageInfo
::
AddFilesMarkedForCompaction
(
int
level
,
FileMetaData
*
meta
)
{
files_marked_for_compaction_
.
emplace_back
(
level
,
meta
);
if
(
level
<
num_non_empty_levels_
-
1
)
{
files_marked_for_compaction_
.
emplace_back
(
level
,
meta
);
}
else
{
assert
(
level
==
num_non_empty_levels_
-
1
);
bottommost_files_marked_for_compaction_
.
emplace_back
(
level
,
meta
);
}
}
void
VersionStorageInfo
::
ComputeExpiredTtlFiles
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录