I have a number of mirrors of Redhat YUM repositories, which are updated on a daily basis. The commands that are used to accomplish this are:
reposync --repoid=${i} --download_path=${destdir} --gpgcheck -l --download-metadata --downloadcomps --newest --delete
createrepo -s sha256 --checkts --update --workers=4 -g $destdir/$fn/comps.xml
The variables (i, destdir and fn) are set in the script that issues the commands. This works all very well, and the team has been using the mirrors to good effect.
The problem is that, after a year or so, one of the repositories has accumulated an impressive stack of updateinfo xml files, with names of the pattern <hash>-updateinfo.xml.gz: 456MB in the top directory and 28.45GB in the repodata subdirectory. The repository contains only 4GB of package files.
Clients that do a yum makecache on this repo end up with a 4GB repmod.xml file.
My questions are
- Why do these files accumulate, even though I have --delete specified.. ?
- Can I remove them without breaking the repository?
- Are the parameters that I use the most optimal? We want to mirror a complete repo, but only the latest version of every package.
EDIT 4/6/2018
After deeper digging I found some more hints that these files are in fact not required.
The <hash>updateinfo.xml.gz files in the top directory in the repository are all more or less the same size, about 3.8M. The files in the repodata directory (which is created/updated by createrepo) constantly grow in size due to all files in the top directory being concatenated.
e.g.: in this repodata directory, I've got 129 gzipped files. The first file has the same average size as the ones in the top directory, the last is huge and has 129 updates tags, against the first one only 1.
# l -tr
total 29G
-rw-r--r-- 1 root root 3.5M Sep 28 2016 6f9c8bca09bb360b0ac2c18231168d45aa6ef51254fee7b791c6d09693677f4c-updateinfo.xml.gz
...
-rw-r--r-- 1 root root 465M May 17 03:21 1696bec0516791660751bb4a319b287f2a3a5ecfee086aefb73285f07cad3ac5-updateinfo.xml.gz
drwxr-xr-x 3 root root 20K May 22 12:37 ../
# gzip -dc 1696bec0516791660751bb4a319b287f2a3a5ecfee086aefb73285f07cad3ac5-updateinfo.xml.gz >updateinfo-big.xml
# gzip -dc 6f9c8bca09bb360b0ac2c18231168d45aa6ef51254fee7b791c6d09693677f4c-updateinfo.xml.gz >updateinfo.xml
# grep '<updates>' updateinfo.xml |wc -l
1
# grep '<updates>' updateinfo-big.xml |wc -l
129
# ls -1 *updateinfo.xml.gz|wc -l
129
# l updateinfo*
-rw-r--r-- 1 root root 2.4G Jun 4 17:09 updateinfo-big.xml
-rw-r--r-- 1 root root 18M Jun 4 17:10 updateinfo.xml
I guess that the reposync should remove any existing updateinfo.xml.gz files in the top directory before the createrepo runs over it. The client gets the latest gzipped file from the repodata directory when it does a makecache, and unzips it.
I've moved the stack to a backup directory after posting the question above and saw no adverse effects on the clients.
createrepo
touches the updateinfo file, and so the next reposync creates a new one. Related: bugzilla.redhat.com/show_bug.cgi?id=1383463