Skip to content

[PULP-2550] PoC: Add unversioned repositories - #8284

Open
jobselko wants to merge 6 commits into
pulp:mainfrom
jobselko:unversioned-repo-poc
Open

jobselko wants to merge 6 commits into
pulp:mainfrom
jobselko:unversioned-repo-poc

Conversation

@jobselko

Copy link
Copy Markdown
Member

📜 Checklist

  • Commits are cleanly separated with meaningful messages (simple features and bug fixes should be squashed to one commit)
  • A changelog entry or entries has been added for any significant changes
  • Follows the Pulp policy on AI Usage
  • (For new features) - User documentation and test coverage has been added

See: Pull Request Walkthrough

@jobselko jobselko self-assigned this Oct 26, 2026
@jobselko
jobselko force-pushed the unversioned-repo-poc branch 2 times, most recently from 233e402 to 66a9af6 Compare October 29, 2026 14:56
@jobselko
jobselko force-pushed the unversioned-repo-poc branch 6 times, most recently from d463239 to 30efdd5 Compare November 23, 2026 11:36
@jobselko
jobselko marked this pull request as ready for review November 24, 2026 09:32
Assisted By: Claude Opus 5.5
Assisted By: Claude Opus 5.5
Assisted By: Claude Opus 5.5
Assisted By: Claude Opus 5.5
Assisted By: Claude Opus 5.5
Assisted By: Claude Opus 5.5
@jobselko
jobselko force-pushed the unversioned-repo-poc branch from 20b1f64 to fd47538 Compare November 30, 2026 12:02
Comment on lines +13 to +14
"CREATE SEQUENCE core_repositorycontent_change_seq",
reverse_sql="DROP SEQUENCE core_repositorycontent_change_seq",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does Django not have support for SEQUENCE?

Comment on lines +16 to +19
migrations.RemoveConstraint(
model_name="repositorycontent",
name="unique_unversioned_repository_content",
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note for final review: Remember to squash the history of the migrations down. They can still be in different files, but operations like add & remove & add constraint that are because of developmental commits should be reduced.

Comment on lines +1844 to +1845
self._content_relationships()
.filter(content_id__in=pks)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens if you are adding 70K content units in this method? Would this query fail? Can we not just take all of the content from _content_relationships and subtract to get to_add, do we need to do this filter first?

Comment on lines +1849 to +1851
self._check_content_types(to_add)
if not to_add:
return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reverse the order of these lines.

if not removed:
return
# Removed rows are kept as tombstones so the removal shows up in changes
rows.filter(content_id__in=removed).update(removed_seq=_next_change_seq())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here I believe we have the same issue if removed is greater than 65K.

Side note: The order of operations in remove_content had to be specific when I was adding content_ids as there were scenarios where the passed in query could depend on the existing content so you had to be careful not to re-evaluate the query again after modifying the existing content. How much we should care about that scenario for this repo type, I'm not sure, but thought it would be worth mentioning.

Comment on lines +1894 to +1896
repository.finalize_new_version(self)
if self._added or self._removed:
repository.on_new_version(self)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we really be calling these version methods when dealing with unversioned membership. Maybe it makes the most sense for easy compatibility, but current plugins (cough, maven, cough) can do a lot of work in these methods making them unsuitable for synchronous actions.

if publication and repo_version:
raise Exception("Either a repo_version or publication can be specified.")
content_repo_ver = repo_version or publication.repository_version
content_repo_ver = repo_version or publication.published_version

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do believe you need an addition to the select_related on the distribution query to also select the publication's potential unversioned_repository

large or slow files can hit the API server timeout.
"""
# A request-less context makes the serializer run its deferred validation in-process.
context["request"] = None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if deferred validation even makes sense for this upload. Maybe plugins should use their sync upload serializer instead.


def _patched_manifest_entries(publication, manifest):
"""
Return manifest entries made by patching the manifest of the previous publication.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is pretty smart. Are you going to do any tests to see what the performance of this optimization is?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants