-
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
Don't take archived log size into account when calculating log size for flush #12680
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.
Could you update
// log_size_for_flush: if the total log file size is equal or larger than |
Please also add a unit test to verify this behavior.
67d70de
to
e975dd1
Compare
@hx235 thx for review🙏🏻 |
8b4824c
to
e284e38
Compare
@ajkr has imported this pull request. If you are a Meta 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.
Looks great, thank you very much!
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( | ||
"DBImpl::FlushForGetLiveFiles", [&](void*) { flushed = true; }); |
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.
The use of SyncPoint here is a little excessive, but OK. One downside of SyncPoint is that it's error-prone - the string name could have typo and that could make the test accidentally pass. Another downside is it's low-level - there could be a different code path flushing the memtable.
The more conventional alternative would be to check NumTableFilesAtLevel(0)
is the same before and after the checkpoint. You could even make that a little bit more robust by setting disable_auto_compactions=true
to prevent compaction out of L0.
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.
thx for advice, updated it
@HypenZou has updated the pull request. You must reimport the pull request before landing. |
@ajkr has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
daa2769
to
c5f502a
Compare
@HypenZou has updated the pull request. You must reimport the pull request before landing. |
c5f502a
to
1102c1d
Compare
@HypenZou has updated the pull request. You must reimport the pull request before landing. |
@ajkr has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Context/Summary:
It seems unreasonable to take the archived log size into account when calculating log size for flush in method CreateCheckpoint. If the user sets WAL_ttl_seconds or WAL_size_limit_MB, the argument log_size_for_flush can easily be reached due to the size of the archived dir. As a result, the flush may always be triggered.
Test
corverd by ./checkpoint_test