-
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
Add baseline resync with read and write support #387
Conversation
@@ -293,7 +295,13 @@ bool HomeRaftLogStore::compact(ulong compact_lsn) { | |||
// we rely on resrouce mgr timer to trigger truncate for all log stores in system; | |||
// this will be friendly for multiple logstore on same logdev; | |||
|
|||
// m_log_store->truncate(to_store_lsn(compact_lsn)); | |||
#ifdef _PRERELEASE | |||
if (iomgr_flip::instance()->test_flip("force_home_raft_log_truncate")) { |
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.
Suggest a parameterized flip, so you can force raft log truncate on specific logstore. This will trigger on every logstore truncate always.
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.
Some comments; still reviewing...
4e92c2d
to
860e2cd
Compare
LOGINFO("Leader create snapshot and truncate"); | ||
this->create_snapshot(); | ||
this->truncate(0); | ||
} |
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.
Should we just write the snapshot_freq_distance
number of logs to cause an internal snapshot like we'll experience in a real setup? We never call snapshot
directly from above the library from what I know.
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 do set snapshot_freq_distance at line 946.
Add nuraft based snapshot sync across leader and followers. Implement the read and write snapshot callback. Add a generic snapshot structure to support different implemenations. Listener implements necessary function to load/save snapshot state. Listener also implements on how to read and write actual snapshot data. Added test to do basic baseline test.
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
Add generic snapshot context and data structure.
Add callbacks for listener as discussed.
Use nuraft read and write logical snapshot callbacks to transfer the data.
Do test on both read and write for the baseline resync.
Key and values were pushed by leader and written by follower and its tested.
Currently verification of the data in the test are disabled but have been locally tested.