-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add logs and stats in DeleteScheduler #6927
Add logs and stats in DeleteScheduler #6927
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akankshamahajan15 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
46fe435
to
af4a91a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akankshamahajan15 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @akankshamahajan15 for working on this. Left a few minor comments.
file/delete_scheduler_test.cc
Outdated
@@ -318,8 +330,9 @@ TEST_F(DeleteSchedulerTest, DisableRateLimiting) { | |||
|
|||
rate_bytes_per_sec_ = 0; | |||
NewDeleteScheduler(); | |||
int num_files = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
constexpr int num_files = 10;
file/delete_scheduler.h
Outdated
@@ -83,6 +83,8 @@ class DeleteScheduler { | |||
static Status CleanupDirectory(Env* env, SstFileManagerImpl* sfm, | |||
const std::string& path); | |||
|
|||
void SetStatisticsPtr(std::shared_ptr<Statistics> stats) { stats_ = stats; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the type of the argument can be const std::shared_ptr<Statistics>&
.
file/sst_file_manager_impl.h
Outdated
@@ -135,6 +135,11 @@ class SstFileManagerImpl : public SstFileManager { | |||
// once in the object's lifetime, and before the destructor | |||
void Close(); | |||
|
|||
void SetStatisticsPtr(std::shared_ptr<Statistics> stats) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const std::shared_ptr<Statistics>&
.
@@ -65,24 +65,36 @@ Status DeleteScheduler::DeleteFile(const std::string& file_path, | |||
s = fs_->DeleteFile(file_path, IOOptions(), nullptr); | |||
if (s.ok()) { | |||
sst_file_manager_->OnDeleteFile(file_path); | |||
ROCKS_LOG_INFO(info_log_, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can print a message during db start, similar to the following:
SstFileManager instance: <addr in hex>
file/delete_scheduler.cc
Outdated
while (!closing_ && !cv_.TimedWait(start_time + total_penlty)) {} | ||
ROCKS_LOG_INFO( | ||
info_log_, | ||
"Rate limiting is enabled with penalty %lu after deleting file %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use PRIi64
, PRIu64
and ROCKSDB_PRIszt
to print 64-bit signed integers, 64-bit unsigned, size_t-reps.
af4a91a
to
54e7c61
Compare
@akankshamahajan15 has updated the pull request. Re-import the pull request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akankshamahajan15 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Addressed comments |
file/delete_scheduler.cc
Outdated
@@ -39,6 +40,7 @@ DeleteScheduler::DeleteScheduler(Env* env, FileSystem* fs, | |||
assert(sst_file_manager != nullptr); | |||
assert(max_trash_db_ratio >= 0); | |||
MaybeCreateBackgroundThread(); | |||
ROCKS_LOG_INFO(info_log_, "SstFileManager instance: %p", sst_file_manager); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the previous confusion. Maybe move this to DBImpl::Open()
?
@@ -135,6 +135,11 @@ class SstFileManagerImpl : public SstFileManager { | |||
// once in the object's lifetime, and before the destructor | |||
void Close(); | |||
|
|||
void SetStatisticsPtr(const std::shared_ptr<Statistics>& stats) override { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should call this function in when we open the db.
db/db_sst_test.cc
Outdated
ASSERT_EQ( | ||
4, options.statistics.get()->getAndResetTickerCount(FILES_MARKED_TRASH)); | ||
ASSERT_EQ(0, options.statistics.get()->getAndResetTickerCount( | ||
FILES_DELETED_IMMEDIATELY)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: options.statistics-> suffices.
Summary: Add logs and stats for files marked as trash and files deleted immediately in DeleteScheduler Test Plan: make check -j64 Reviewers: Subscribers: Tasks: T67391953 Tags:
54e7c61
to
9bf4fe5
Compare
@akankshamahajan15 has updated the pull request. Re-import the pull request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akankshamahajan15 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @akankshamahajan15 for the PR
@akankshamahajan15 merged this pull request in 2677bd5. |
This seems to cause this TSAN failure:
@akankshamahajan15 can you fix it? |
Yes. I will fix this. Thanks. |
Summary: Add logs and stats for files marked as trash and files deleted immediately in DeleteScheduler Pull Request resolved: facebook/rocksdb#6927 Test Plan: make check -j64 Reviewed By: riversand963 Differential Revision: D21869068 Pulled By: akankshamahajan15 fbshipit-source-id: e9f673c4fa8049ce648b23c75d742f2f9c6c57a1 Signed-off-by: Changlong Chen <levisonchen@live.cn>
Summary: Add logs and stats for files marked as trash and files deleted immediately in DeleteScheduler Pull Request resolved: facebook/rocksdb#6927 Test Plan: make check -j64 Reviewed By: riversand963 Differential Revision: D21869068 Pulled By: akankshamahajan15 fbshipit-source-id: e9f673c4fa8049ce648b23c75d742f2f9c6c57a1 Signed-off-by: Changlong Chen <levisonchen@live.cn>
Summary: Add logs and stats for files marked as trash and files deleted immediately in DeleteScheduler
Test Plan: make check -j64
Reviewers:
Subscribers:
Tasks: T67391953
Tags: