Story #4295
Updated by ttereshc over 5 years ago
h3. Motivation Currently it is possible to have multiple Advisories(UpdateRecord content units) with the same @id@ in one repo version. Those content units are not full duplicates, they have the same @id@ but different content. That leads to a creation of a bad repository at a publication time (@id@ of an advisory should be unique per yum repo, so Pulp needs to publish only one advisory per @id@). h3. Possible cases At sync time in additive mode: # Repo version 1 contains an updateA, in repo version 2 a newer version of the updateA is being added # Repo version 1 contains an updateA, in repo version 2 an older version of the updateA is being added # Repo version 1 contains an updateA, in repo version 2 an alternative version of the updateA (e.g. for different distribution) is being added In case of a mirror mode for sync, always the incoming version of the updateA is taken, regardless of any criteria. h3. Suggested solution Each repo version should have no more than one UpdateRecord with the same @id@. Decide which UpdateRecord update to keep based on the criteria defined below. Proposal for sync case: - create a new stage @AdvisoryContentUnitMerger@ which searches for UpdateRecords with the same id and apply the criteria, then pass the needed UpdateRecord further down the pipeline and remove old UpdateRecord from a repo if needed.. - the new stage should precede the @ErratumContentUnitSaver@ stage (which should be renamed to @AdvisoryContentUnitSaver@) h4. Criteria In case of mirror sync, just pick the incoming UpdateRecord. In all other cases: * updated_dates are the same, pkglist intersection is empty (e.g. base repo merged with debuginfo repo) -> *new* UpdateRecord content unit with combined pkglist is created and added to a repo, old UpdateRecord is removed form a repo. * updated_dates differ, pkglist intersection is non-empty (update/re-sync/upload-new case) -> UpdateRecord with newer updated_date should be in a repo. * updated_dates differ, pkglist intersection is empty - ERROR CONDITION! (base and -debuginfo buit repos are from different versions, not at same date) ** tell to go make sure that the merging repos are up-to-date, and then retry * update_dates are the same, pkglist intersection is non-empty and not equal to either pkglist - ERROR CONDITION! ** never-happen case - "something is Terribly Wrong Here" "A relevant functional test":https://github.com/pulp/pulp_rpm/blob/3e89fa57e3e5b63a90dd18f5c29d5086c17f0ce8/pulp_rpm/tests/functional/api/test_sync.py#L212 which is currently being skipped.