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

libsql/core: Implement Database::sync() in V2 #317

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

penberg
Copy link
Collaborator

@penberg penberg commented Aug 25, 2023

No description provided.

@@ -20,7 +20,7 @@ pub use transaction::Transaction;
enum DbType {
Memory,
File { path: String },
Sync { path: String, url: String, token: String },
Sync { db: crate::Database },
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh smart... we should do that same for path and memory?

@LucioFranco LucioFranco added this pull request to the merge queue Aug 25, 2023
Merged via the queue into tursodatabase:main with commit dceeccd Aug 25, 2023
4 checks passed
MarinPostma added a commit that referenced this pull request Oct 17, 2023
317: Streaming replication r=MarinPostma a=MarinPostma

This pull request implements streaming replication to replace poll-based replication.

here is an overview of the protocol:
1) replica sends hello to primary
2) primary responds with current replication meta
3) replica sends `Frames` rpc with its current replication progress
4) primary starts streaming frames to the replica
5) replica injects frames on the fly into the database, transaction by transaction
6) if a snapshot is required, the replica downloads the snapshot, applies the snapshot, and reissues a call to `Frames` with its updated replication progress
7) if the primary is out of pages to send, it waits until new pages become available.

The replication code has been restructured significantly, and it should be much easier to follow now.


Co-authored-by: ad hoc <[email protected]>
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.

2 participants