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

Extend WASI Filesystem to support sqlite3 #15

Closed
tracker1 opened this issue Dec 12, 2020 · 6 comments
Closed

Extend WASI Filesystem to support sqlite3 #15

tracker1 opened this issue Dec 12, 2020 · 6 comments

Comments

@tracker1
Copy link

Not sure if this the right place for this... Wanted to just suggest that it would be really nice to support enough filesystem access to get sqlite3 working to where it can work on a database also being accessed by another application process. I know it's somewhat odd to mention a specific library, but it seems that it's one of the most widely used libraries and focused around filesystem access, so being able to test it through webassembly/wasi and pass the sqlite test suite would be a massive win and prove the environment for most use cases of FS needs.

@devsnek
Copy link
Member

devsnek commented Dec 12, 2020

It would be helpful if you elaborated on what specific functionality is missing.

@sunfishcode sunfishcode transferred this issue from WebAssembly/WASI Dec 12, 2020
@sunfishcode
Copy link
Member

One missing feature is fcntl+F_SETLK-style file locking. We didn't add file locking APIs to WASI initially because POSIX defines them to be associated with the process, not with the file descriptor, which is problematic for implementations that don't have a one-to-one relationship between instances and host processes. However, most OS's have alternative locking APIs that we could use here. If anyone's interested in investigating this, the first step here would be to do a survey of what file locking APIs exist on popular OS's, so we can design an API that would use them.

@sunfishcode
Copy link
Member

Compiling sqlite with

  • -DSQLITE_THREADSAFE=0 due to threads
  • -DSQLITE_OMIT_LOAD_EXTENSION=1 due to dlopen
  • -D_WASI_EMULATED_MMAN to enable emulated mmap support

turns up the following features as being needed:

@neimanpinchas
Copy link

Anyone can point to a polyfill how we could patch until its added?

@sunfishcode
Copy link
Member

File locking (flock style) is now added to the API in #69.

@sunfishcode
Copy link
Member

Threads, dlopen and mmap are outside the scope of wasi-filesystem, and file locking is now added, and all the other functions above have suitable answers, so we can now close this!

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

4 participants