Pulp
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: advisories --- # Merging Advisories ## Overview of the problem ### Scenario An advisory with a given name exists in Pulp. A sync-operation finds an advisory with the same name. One of four things must happen: * Keep the existing advisory * Delete the existing advisory and take the new one * Merge the new one with the existing one and keep the result * Determine that there is a fatal data error and give up ### Places that need to deal with advisory-merges * sync (**two** advisories collide) * upstream-repo-updates * adding a remote to a repository that's already been sync'd * copy (**two** advisories collide (?)) * repo-to-repo * upload (**arbitrary number** of advisories with same id) * **if** repository is specified - otherwise, no merge for errata with same id but different digests * can copy() result in 'finding' more than 2 advisories with the same id? * repository-modify (**arbitrary number** of advisories with same id) * incoming erratum has same id as one already in repo (same as sync case) * incoming add_contents contains **multiple** errata with same id but different hrefs ### Application-reality Complication The final complicating determinant is, "don't write to persistent storage unless you have to". This adds one more rule to set: * "don't write to storage unless you have to" This problem led to the addition of the ``digest`` field in stored advisories. If an incoming advisory has its digest computed, and it's identical to one that has been stored, then we have nothing to do. The problem with the existing ``digest`` is it is driven by the output of "whatever createrepo_c spits out this week", and is applied to the entire advisory including reference- and package-lists. This makes it not as reliable as we would like, for the purposes of this discussion. ### Who Should Win? I'm pulling in a new advisory, and find that something with its ID already exists. Who should I keep, incoming or current? * Incoming that has only metadata changes (e.g., descriptive text) * Incoming is adding packages * Incoming is removing packages * Incoming has a completely different package-set * Incoming is older-by-version * Incoming is older-by-updated_date What to do in the face of the possible combinations of these difference is the question conflict-resolution is trying to answer. ### Related Issues * [8249](https://pulp.plan.io/issues/8249) - migrate from pulp2 and sync causes fatal conflict-failures * [PR 1945](https://github.com/pulp/pulp_rpm/pull/1945) merged * [8250](https://pulp.plan.io/issues/8250) - ALLOW_UNSAFE_ADVISORY_CONFLICT_RESOLUTION feature * [PR 1950](https://github.com/pulp/pulp_rpm/pull/1950) submitted * [7282](https://pulp.plan.io/issues/7282) - Updating an advisory/updaterecord deletes old and doesn't produce new * ggainey in-progress * [Pain](https://hackmd.io/csLR-MkgTz2TG6H--mnn7w?both) ## Current Thinking/code ### Determinants We consider merging advisories only when we have an existing advisory and a new one, which have the same name/id and different checksums(?). We can do one of four things in the conflict case: * KEEP: Keep existing and ignore new * REPLACE: Remove existing and replace with new * MERGE: Merge new into existing, merge pkglists * ABORT: fatal error The attributes that are important for deciding how to resolve the conflict include * version - not every advisory has a version * updated_date (or issued_date if updated_date not set) * pkglist Advisories are considered "the same" if version AND updated_date are the same. Advisory A is "older" than Advisory B if updated_date(A) < updated_date(B). Similarly, Advisory A is newer if updated_date(A) > updated_date(B). If there is no updated_date, rely on version. pkglist comparisons can be in four states: * pkglist(A) == pkglist(B) * one pkglist is a proper-subset of the other * pkglist-intersection is non-empty and not a proper subset of the other * pkglists are disjoint ### Decision-Making Process ('Current' in the sense that I'm in the middle of working on 8249 by adding proper-subset-recognition-logic to the code) Existing Advisory A, incoming Advisory B, same ID. * version AND updated_date SAME: * pkglists-same: REPLACE (metadata-only change) * pkglist(A).subset(pkglist(B)): REPLACE (adding-pkgs) * pkglist(B).subset(pkglist(A)): KEEP? (removing-pkgs) * pklist-intersection EMPTY: MERGE (e.g., combining debuginfo- into base-repo) * else: ABORT (8249) * dates-same OR (dates-differ, same-version), intersection EMPTY: [ttereshc thinks this condition potentially incorrectly reflects the current state] * pkglist(A) EMPTY: REPLACE * else: ABORT * dates-differ AND pkg-intersection: * A.updated < B.updated: REPLACE (8229) * else: KEEP * dates-same AND versions-differ AND pkg-intersection: * A.is_previous_to(B): REPLACE * else: KEEP ### Fatal Failures First case: * IF version and updated_date are the same, AND * pkglists are not equal, AND * neither pkglist is a proper subset of the other, AND * pkglists are not disjoint, THEN * FAILURE. Specific use-case: an advisory released for two incompatible repositories at the same time. Second case: * IF updated_dates differ OR (updated_dates are the same AND versions differ), AND * pkglists intersect, AND * neither pkglist is a proper subset of the other, THEN * FAILURE. Specific use-case: merging base and later-version-of debuginfo into the same place. ### ttereshc version of existing logic Existing Advisory A, incoming Advisory B, same ID. * dates-same and versions-same: * pkglists-same: REPLACE (metadata-only change) * pkglist(A).subset(pkglist(B)): REPLACE (adding-pkgs) * pkglist(B).subset(pkglist(A)): KEEP? (removing-pkgs) * pklist-intersection EMPTY: MERGE (e.g., combining debuginfo- into base-repo) * else: ABORT (8249) * dates-same and versions-differ: * pklist-intersection EMPTY: ABORT * A.is_previous_to(B): REPLACE * else: KEEP * dates-differ and any versions (same or different): * pklist-intersection EMPTY: ABORT * A.updated < B.updated: REPLACE (8229) * else: KEEP The fatal case conditions are the same for this version as well. ## Simplifying (?) the workflow Some of what follows is driven by discoveries made while investigating the advisory-upload issue [7282](https://pulp.plan.io/issues/7282). See [Advisory Merging Woes](https://hackmd.io/@pulp/advisory_upload_fun) for gory details. What if Pulp3 stopped trying to guess what the 'right thing' to do is, and instead always went with 'newest is best, **always**'? 'Newest' drives/can-be-driven off of four fields: * **version**. You'd think this would be It, but it's not. Some repos (SUSE) don't use version. Sometimes an advisory is updated and its version doesn't change. And version is just a string, it doesn't have to be a number - "newer than" is a collation-based guess. * **last_update**. Assuming no version - clearly we can use "last time this advisory was updated" to define 'newer'. Alas, some repository-types don't fill this field in. * **issue_date**. If there's no version and no last_updated, an advisory does have an issue_date. But in the repository-modify case, it's possible to have three advisories that have identical version/update/issue dates, but different metadata. The only thing pulp has control over are the ``core_content`` fields **pulp_created** and **pulp_last_updated**. Of those, **pulp_created** is always there. ### Proposal, No Fatalities! The current fatal-error heuristics in the merge process are quite possibly saving users who've made an error from themselves. But, they are just heuristics - we don't **know** that we're saving the user (as opposed to just getting in their way). One simplifying assumption can be summed up as "The User Knows Best," and we drop the fatal-error cases completely. ### Proposal, dates Advisories have two newer-than functions: * **advisory_newer**(n,m): prefers version > update_date > issue_date. Returns -1 n newer, 0 equal, 1 n older * **pulp_newer**(n,m): prefers pulp_last_updated > pulp_created. Same returns. * **advisory_newest**([n,m,...]): Returns most-recent of advisories in list, can be a tuple * **pulp_newest**([n,m,...]): Returns singleton newest, period. When faced with two or more advisories with the same id (e.g., 'RHSA-202:12345'), Pulp3 will * choose the 'most recent', metadata and related collections * if **advisory_newer** is equal, choose **pulp_newer** for metadata and merge related collections. Consider the following 3-advisory scenarios. * adv(n,m) is advisory_newest, p(n,m) is pulp_newest(): * adv([A,B,C]) => [A] * A metadata and relations * adv([A,B,C]) => [B,C] * union B and C relations, in-storage metadata * adv([A,B,C]) => [A,B,C] * union relations, metadata from p([A,B,C]) ### Proposal, digests The digest field has some problems: * Hash based on output of createrepo_c * No ordering-control * Applies to the entire advisory, no way to separate metadata from collection-changes To address these we could: * Break createrepo output into multiple sections * metadata * package-list * reference-list * Enforce field-ordering on metadata * Enforce ordering on package- and reference-list * prepare digests for each separate section * leave current digest 'as is' This would a) separate us from createrepo_c()'s output-ordering, and b) let us know which parts of an advisory have changed without having to read in package- and reference-lists. The migration to fill these in 'correctly' if we go this route will, of course, be...exciting. ###### tags: `advisories`, `RPM`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully