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

Idempotency of lamin init in case instance--...--....env file is deleted #817

Open
falexwolf opened this issue Aug 12, 2024 · 3 comments
Open

Comments

@falexwolf
Copy link
Member

Assume you create a purely local instance

lamin init --storage ./my-test-data

You then run

rm ~/.lamin/instance--{my-handle}--my-test-data

Running this again

lamin init --storage ./my-test-data

will not create a new instance, but use the existing SQLite file my-test-data/{uuid}.lndb.

It does so by virtue of hashing the instance slug:

instance_id = uuid.uuid5(uuid.NAMESPACE_URL, instance_identifier)

This isn't robust to renamings of the handle or the instance.

What would be better is to additionally build a check for whether an SQLite file exists in the storage location. Because it's "ugly" to have the .lndb file in the root level of the storage location rather than in the .lamindb/ folder, we should consider moving it while building this check.

We could also consider not naming it by the instance uuid, but instance just ./lamindb/_database.lndb or another 'better name'. Would need to ponder. The nice thing about naming the sqlite file with the instance uuid is that allows to work with several of these files. Hence, I'm now leaning towards keeping the current naming convention.

@falexwolf
Copy link
Member Author

FYI @Koncopd -- something to keep in mind!

@falexwolf
Copy link
Member Author

Moving the .lndb file should be really trivial.

I removed backward compat that I added more than a year ago and clarified an error message as the first step:

@falexwolf
Copy link
Member Author

If we make improvements, we can also think about storing the lamindb_version in a non-breaking way.

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

No branches or pull requests

1 participant