Project

Profile

Help

Issue #3999

Publishing incorrect branch head.

Added by jortel@redhat.com about 2 years ago. Updated over 1 year ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
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 - COMPLETE<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>
Has duplicate OSTree Support - Issue #4276: Ostree repo with custom depth set returns errorCLOSED - DUPLICATE<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision dfe2d07e View on GitHub
Added by jortel@redhat.com almost 2 years ago

Publish correct branch head and depth. closes #3999

History

#1 Updated by jortel@redhat.com about 2 years ago

  • Description updated (diff)

#2 Updated by jortel@redhat.com about 2 years ago

  • Description updated (diff)

#3 Updated by CodeHeeler about 2 years ago

  • Triaged changed from No to Yes

#4 Updated by jortel@redhat.com almost 2 years ago

  • Sprint set to Sprint 46

#5 Updated by jortel@redhat.com almost 2 years ago

  • Sprint changed from Sprint 46 to Sprint 45

#6 Updated by jortel@redhat.com almost 2 years ago

  • Status changed from NEW to POST

#7 Updated by jortel@redhat.com almost 2 years ago

  • Status changed from POST to MODIFIED

#8 Updated by amacdona@redhat.com almost 2 years ago

  • Assignee set to jortel@redhat.com

#9 Updated by bherring almost 2 years ago

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

#10 Updated by daviddavis almost 2 years ago

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

#12 Updated by jortel@redhat.com over 1 year ago

  • Platform Release set to 2.18.1

#13 Updated by jortel@redhat.com over 1 year ago

  • Status changed from MODIFIED to 5

#14 Updated by jortel@redhat.com over 1 year ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE

#15 Updated by bmbouter over 1 year ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF