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: add per-sync-url metadata #1908

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LucioFranco
Copy link
Contributor

This commit changes the filename of the metadata file to contain <db_path>-<sync_url>-info. Where db_path is a full file path + filename and sync_url is the host of the authority of the URI. This also includes upfront uri parsing and two new errors that can be produced when trying to extract the host.

This approach trades off creating multiple files in exchange for allowing multiple sync context's to operate at the same time concurrently. Originally, I had approached updating the metadata to include a hashmap of endpoints and their metadata but this approach falls flat if you have multiple Database and thus SyncContext in the same process (and beyond).

This commit does NOT include updating from the original v0 metadata format but instead will force a full re-sync and a new meatadata file will be produced with verison set to 1. Not implementing this mean't simpler code with less space to produce errors and since this only runs once when a user upgrades that cost is okay.

Closes #1837

This commit changes the filename of the metadata file to contain
`<db_path>-<sync_url>-info`. Where `db_path` is a full file path +
filename and `sync_url` is the host of the authority of the URI. This
also includes upfront uri parsing and two new errors that can be
produced when trying to extract the host.

This approach trades off creating multiple files in exchange for
allowing multiple sync context's to operate at the same time
concurrently. Originally, I had approached updating the metadata to
include a hashmap of endpoints and their metadata but this approach
falls flat if you have multiple `Database` and thus `SyncContext` in the
same process (and beyond).

This commit does NOT include updating from the original v0 metadata
format but instead will force a full re-sync and a new meatadata file
will be produced with verison set to `1`. Not implementing this mean't
simpler code with less space to produce errors and since this only runs
once when a user upgrades that cost is okay.

Closes #1837
@LucioFranco LucioFranco requested review from penberg and haaawk January 7, 2025 22:09
@LucioFranco
Copy link
Contributor Author

LucioFranco commented Jan 7, 2025

This is ready for review but is in draft since I want to do some manual testing before we ship it. tested ✔️

@LucioFranco LucioFranco marked this pull request as ready for review January 8, 2025 16:49
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.

Cache durable frame number per sync URL
1 participant