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

Shared schema #1080

Merged
merged 3 commits into from
Feb 26, 2024
Merged

Shared schema #1080

merged 3 commits into from
Feb 26, 2024

Conversation

haaawk
Copy link
Contributor

@haaawk haaawk commented Feb 24, 2024

Redo of #1055

It basically stores the relationship between shared schema db and databases linked to it:

The relationships are stored in form of shared_schema_links table in the meta store of a shared-schema db.
When we create a dependent db, we store a link in shared-schema.
When we destroy dependent db, we remove link from shared-schema.
When we destroy shared-schema, we first check if all dependent dbs are already destroyed. We fail if they don't.

Some known decifiencies:

  1. No way to fetch the schema links yet
  2. Forking a db that links to a shared schema should add a link between a new fork and a shared schema but doesn't do it right now.

Signed-off-by: Piotr Jastrzebski <piotr@chiselstrike.com>
Signed-off-by: Piotr Jastrzebski <piotr@chiselstrike.com>
@haaawk haaawk requested review from MarinPostma, Horusiath and LucioFranco and removed request for MarinPostma and Horusiath February 24, 2024 11:16
@haaawk haaawk mentioned this pull request Feb 24, 2024
libsql-server/src/http/admin/mod.rs Outdated Show resolved Hide resolved
libsql-server/src/http/admin/mod.rs Outdated Show resolved Hide resolved
libsql-server/src/namespace/meta_store.rs Outdated Show resolved Hide resolved
libsql-server/src/namespace/meta_store.rs Outdated Show resolved Hide resolved
libsql-server/src/namespace/meta_store.rs Outdated Show resolved Hide resolved
}
}
tx.execute(
"DELETE FROM namespace_configs WHERE namespace = ?",
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we also delete the link?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The link is removed above in lines 381-386.

libsql-server/src/namespace/meta_store.rs Outdated Show resolved Hide resolved
@haaawk haaawk force-pushed the shared_schema branch 3 times, most recently from fe0b0c4 to f372af5 Compare February 25, 2024 10:21
@haaawk
Copy link
Contributor Author

haaawk commented Feb 25, 2024

Thanks for a great review @MarinPostma! I applied all your suggestions - please have another look.

@haaawk haaawk requested a review from MarinPostma February 25, 2024 10:22
Signed-off-by: Piotr Jastrzebski <piotr@chiselstrike.com>
@MarinPostma MarinPostma added this pull request to the merge queue Feb 26, 2024
Merged via the queue into main with commit 82cd274 Feb 26, 2024
16 checks passed
@MarinPostma MarinPostma deleted the shared_schema branch February 26, 2024 07:42
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