Skip to content
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
1 change: 1 addition & 0 deletions CHANGES/6772.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the new content set optimization failing when the RepositoryVersion grew larger than 65K content units.
10 changes: 9 additions & 1 deletion pulpcore/app/models/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,15 @@ def get_content(self, content_qs=None):
if content_qs is None:
content_qs = Content.objects

return content_qs.filter(pk__in=self._get_content_ids())
content_ids = self._get_content_ids()
if isinstance(content_ids, list) and len(content_ids) >= 65535:
# Workaround for PostgreSQL's limit on the number of parameters in a query
content_ids = (
RepositoryVersion.objects.filter(pk=self.pk)
.annotate(cids=Func(F("content_ids"), function="unnest"))
.values_list("cids", flat=True)
)
return content_qs.filter(pk__in=content_ids)

@property
def content(self):
Expand Down