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
sqlite: implement backup api #17
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
208ec67
to
7a5c4d2
Compare
This is not safe as-is, sqlite itself does not lock results, which the backup API also uses. We will need to add a lock shared between the backup context and the connection context that serializes calls to step and query/result functions. I tested THREADSAFE=1 to see if that would do the work for us, it does not. |
It is likely useful to report progress information and offer abort for large databases, so expose this in the high level API in a somewhat safe way. A lock was not introduced into the driver directly at this time because doing so is much more complex, particularly as Stmt.DBHandle would need to recover that lock - essnetially requiring global state with further synchronization.
7ce3b4e
to
54958c6
Compare
TODO: test if we can perform online backups of two schemas concurrently At time of writing control has two databases attached in the writable connection, main and noise. Ideally to backup both efficiently using the online backup API we'd be able to start a backup of both of these schemas and Step() them concurrently, and Finish() them at the same time, so the backups are in sync. It's not immediately clear if this is allowed in the backup API, so we need to test it. |
Signed-off-by: David Crawshaw crawshaw@tailscale.com