Bug 1679736

Summary: Incremental export of repository does not create proper repodata.
Product: Red Hat Satellite Reporter: Suraj Patil <supatil>
Component: Inter Satellite SyncAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Lai <ltran>
Severity: medium Docs Contact:
Priority: high    
Version: 6.3.5CC: bbuckingham, cduryee, daviddavis, ehelms, jturel, lee.huynh2, ltran, mkalyat, paji, sadas
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-16 14:59:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Initial repository import
none
After incremental import none

Description Suraj Patil 2019-02-21 18:14:16 UTC
Description of problem:

When we do the incremental export of the repository, it creates the repodata only for the content(rpms) which is included in the incremental export. This repodata is useless because when we copy the exported content to the disconnected satellite where previous/initial content is present it overrides the repomd file which then points to the new repodata which does not have the details of previous content.

If we import this content to the satellite then satellite also contains only new repodata and systems connected to satellite can not get the old content(rpms) which were initially synced.


Version-Release number of selected component (if applicable):
Satellite 6.3.5

How reproducible:
You will need two satellite connected and disconnected. Connected satellite should have some repository which is synced in the past.

Steps to Reproduce:
1. Export the repository using hammer
2. Copy the exported content to disconnected satellite and import it in the disconnected satellite
3. Now on the connected satellite sync the repository again, so you will get some new packages.
4. Do the incremental export of the repository.
5. Observed the new exported data. Repodata only contains the details of new rpms
6. Copy new data into the disconnected satellite and import it. Now satellite will only have information of the new content(rpm).


Actual results:
Incremental export creates the repodata with only new content.

Expected results:
Incremental export should create the repodata which includes the initial exported content or all the content.


The whole procedure of moving repo content from a connected Satellite to a disconnected one needs to be rethought

Additional info:

I am attaching two screenshots from the disconnected satellite. In that you can see the package count when content is imported initial and after incremental import.

Comment 3 Suraj Patil 2019-02-21 18:17:00 UTC
Created attachment 1537150 [details]
Initial repository import

Comment 4 Suraj Patil 2019-02-21 18:17:48 UTC
Created attachment 1537151 [details]
After incremental import

Comment 5 David Davis 2019-02-21 20:20:25 UTC
I'm not sure this is a Pulp bug. Katello, can you check and perhaps give us a reproducer against Pulp?

Comment 6 Lee 2019-02-25 18:56:26 UTC
I found an unofficial way to get around to resync the whole content using createrepo command. Here is the procedure:
1. Go to repodata directory and take a note of checksum type in repomd.xml file
# cd ../6Server/x86_64/os/repodata
# grep "checksum type" repomd.xml
2. Run createrepo
# createrepo -s sha1 ../6Server/x86_64/os
3. Change back permission
# chmod 755 -R repodata
4. Doing the normal synchronization

Comment 8 Chris Duryee 2019-03-11 20:12:03 UTC
(In reply to Suraj Patil from comment #0)
> Description of problem:
> 
> When we do the incremental export of the repository, it creates the repodata
> only for the content(rpms) which is included in the incremental export. This
> repodata is useless because when we copy the exported content to the
> disconnected satellite where previous/initial content is present it
> overrides the repomd file which then points to the new repodata which does
> not have the details of previous content.
> 

When you copy the data over, do you copy the new directory on top of the old one, or do you move the old one first?

Comment 9 Lee 2019-03-14 20:14:09 UTC
We have to copy the new directory on top of the old one. I don't know other way because we have incrementally synced every week. Doing your way will have to move the old one every time

Comment 10 Chris Duryee 2019-03-18 13:01:20 UTC
the incremental export is not a file-level incremental that can be copied on top of existing repodata. It is a set of repos that contains just the RPMs that have been synced since the last export. For example, if you had rpms A and B and performed an export, then synced and got a new rpm C and performed another export with a date before C but after A and B, you'd get a yum repo with just C in it. You should be able to sync this into the disconnected Satellite with "mirror on sync" disabled and the disconnected satellite would then have A, B and C.

If you copied the new export repo with just C on top of the old export, you'd get a repo with A, B and C (since A and B were not deleted) but the repodata would only be aware of C.

Are you looking for more of a file-level delta that can be applied to an existing repo tree?

Comment 11 Lee 2019-03-18 16:33:17 UTC
The real problem is when we rebuild the disconnected satellite server. All repos data are in /var/lib/import which is under /var/lib filesystem and are intact. However, after satellite software is reinstalled, we try to sync the existing repos and it syncs only the most recent incrementally exported data which is rpm C. Therefore, to make it to sync all A,B,C, we have to run createrepo on every repo. This will create a new repomd.xml file that includes all A,B,C.

Comment 12 Suraj Patil 2019-03-30 11:06:18 UTC
Hello Chris,

What you said is correct, If I copy the new export over the old all the packages are intact but the issue is with repodata. At this point repodata only contains C package. 

I am aware of "mirror on sync" option, and till the point, I remember in my satellite "mirror on sync" was disabled and still after the import satellite was only having the repodata of package C.
I will try to reproduce this again just to confirm "mirror on sync" option and will let you know.

Comment 13 Suraj Patil 2019-04-10 10:58:21 UTC
Hello,

I have reproduced it again and confirmed that if "mirror on sync" is disabled and this time satellite say new 731 packages found and In repository details it shows 21076(old package count) + 731(New packages) = 21807. This means that "mirror on sync" option works. 

But not sure what I did wrong because newly exported incremental repository, show package count 23927 in repodata. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@satellite 1554824079.59]# zcat /var/www/html/pub/sat-import/Example/Library/content/dist/rhel/server/7/7Server/x86_64/os/repodata/c5510a36e3ee920a1901a716d070c71f06303cd5-primary.xml.gz | head
<?xml version="1.0" encoding="UTF-8"?>
<metadata packages="23927" xmlns="http://linux.duke.edu/metadata/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm"><package type="rpm">
  <name>openssl-devel</name>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So total package count should be 23927. I still ask the customer if he is using "mirror on sync" option.

Comment 21 Brad Buckingham 2021-07-16 14:59:33 UTC
Satellite 6.10 introduces Pulp 3.  With that change, the export/import capabilities of Satellite have been re-written and enhanced to enabled support for both full as well as incremental export/import.  The support for incremental was verified with bug 1944733; therefore, closing this bugzilla as a duplicate.

If there are any questions or concerns, please do let us know.  Thanks!

*** This bug has been marked as a duplicate of bug 1944733 ***

Comment 22 Red Hat Bugzilla 2024-01-06 04:26:09 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days