Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
titan
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangzongwu
titan
Commits
ab0fa88d
Unverified
Commit
ab0fa88d
authored
Jun 24, 2019
by
Connor
Committed by
GitHub
Jun 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix version set log (#17)
* fix version set log Signed-off-by:
Connor1996
<
zbk602423539@gmail.com
>
parent
86d3e059
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
blob_gc_job.cc
src/blob_gc_job.cc
+14
-3
db_impl.cc
src/db_impl.cc
+7
-4
No files found.
src/blob_gc_job.cc
View file @
ab0fa88d
...
...
@@ -85,6 +85,10 @@ BlobGCJob::BlobGCJob(BlobGC* blob_gc, DB* db, port::Mutex* mutex,
stats_
(
stats
)
{}
BlobGCJob
::~
BlobGCJob
()
{
if
(
log_buffer_
)
{
log_buffer_
->
FlushBufferToLog
();
LogFlush
(
db_options_
.
info_log
.
get
());
}
// flush metrics
RecordTick
(
stats_
,
BLOB_DB_BYTES_READ
,
metrics_
.
blob_db_bytes_read
);
RecordTick
(
stats_
,
BLOB_DB_BYTES_WRITTEN
,
metrics_
.
blob_db_bytes_written
);
...
...
@@ -129,9 +133,6 @@ Status BlobGCJob::Run() {
blob_gc_
->
column_family_handle
()
->
GetName
().
c_str
(),
tmp
.
c_str
(),
tmp2
.
c_str
());
log_buffer_
->
FlushBufferToLog
();
LogFlush
(
db_options_
.
info_log
.
get
());
if
(
blob_gc_
->
sampled_inputs
().
empty
())
{
return
Status
::
OK
();
}
...
...
@@ -445,12 +446,22 @@ Status BlobGCJob::InstallOutputBlobFiles() {
std
::
vector
<
std
::
pair
<
std
::
shared_ptr
<
BlobFileMeta
>
,
std
::
unique_ptr
<
BlobFileHandle
>>>
files
;
std
::
string
tmp
;
for
(
auto
&
builder
:
this
->
blob_file_builders_
)
{
auto
file
=
std
::
make_shared
<
BlobFileMeta
>
(
builder
.
first
->
GetNumber
(),
builder
.
first
->
GetFile
()
->
GetFileSize
());
if
(
!
tmp
.
empty
())
{
tmp
.
append
(
" "
);
}
tmp
.
append
(
std
::
to_string
(
file
->
file_number
()));
blob_gc_
->
AddOutputFile
(
file
.
get
());
files
.
emplace_back
(
std
::
make_pair
(
file
,
std
::
move
(
builder
.
first
)));
}
ROCKS_LOG_BUFFER
(
log_buffer_
,
"[%s] output[%s]"
,
blob_gc_
->
column_family_handle
()
->
GetName
().
c_str
(),
tmp
.
c_str
());
this
->
blob_file_manager_
->
BatchFinishFiles
(
blob_gc_
->
column_family_handle
()
->
GetID
(),
files
);
}
else
{
...
...
src/db_impl.cc
View file @
ab0fa88d
...
...
@@ -130,7 +130,6 @@ TitanDBImpl::TitanDBImpl(const TitanDBOptions& options,
if
(
db_options_
.
statistics
!=
nullptr
)
{
stats_
.
reset
(
new
TitanStats
(
db_options_
.
statistics
.
get
()));
}
vset_
.
reset
(
new
VersionSet
(
db_options_
,
stats_
.
get
()));
blob_manager_
.
reset
(
new
FileManager
(
this
));
}
...
...
@@ -183,6 +182,13 @@ Status TitanDBImpl::Open(const std::vector<TitanCFDescriptor>& descs,
desc
.
options
.
disable_auto_compactions
=
true
;
}
db_options_
.
avoid_flush_during_recovery
=
true
;
// Add EventListener to collect statistics for GC
db_options_
.
listeners
.
emplace_back
(
std
::
make_shared
<
BaseDbListener
>
(
this
));
// Note that info log is initialized after `CreateLoggerFromOptions`,
// so new `VersionSet` here but not in constructor is to get a proper info
// log.
vset_
.
reset
(
new
VersionSet
(
db_options_
,
stats_
.
get
()));
s
=
DB
::
Open
(
db_options_
,
dbname_
,
init_descs
,
handles
,
&
db_
);
if
(
s
.
ok
())
{
for
(
size_t
i
=
0
;
i
<
descs
.
size
();
i
++
)
{
...
...
@@ -212,9 +218,6 @@ Status TitanDBImpl::Open(const std::vector<TitanCFDescriptor>& descs,
s
=
vset_
->
Open
(
column_families
);
if
(
!
s
.
ok
())
return
s
;
// Add EventListener to collect statistics for GC
db_options_
.
listeners
.
emplace_back
(
std
::
make_shared
<
BaseDbListener
>
(
this
));
static
bool
has_init_background_threads
=
false
;
if
(
!
has_init_background_threads
)
{
auto
low_pri_threads_num
=
env_
->
GetBackgroundThreads
(
Env
::
Priority
::
LOW
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment