Open cgwalters opened 2 years ago
This is either related or duplicate of #1885.
You're right, this overlaps a lot with previous threads, however, this one is much more about OCI/Docker containers than the previous ones.
There are two approaches to fix this:
The ability to overlay a tree with extra packages is also part of the motivation for #1959. Meanwhile a q&d solution for containers would be to add eg a plugin to dnf that dumps the database after the transaction and then deletes the database. On startup it could import those headers again if no db exists yet (cat *|rpmdb --importdb).
https://github.com/lnussel/toy/blob/master/dumpheaders.c stores rpm headers in separate files in contrast to rpmdb --exportdb. In #1959 are also commits that allow use of packages (with or without payload) for that purpose.
The way OCI/Docker containers work is a series of layers. In overlayfs, modified files are "copied up".
There are two issues:
In the common case of something like e.g.
The resulting tar layer from the
RUN
command has an entirely duplicated copy of the rpm database, just withcowsay
and its dependencies added.It's quite common for builds like this to actually form the base image for further images - and this duplication gets compounded.
A strawman proposal here is something like
/usr/lib/sysimage/rpmdb.d
with something simple like zstd-compressed JSON files storing data instead. The files could be named something simple like0000.json.zstd
and then later changes which add packages add just a new0001.json.zstd
file or so. Or, we could keep sqlite and union those; I don't have a really strong opinion. (Well, not really "union" literally but more "merge", since we should support removing or upgrading packages from prior layers)