-
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
commit blk during log replay in rep dev #524
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 #524 +/- ##
===========================================
+ Coverage 56.51% 67.45% +10.94%
===========================================
Files 108 109 +1
Lines 10300 10427 +127
Branches 1402 1399 -3
===========================================
+ Hits 5821 7034 +1213
+ Misses 3894 2717 -1177
- Partials 585 676 +91 ☔ View full report in Codecov by Sentry. |
rreq->init(rkey, jentry->code, false /* is_proposer */, entry_to_hdr(jentry), entry_to_key(jentry), data_size); | ||
RD_LOGD("Replay log on restart, rreq=[{}]", rreq->to_string()); | ||
|
||
if (repl_lsn > m_rd_sb->durable_commit_lsn) { | ||
commit_blk(rreq); |
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: can we dirty the allocator with these blks and still commit them in handle_commit()?. Just in the case for rollback.
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.
Is there a way to dirty the blks without allocating them?
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.
not yet but we can change dataservice api?
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.
also implement roll_back to free blk
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: can we dirty the allocator with these blks and still commit them in handle_commit()?. Just in the case for rollback.
Just be noted commit_blk will be expecting blks in allocated state for non-recovery mode (existing handle_commit), and for recovery mode, it will try to reserve on cache also before committing to disk; Need a bit more handling to combine them.
@@ -1181,10 +1186,12 @@ void RaftReplDev::on_log_found(logstore_seq_num_t lsn, log_buffer buf, void* ctx | |||
} | |||
|
|||
rreq->set_lsn(repl_lsn); | |||
rreq->set_lentry(lentry); |
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.
This is a bit hacky as we dont set it in normal IO path , we believe nuraft will not release them during the whole lifecycle till commit()
.
I would vote even for normal operations we keep lentry shared_ptr for safety and more consistent behavior.
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.
We didnt catch both bugs in all our restorability UT, because both bugs occurs if we have dc_lsn < last_log_lsn
, how can we have this UT to exercise this path?
@@ -1181,10 +1186,14 @@ void RaftReplDev::on_log_found(logstore_seq_num_t lsn, log_buffer buf, void* ctx | |||
} | |||
|
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.
Not directly related to this PR, but could impact some of the assert in underlying layer, is SM long run currently use debug build or release build?
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.
Debug build
@@ -234,6 +235,7 @@ struct repl_req_ctx : public boost::intrusive_ref_counter< repl_req_ctx, boost:: | |||
std::variant< std::unique_ptr< uint8_t[] >, raft_buf_ptr_t > m_journal_buf; // Buf for the journal entry | |||
repl_journal_entry* m_journal_entry{nullptr}; // pointer to the journal entry | |||
bool m_is_jentry_localize_pending{false}; // Is the journal entry needs to be localized from remote | |||
nuraft::ptr< nuraft::log_entry > m_lentry; |
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.
would be nice to put a comment here that this is only needed during recovery
As discussed in DM, this PR is not right as there is no guarantee the data has been written to the allocated blks before the restart. |
we can put if data is written but log is not flushed, that`s fine, since the block is not committed |
yes we can, it is trading regular IO latency vs space leak during recovery, which I am not sure it worth to . Prior to that, we have to solve the rollback stuff. |
rollback happens when a request is pre_committed but not committed. any input? |
No description provided.