-
Notifications
You must be signed in to change notification settings - Fork 3
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
🐛 Use pg cascade delete on delete study resource #346
Open
znatty22
wants to merge
7
commits into
master
Choose a base branch
from
pg-cascade-delete
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7d8cf46
to
b77cc5c
Compare
5af5ac0
to
62ddc99
Compare
62ddc99
to
43ccc99
Compare
43ccc99
to
8c6062b
Compare
What ever happened to this? Especially in relation to the many thousands of requests needed for https://github.com/kids-first/kf-utils-python/blob/master/kf_utils/dataservice/delete.py |
@fiendish I think the reason we didn't merge is bc we ultimately decided we don't want to make deleting studies that easy? |
lololol |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Partially addresses #329, read below
Problem
Deleting a single study takes so long that it times out before the delete is complete and the API returns a 503. This is because the request timeout on the webserver (gunicorn) is set to 30 sec. The deletion of a study takes longer than 30 sec (Chung takes ~2.5 minutes) because of two problems 1) a study has large tree of related entities and the dataservice is currently using the ORM to do a cascading delete of this large tree. 2) Genomic files and study files must also be deleted in the indexd service. This also takes minutes complete. Chung takes ~1.5 minutes just to delete genomic files from indexd.
Solution
This PR addresses bottleneck 1 above by deleting a study more efficiently using Postgres's cascading delete rather than the ORM's cascading delete. We may need to address bottleneck 2 by making delete study a background/long running task. We can do this either in this PR or another PR.
After implementing postgres cascading deletes, Chung takes ~1 seconds to be deleted. This does NOT include deleting indexd records from the indexd service.
-- Delete study's genomic files from indexd
-- Use db's cascading delete instead of the ORMs cascading delete