Project

Profile

Help

Issue #3999

closed

Publishing incorrect branch head.

Added by jortel@redhat.com about 6 years ago. Updated over 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version - OSTree:
Platform Release:
2.18.1
Target Release - OSTree:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Sprint 45
Quarter:

Description

Problem

The ostree plugin creates a `Branch` content (units) for each commit in each branch history. Each `Branch` has a _created timestamp that is used by the publisher to determine the branch HEAD for each branch. Because Branch._created is the timestamp when pulp created the record in the DB instead of the timestamp of the commit. As a result, subsequent syncs with a deeper history (depth increased), a newer Branch content (unit) can be created for an older commit. This causes the publisher, which is sorting on _created, to incorrectly determine the branch HEAD. Publishing the branch with a HEAD that is not the latest commit in the history means the history is not deep enough to satisfy the depth requirement.

Example:

depth=3 branch=A

Fetch (PULL) history for branch=A:
commit-9
commit-8
commit-7

Create content (unit):

commit-7 _created: 2018-01-01
commit-8 _created: 2018-01-02
commit-9 _created: 2018-01-03

Change the depth to 4:

Fetch (PULL) history for branch=A:
commit-9
commit-8
commit-7
commit-6

Create content (unit):

commit-6 _created: 2018-01-04

List content (sorted by _created):
commit-7 _created: 2018-01-01
commit-8 _created: 2018-01-02
commit-9 _created: 2018-01-03
commit-6 _created: 2018-01-04 <-- uh-oh

Now the publisher (sorting by _created) incorrectly determines commit-6 is the branch HEAD and tries to do a PULL-LOCAL on commit-6 with depth=4. libostree will attempt to pull commit-6's parent (commit-5) but it's not in pulp's storage (ostree) repository because the depth=4 keep it from being fetched.

GLib.Error('Importing commit-5.commit: linkat: No such file or directory', 'g-io-error-quark', 1) (Katello::Errors::PulpError)

Proposed Solution

Discontinue storing and using

Branch._created

to determine branch commit ordering. Then, add

Branch.parent

that contains the parent commit ID. Basically, model the parent/child commit chain just as OSTree does. This provides a deterministic method of maintaining the commit chain that will support rebasing and changing traversal depth.

The importer would pull the history (as it does currently) and set the commit and parent when creating a Branch content (unit). Further, it would need to update any existing Branch content (units) that have been re-parented by either rebase or an increase in traversal depth.

The publisher would determine the branch HEAD based on walking the commit chain.

This will require a migration that would need to iterate all of the Branch content (units) and unset

Branch._created

and set

Branch.parent

using the history.

Questions

1. When a commit is (re)parented, the Branch.parent will need to be updated. What problems might this cause?


Related issues

Related to Pulp - Test #4258: Publishing incorrect branch head.CLOSED - COMPLETEbherringActions
Has duplicate OSTree Support - Issue #4276: Ostree repo with custom depth set returns errorCLOSED - DUPLICATEActions
Actions #1

Updated by jortel@redhat.com about 6 years ago

  • Description updated (diff)
Actions #2

Updated by jortel@redhat.com about 6 years ago

  • Description updated (diff)
Actions #3

Updated by CodeHeeler about 6 years ago

  • Triaged changed from No to Yes
Actions #4

Updated by jortel@redhat.com about 6 years ago

  • Sprint set to Sprint 46
Actions #5

Updated by jortel@redhat.com about 6 years ago

  • Sprint changed from Sprint 46 to Sprint 45

Added by jortel@redhat.com almost 6 years ago

Revision dfe2d07e | View on GitHub

Publish correct branch head and depth. closes #3999

Actions #6

Updated by jortel@redhat.com almost 6 years ago

  • Status changed from NEW to POST
Actions #7

Updated by jortel@redhat.com almost 6 years ago

  • Status changed from POST to MODIFIED
Actions #8

Updated by amacdona@redhat.com almost 6 years ago

  • Assignee set to jortel@redhat.com
Actions #9

Updated by bherring almost 6 years ago

  • Related to Test #4258: Publishing incorrect branch head. added
Actions #10

Updated by daviddavis almost 6 years ago

  • Has duplicate Issue #4276: Ostree repo with custom depth set returns error added
Actions #12

Updated by jortel@redhat.com almost 6 years ago

  • Platform Release set to 2.18.1
Actions #13

Updated by jortel@redhat.com almost 6 years ago

  • Status changed from MODIFIED to 5
Actions #14

Updated by jortel@redhat.com over 5 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE
Actions #15

Updated by bmbouter over 5 years ago

  • Tags Pulp 2 added

Also available in: Atom PDF