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

DatabasePool write barrier #603

Merged
merged 9 commits into from
Sep 2, 2019
Merged

DatabasePool write barrier #603

merged 9 commits into from
Sep 2, 2019

Conversation

groue
Copy link
Owner

@groue groue commented Sep 1, 2019

This pull request introduces a new DatabasePool database access method:

try dbPool.barrierWriteWithoutTransaction { db in
    ...
}

The barrier guarantees exclusive access to the database: the method blocks until all concurrent database accesses are completed, reads and writes, and postpones all other accesses until it completes.

There is a known limitation: reads performed by database snapshots are out of scope, and may run concurrently with the barrier.

The goal of the pull request is to provide support for users who need to change the passphrase of an SQLCipher database: we need a way to wait until all reads and writes are completed, rekey the database, and only then allow further database accesses. See #602.

@groue groue merged commit 82f56ee into development Sep 2, 2019
@groue groue deleted the dev/pool-barrier branch September 2, 2019 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant