-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to import ansible collections with "duplicate key value violates unique" error #1986
Labels
Comments
I wonder how much "is_latest" is a red herring here. |
hao-yu
added a commit
to hao-yu/pulp_ansible
that referenced
this issue
Oct 3, 2024
Avoid "duplicate key value violates unique" error when importing ansible collections. fixes pulp#1986
mdellweg
added a commit
to mdellweg/pulp_ansible
that referenced
this issue
Oct 9, 2024
mdellweg
added a commit
that referenced
this issue
Oct 9, 2024
mdellweg
added a commit
to mdellweg/pulp_ansible
that referenced
this issue
Oct 28, 2024
This field is not correct anyway and it is removed in newer versions. We only set it to False here hoping it will not be worse but also as the minimal possible change. Fixes pulp#1986
This was referenced Oct 28, 2024
mdellweg
added a commit
to mdellweg/pulp_ansible
that referenced
this issue
Oct 29, 2024
This field is not correct anyway and it is removed in newer versions. We only set it to False here hoping it will not be worse but also as the minimal possible change. Fixes pulp#1986
mdellweg
added a commit
to mdellweg/pulp_ansible
that referenced
this issue
Oct 29, 2024
This field is not correct anyway and it is removed in newer versions. We only set it to False here hoping it will not be worse but also as the minimal possible change. This is a backportable version of the fix. relates to pulp#1986
mdellweg
added a commit
that referenced
this issue
Oct 29, 2024
This field is not correct anyway and it is removed in newer versions. We only set it to False here hoping it will not be worse but also as the minimal possible change. This is a backportable version of the fix. relates to #1986
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
satellite-6.15.3.1-2.el8sat.noarch
python3.11-pulpcore-3.39.15-1.el8pc.noarch
python3.11-pulp-ansible-0.20.8-1.el8pc.noarch
Description of problem:
Pulp raised the following error when performing an incremental import for Ansible collections.
How reproducible:
Tricky
Is this issue a regression from an earlier version:
No
Steps to Reproduce:
To simulate the issue, we need to hack the Pulp code so that Pulp will generate the rows in certain order.
Why not changing the "def set_up_queryset" instead? See the additional notes section.
Create a content view, attach the ansible collection repo and then publish version 1.0
Export the content view version 1.0
6 . Sync the ansible collection repository again with new versions.
Publish the content view version 2.0
Perform an incremental export for the content view version 2.0
Import the content view version 1.0 to another Satellite.
Import the content view version 2.0 to another Satellite.
Actual behavior:
raise ex.with_traceback(None)\n", "description"=>"duplicate key value violates unique constraint "unique_is_highest"\nDETAIL: Key (collection_id, is_highest)=(019245d8-6ab2-7bfc-9015-fa80c3082eee, t) already exists."}
Expected behavior:
Import successfully.
Additional info:
This is the root cause:
After the first complete import, the "ansible_collectionversion" table in the disconnected Satellite should have the following row:
During the incremental import, if the incremental json file has the following order then version (1.6.0, t) will be inserted first and causes error. It is because (1.5.4, t) is still not updated in the disconnected Satellite.
While looking for a solution,
I tried to order the rows by "is_highest" like below, but "set_up_queryset" doesn't honour it.
It is because the queryset result will later be processed in batch while writing it to a json file to save memory. The batch processing code re-fetch the data using their PKs so ordering is lost. See https://github.com/pulp/pulpcore/blob/main/pulpcore/app/importexport.py#L55-L56
The workaround is to wrap the "export()" method of the model resource to perform the re-ordering.
The text was updated successfully, but these errors were encountered: