Repository navigation
[PR #8247/55e78bb4 backport][3.123] Invalidate the content cache once a new repository version is complete - #8251
Merged
dralley merged 1 commit intoOct 21, 2026
Conversation
Repository.new_version() cleared the cache of the distributions serving the repository when the new version was started. Until that version is complete, those distributions are still served from the previous one, so a response computed in that window was put back into the cache and served until it expired (ten minutes by default), although the new version had been created in the meantime. Clear the cache once the new version is complete and committed instead. A version that changes nothing is discarded and no longer clears the cache. Closes: #8246 (cherry picked from commit 55e78bb)
2 of 4 tasks
dralley
approved these changes
Oct 21, 2026
dralley
deleted the
patchback/backports/3.123/55e78bb483687549ca3b94cae453018331d49b36/pr-8247
branch
October 21, 2026 21:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a backport of PR #8247 as merged into main (55e78bb).
Closes #8246
Repository.new_version()cleared the content cache of the distributions serving the repository when the new version was started. Until the version is complete, those distributions still serve the previous one. A request in that window therefore put the previous answer back into the cache, and it was served until it expired (ten minutes by default). Details and a reproducer are in #8246.What changes
invalidate_cache()moves fromnew_version()toRepositoryVersion.__exit__. It runs throughtransaction.on_commitafter the version is complete, so no request can see the previous version after the cache is cleared.complete=Trueis saved. They are not touched.Why version deletion needs no change
RepositoryVersion.delete()also clears the cache before its own transaction commits. But a version that any distribution serves cannot be deleted:protected_versions()covers versions set on a distribution, versions behind distributed publications and checkpoints, and the version a repository distribution serves;cleanup_old_versionsand a model hook all refuse to delete them.Tests
pulpcore/tests/unit/models/test_repository_cache.py:Both fail without the change.
The pulpcore and pulp_file unit suites pass.
Checklist