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

Improve WAL sync logic #1878

Merged
merged 1 commit into from
Dec 13, 2024
Merged

Improve WAL sync logic #1878

merged 1 commit into from
Dec 13, 2024

Conversation

penberg
Copy link
Collaborator

@penberg penberg commented Dec 11, 2024

This improves the WAL sync to follow this logic:

  • If there are no local writes, attempt to pull. We know there are no
    local writes if the cached remote max frame number is greater than or
    equal to local max frame number.

  • If there are local writes, attempt to push. We know there are local
    writes if the cached remote max number is less than lcoal max frame
    number.

This also removes the offline_writes_pull.rs example and augments
offline_writes.rs to sync before attempting to write.

@penberg penberg force-pushed the improve-wal-sync branch 2 times, most recently from 541ac62 to 1086231 Compare December 12, 2024 09:02
@penberg penberg requested a review from LucioFranco December 12, 2024 09:14
@penberg penberg marked this pull request as ready for review December 12, 2024 09:14
Copy link
Contributor

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

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

LGTM have a suggestion around the assert

libsql/src/local/database.rs Outdated Show resolved Hide resolved
libsql/src/local/database.rs Show resolved Hide resolved
This improves the WAL sync to follow this logic:

- If there are no local writes, attempt to pull. We know there are no
  local writes if the cached remote max frame number is greater than or
  equal to local max frame number.

- If there are local writes, attempt to push. We know there are local
  writes if the cached remote max number is less than lcoal max frame
  number.

This also removes the `offline_writes_pull.rs` example and augments
`offline_writes.rs` to sync before attempting to write.
@penberg penberg enabled auto-merge December 13, 2024 08:27
@penberg penberg added this pull request to the merge queue Dec 13, 2024
Merged via the queue into main with commit f8954db Dec 13, 2024
19 checks passed
@penberg penberg deleted the improve-wal-sync branch December 13, 2024 08:54
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