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

feat(sqlite): Gracefully handle issues creating sqlite indices #458

Merged
merged 1 commit into from
Aug 2, 2019

Conversation

orangejulius
Copy link
Member

@orangejulius orangejulius commented Aug 2, 2019

The creation of the spr_obsolete index is problematic for the PIP service and any of the admin lookup workers running in the importers.

Because there are always multiple processes doing admin lookup, and each one tries to create the index if it doesn't exist, most end up failing. SQLite only allows a single write lock on the DB, so all but one will fail to achieve it.

However, in my testing, all it takes to solve this gracefully is to wrap the index creation in a try/catch block. The index will be created by one of the worker processes, and all subsequent queries appear to have the performance improvements of the index (about 30-50% faster time to
load admin data).

Supersedes #431
Fixes #454
Connects #453 (we should not actually remove the index creation quite yet, the whosonfirst-data-latest file does not have the index)

The creation of the `spr_obsolete` index is problematic for the PIP
service and any of the admin lookup workers running in the importers.

Because there are always multiple processes doing admin lookup, and each
one tries to create the index if it doesn't exist, most end up failing.
SQLite only allows a single write lock on the DB, so all but one will
fail to achieve it.

However, in my testing, all it takes to solve this gracefully is to wrap
the index creation in a try/catch block. The index will be created by
one of the worker processes, and all subsequent queries appear to have
the performance improvements of the index (about 30-50% faster time to
load admin data).

Supersedes #431
Fixes #454
Connects #453 (we should not
actually remove the index creation quite yet)
@orangejulius orangejulius force-pushed the gracefully-handle-index-creation-error branch from f00bf30 to 8b0c2ae Compare August 2, 2019 14:18
@orangejulius orangejulius merged commit 34f4417 into master Aug 2, 2019
@orangejulius orangejulius deleted the gracefully-handle-index-creation-error branch August 2, 2019 14:22
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.

Unable to start pip after download with sqlite=true
1 participant