-
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
dynamic setting of stats_dump_period_sec through SetDBOption() #2004
Conversation
@raza15 updated the pull request - view changes |
@yiwu-arbug 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.
Thank you for your contribution! See comments inline.
HISTORY.md
Outdated
@@ -44,6 +44,7 @@ | |||
* Support dynamically change `delayed_write_rate` and `max_total_wal_size` options via SetDBOptions(). | |||
* Introduce DB::DeleteRange for optimized deletion of large ranges of contiguous keys. | |||
* Support dynamically change `delayed_write_rate` option via SetDBOptions(). | |||
* Support dynamically change `stats_dump_period_sec` option via SetDBOptions(). |
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.
Please add the changelog to Unreleased section, which will be included in next release.
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.
Done
@@ -94,6 +93,7 @@ struct MutableDBOptions { | |||
uint64_t delayed_write_rate; | |||
uint64_t max_total_wal_size; | |||
uint64_t delete_obsolete_files_period_micros; | |||
unsigned int stats_dump_period_sec; |
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.
Remove the same field from ImmutableDBOptions.
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 this is done. Please tell me if i'm wrong.
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.
My bad. I don't know why I didn't see the change.
db/db_impl.cc
Outdated
@@ -618,12 +618,12 @@ static void DumpMallocStats(std::string* stats) { | |||
#endif // !ROCKSDB_LITE | |||
|
|||
void DBImpl::MaybeDumpStats() { | |||
if (immutable_db_options_.stats_dump_period_sec == 0) return; | |||
if (mutable_db_options_.stats_dump_period_sec == 0) return; |
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.
mutable_db_options_ is guarded by DBImpl::mutex_ but MaybeDumpStats() is called without holding mutex. So there will be race condition on the option if another thread call SetDBOptions. You need to lock the mutex, get the value of stats_dump_period_sec, and unlock mutex to finish the rest of work here.
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.
Done.
@raza15 updated the pull request - view changes - changes since last import |
@raza15 updated the pull request - view changes - changes since last import |
@yiwu-arbug please see the updated PR |
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.
Looking good! Please run make format
to clang-format the code. And can you also include the java comment change? Thanks.
HISTORY.md
Outdated
@@ -1,5 +1,6 @@ | |||
# Rocksdb Change Log | |||
## Unreleased | |||
* Support dynamically change `stats_dump_period_sec` option via SetDBOptions(). |
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.
Add "### Public API Change"
@@ -94,6 +93,7 @@ struct MutableDBOptions { | |||
uint64_t delayed_write_rate; | |||
uint64_t max_total_wal_size; | |||
uint64_t delete_obsolete_files_period_micros; | |||
unsigned int stats_dump_period_sec; |
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.
My bad. I don't know why I didn't see the change.
@raza15 updated the pull request - view changes - changes since last import |
@yiwu-arbug has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Tests looking good. The only travis failure looks unrelated. @raza15 can you run |
@yiwu-arbug I am getting the following error when I run
I have downloaded clang-format-diff.py and put it in my path directory. I have also installed clang. But I still get the error. Do you know how to solve this? (On both Ubuntu and mac OS X it is giving the same error) |
No idea :( You can apply this command directly: |
@raza15 updated the pull request - view changes - changes since last import |
@yiwu-arbug updated the PR after successfully running |
@yiwu-arbug has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Merging. Thank you again for the contribution! |
Resolved the following issue: #1930