Skip to content

Commit

Permalink
At export, enforce content-order as a last-step.
Browse files Browse the repository at this point in the history
This avoids a rare deadlock on import-time involving ks-trees.

(cherry picked from commit 5d3d35c)
  • Loading branch information
ggainey authored and patchback[bot] committed Dec 9, 2024
1 parent d807f3b commit a527744
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pulp_rpm/app/modelresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ def set_up_queryset(self):
django.db.models.QuerySet: The Content to export for a RepositoryVersion
"""
content = self.Meta.model.objects.filter(pk__in=self.repo_version.content).order_by(
"content_ptr_id"
)
content = self.Meta.model.objects.filter(pk__in=self.repo_version.content)
self._add_to_mapping(
self.repo_version.repository, content.values_list("pulp_id", flat=True)
)
Expand All @@ -67,12 +65,10 @@ def set_up_queryset(self):
if tree:
for repo in tree.repositories():
version = repo.latest_version()
content |= self.Meta.model.objects.filter(pk__in=version.content).order_by(
"content_ptr_id"
)
content |= self.Meta.model.objects.filter(pk__in=version.content)
self._add_to_mapping(repo, version.content.values_list("pulp_id", flat=True))

return content
return content.order_by("content_ptr_id")

def dehydrate__pulp_domain(self, content):
return str(content._pulp_domain_id)
Expand Down

0 comments on commit a527744

Please sign in to comment.