Skip to content
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

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

sanebay
Copy link
Contributor

@sanebay sanebay commented Apr 18, 2024

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.

@sanebay sanebay requested review from hkadayam and yamingk April 18, 2024 19:51
@@ -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")) {
Copy link
Contributor

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.

@sanebay sanebay changed the title Add baseline resync feature with read support Add baseline resync with read and write support Jul 23, 2024
@sanebay sanebay requested review from xiaoxichen and raakella1 July 23, 2024 20:24
@sanebay sanebay requested a review from szmyd August 5, 2024 17:31
Copy link
Collaborator

@szmyd szmyd left a 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...

src/tests/test_raft_repl_dev.cpp Outdated Show resolved Hide resolved
src/tests/test_raft_repl_dev.cpp Show resolved Hide resolved
src/include/homestore/replication/repl_dev.h Show resolved Hide resolved
@sanebay sanebay requested a review from szmyd August 7, 2024 00:01
@sanebay sanebay force-pushed the baseline_read branch 4 times, most recently from 4e92c2d to 860e2cd Compare August 8, 2024 01:41
LOGINFO("Leader create snapshot and truncate");
this->create_snapshot();
this->truncate(0);
}
Copy link
Collaborator

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.

Copy link
Contributor Author

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.
Copy link
Collaborator

@szmyd szmyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sanebay sanebay merged commit e371106 into eBay:master Aug 9, 2024
21 checks passed
@sanebay sanebay deleted the baseline_read branch August 9, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants