From ca2647697f48f4f9f6f007bbc2471c5d29c16629 Mon Sep 17 00:00:00 2001 From: Grant Gainey Date: Fri, 6 Dec 2024 11:26:38 -0500 Subject: [PATCH] At export, enforce content-order as a last-step. This avoids a rare deadlock on import-time involving ks-trees. (cherry picked from commit 5d3d35c2fd9a5faf33348cdd91a5c832d909f2a1) --- pulp_rpm/app/modelresource.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pulp_rpm/app/modelresource.py b/pulp_rpm/app/modelresource.py index 4e8901e52..f50165404 100644 --- a/pulp_rpm/app/modelresource.py +++ b/pulp_rpm/app/modelresource.py @@ -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) ) @@ -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)