Skip to content

Conversation

crawshaw
Copy link
Contributor

Signed-off-by: David Crawshaw [email protected]

@crawshaw crawshaw requested a review from sailorfrag October 29, 2021 01:57
Signed-off-by: David Crawshaw <[email protected]>
@raggi
Copy link
Member

raggi commented Feb 24, 2023

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.
@raggi
Copy link
Member

raggi commented Mar 1, 2023

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.

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.

3 participants