pulp / pulp/pulp_deb

Duplicate key value violates unique constraint when syncing multiple Ubuntu distributions

Open
#611 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Triage-Needed
Dominant language
Python
Stars
71
Forks
91
Avg merge
1d 19h
Merged PRs (30d)
22

Description

Version

foreman-3.3.0-1.el8
rubygem-pulp_deb_client-2.18.0-1.el8.noarch

Describe the bug
Originally reported here: https://community.theforeman.org/t/duplicate-key-value-violates-unique-constrain-when-synchronizing-product-published-deb-file/29872

Error message:

duplicate key value violates unique constraint “core_publishedartifact_publication_id_relative__97f785f4_uniq”
DETAIL: Key (publication_id, relative_path)=(6790107c-dc2f-4375-90d0-0656462a497d, pool/all/f/flashrom/libflashrom-dev_1.2-5_amd64.deb) already exists.

It looks like the package pool/all/f/flashrom/libflashrom-dev_1.2-5_amd64.deb exists in multiple distributions and there is a race condition to create the one DB entry during sync.

To Reproduce
Synchronize some combination of focal forcal-updates focal-backports focal-security in a single sync.

Expected behavior
The duplicate package is created once, and is included in both sets of metadata without error.

Workaround
It is possible to work around this issue, by syncing the affected APT distributions into a single Pulp repository each. (Rather than multiple APT distributions into a single Pulp repository).

Possibly related

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure by synchronizing focal, focal-updates, focal-backports, and focal-security in one Pulp repository. Trace the synchronization path that creates published artifacts and compare the behavior with pulp_deb issues 410 and 421; done means the duplicate package is created once and included in both metadata sets without a unique-constraint error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, ubuntu
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.