Fix IntegrityError on multi-source copy with dependency solving - #4468
Fix IntegrityError on multi-source copy with dependency solving#4468guylain-lavoie wants to merge 1 commit into
Conversation
f40fe5b to
b871b76
Compare
|
test_upload_signed_package is failing. It was modified 12 days ago, I do not think my code is in cause. Anyone knows if I am wrong? |
|
Hey @guylain-lavoie, I've seen some sign on upload flaky errors lately, so I also believe it might not be your changes (and well, it doesn't really is related at all). |
|
This is probably something related to shared fixtures, parallel runs, cleanups and test expectations about the uniqueness of artifacts... |
b871b76 to
1ee7b39
Compare
|
Thank you @pedro-psb for your help. Rebased and pushed back. Unfortunately, same problem. |
|
@guylain-lavoie Could you rebase one more time please? We did some work with the tests to make them less flaky, if it fails again it probably is something with these specific tests |
When copy_content ran with dependency_solving=True and multiple source repository versions in the config mapped to the same destination repository, the task failed with an IntegrityError on the unique (repository, number) constraint because new_version() was called once per source entry on the same destination inside a single @transaction.atomic block. Group units by destination repository before creating new versions, so that each destination receives exactly one new version regardless of how many source entries target it. closes pulp#4286 Assisted By: Claude (Anthropic)
1ee7b39 to
c657820
Compare
|
I will take a look at this at some point in the next week |
|
Thank you Daniel. The test_upload_signed_package failure (assert package.signing_keys is not None, test_package_signing.py:529) is unrelated to this PR's change — it's a test-isolation race on main between package upload and any sync of the rpm-signed fixture repo. Mechanism:
This PR only touches copy.py and adds two tests to test_copy.py; nothing in it writes signing_keys. The added tests plausibly shift pytest-xdist scheduling enough to change which side wins the race, which would explain why the failure appeared on this run — though I haven't been able to pull the other matrix jobs' tracebacks to confirm all four failed on the same assertion. |
|
All the test-scenarios fail on the same test, the failure being not reproducible locally. Concur that nothing in this PR appears to have anything to do with the failure. |
|
I am going to close and reopen this, to see if we can shake loose the test-runners. We appear to have been lost in a hole due to github's outage/issues from yesterday. |
|
#4542 should fix the issue called out in #4468 (comment) , because it builds an rpm to sign instead of relying on an existing one from fixtures. |
|
Agree, once that merges and this gets rebased again, it should work (this time) |
When copy_content ran with dependency_solving=True and multiple source repository versions in the config mapped to the same destination repository, the task failed with an IntegrityError on the unique (repository, number) constraint, because new_version() was called once per source entry on the same destination inside a single @transaction.atomic block.
Group units by destination repository before creating new versions, so that each destination receives exactly one new version regardless of how many source entries target it.
closes #4286
Assisted By: Claude (Anthropic)
📜 Checklist
See: Pull Request Walkthrough