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

Avoid a potential race condition #1156

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .ci/scripts/extra_linting.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

EXIT_CODE=0
if (git grep "orphan_protection_time=0" ./galaxy_ng);then
echo "Setting 'orphan_protection_time' to 0 can lead to a race condition.\n";
EXIT_CODE=1
fi
exit $EXIT_CODE
2 changes: 1 addition & 1 deletion .github/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-83-g29b161f
2021.08.26-85-ga3934fa
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ jobs:
- name: Run flake8
run: flake8 --config flake8.cfg

- name: Run extra lint checks
run: "[ -x .ci/scripts/extra_linting.sh ] && .ci/scripts/extra_linting.sh"

# check for any files unintentionally left out of MANIFEST.in
- name: Check manifest
run: check-manifest
Expand Down
1 change: 1 addition & 0 deletions CHANGES/1384.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make sure orphan_protection_time is not set to zero
6 changes: 3 additions & 3 deletions galaxy_ng/app/tasks/deletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def delete_collection_version(collection_version_pk):
_remove_collection_version_from_repos(collection_version)

log.info("Running orphan_cleanup to delete CollectionVersion object and artifact")
orphan_cleanup(content_pks=None, orphan_protection_time=0)
orphan_cleanup(content_pks=None, orphan_protection_time=10)

if not collection.versions.all():
log.info("Collection has no more versions, deleting collection {}".format(collection))
Expand All @@ -78,7 +78,7 @@ def delete_collection(collection_pk):
_remove_collection_version_from_repos(version)

log.info("Running orphan_cleanup to delete CollectionVersion objects and artifacts")
orphan_cleanup(content_pks=None, orphan_protection_time=0)
orphan_cleanup(content_pks=None, orphan_protection_time=10)

log.info("Deleting collection {}".format(collection))
collection.delete()
Expand All @@ -91,7 +91,7 @@ def delete_container_distribution(instance_ids):
general_multi_delete(instance_ids=instance_ids)

log.info("Running orphan_cleanup to delete Container objects and artifacts")
orphan_cleanup(content_pks=None, orphan_protection_time=0)
orphan_cleanup(content_pks=None, orphan_protection_time=10)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is 10a reasonable number to protect? is this number in seconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value is in minutes. The default setting in pulpcore is here.



def delete_container_image_manifest(repository_pk, content_unit_pks):
Expand Down