-
Notifications
You must be signed in to change notification settings - Fork 21
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
Remove log store truncation from resource mg #620
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #620 +/- ##
==========================================
+ Coverage 56.51% 66.08% +9.56%
==========================================
Files 108 109 +1
Lines 10300 10982 +682
Branches 1402 1509 +107
==========================================
+ Hits 5821 7257 +1436
+ Misses 3894 3004 -890
- Partials 585 721 +136 ☔ View full report in Codecov by Sentry. |
ae7436a
to
348fa3a
Compare
e6b2adb
to
5bddd0d
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.
lgtm
Currently both resource_mgr and raft can call log store's truncate, but resource_mgr will not truncate logs whose lsn less than compact lsn. That means resource_mgr just re-truncate logs which will be / has been truncated in compact. But if resource_mgr and raft call truncate concurrently, crash will happen. So this commit remove it.
lsn, prev_lsn); | ||
RD_DBG_ASSERT(m_commit_upto_lsn.compare_exchange_strong(prev_lsn, lsn), | ||
"Raft Channel: unexpected log {} commited before config {} committed", prev_lsn, lsn); | ||
if (prev_lsn >= lsn || !m_commit_upto_lsn.compare_exchange_strong(prev_lsn, lsn)) { |
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.
Thanks @JacksonYao287 , I remove debug assert and use error log here to enhance code readability. PTAL
Currently both resource_mgr and raft can call log store's
truncate
, but resource_mgr will not truncate logs whose lsn less than compact lsn. That means resource_mgr just re-truncate logs which will be / has been truncated incompact
. But if resource_mgr and raft call truncate concurrently, crash will happen.For example, raft truncate logs upto compact_lsn and execute
Then resource_mgr truncate truncate_lsn (which is no large than compact_lsn) and execute
m_trunc_ld_key = m_records.at(upto_lsn).m_trunc_key;
Since truncate_lsn has been truncated, an exception thrown.This pr remove truncation from resource_mgr to avoid concurrency.