-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compose: Add rpmdb option, default to bdb #2221
Conversation
Marking draft for lack of tests, but I did validate this works manually by creating a f33 version of my dev container, building rpm-ostree in that and validating two things:
|
Yeah, that's probably the cleaner approach overall. For FCOS at least, we could opt into sqlite much earlier than f34 because we have update barriers. I don't think we gain anything major on the technical side by doing it earlier, but it does have better optics to match the rest of Fedora. |
04f41ed
to
2221558
Compare
OK I added some basic tests, but actually testing the sqlite path would require us to build a f33 cosa which we should do, just not sure I want to block on it. |
src/libpriv/rpmostree-core.c
Outdated
const char *db_backend = "bdb"; | ||
if (self->treefile_rs && ror_treefile_get_sqlite (self->treefile_rs)) | ||
db_backend = "sqlite"; | ||
dnf_context_set_rpm_macro (self->dnfctx, "_db_backend", db_backend); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, but actually shouldn't this be something like:
const char *db_backend = "bdb"; | |
if (self->treefile_rs && ror_treefile_get_sqlite (self->treefile_rs)) | |
db_backend = "sqlite"; | |
dnf_context_set_rpm_macro (self->dnfctx, "_db_backend", db_backend); | |
if (self->treefile_rs) | |
dnf_context_set_rpm_macro (self->dnfctx, "_db_backend", ror_treefile_get_rpmdb (self->treefile_rs) ?: "bdb"); |
On the client side, we don't want to touch this macro at all, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking more on this, I think what we want to do is also drop a file in /usr/lib/rpm/macros.d
so it's part of the commit itself. So then dnf_context_set_rpm_macro
would only be used server-side to make sure the baked rpmdb type matches the macro we write in postprocessing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking more on this, I think what we want to do is also drop a file in /usr/lib/rpm/macros.d so it's part of the commit itself.
Hmm. But that also will be picked up by any kind of "yum --installroot" that happens to run from the host context. I believe we'll transparently inherit the "base commit" default because rpm will autodetect the database type in the target root. I think. But we clearly need to test that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RPM does do this correctly, as long as there's only one type of rpmdb in the rpmdb path. If there are two different types and one is specified in configuration, that one wins.
2221558
to
d19b7db
Compare
d19b7db
to
179a0f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the commit message say "default to bdb"? Apart from that, just one final comment about a comment.
src/libpriv/rpmostree-core.c
Outdated
@@ -753,6 +753,13 @@ rpmostree_context_setup (RpmOstreeContext *self, | |||
/* This is what we use as default. */ | |||
dnf_context_set_rpm_macro (self->dnfctx, "_dbpath", "/" RPMOSTREE_RPMDB_LOCATION); | |||
|
|||
// Default for now for compat reasons |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment should be on the Rust side now.
@jlebon It should default to whatever rpm defaults, rather than picking something. For Fedora, that'll be SQLite. For openSUSE, that'd be NDB. For RHEL (for now), that'll be BDB. |
No - rpm-ostree is too strongly oriented towards "cross" builds. Perhaps in the future we could add an "auto" which inherits whatever the "host" librpm default is though. |
The design of https://fedoraproject.org/wiki/Changes/Sqlite_Rpmdb is problematic for us for multiple reasons. The first big reason is that rpm-ostree is designed for "cross" builds and e.g. today we use a Fedora-derived container to build RHEL CoreOS images. However the default database lives inside the `rpm` package which means that if we e.g. upgrade the coreos-assembler container to F33 it will suddenly try to use sqlite for RHCOS which is obviously broken. Related to this, rebases from f32 to f33 w/layered packages are broken: https://bugzilla.redhat.com/show_bug.cgi?id=1876194#c3 With this we can configure things to continue to use bdb for f33 for ostree-based systems, so that by enforcing an upgrade order f32 → f33 [bdb] → f34 [sqlite] ... the intermediate f33 w/bdb still understands sqlite and hence rebases will work.
179a0f0
to
279e407
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cgwalters, Conan-Kudo, jlebon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
If anything, the default should somehow inherit from the target - but that's tricky to do automatically. Maybe in the future since repodata XML is enormous anyways we can do things like stick a tiny bit of metadata in there that has things like |
@cgwalters "auto" is the behavior now, though, so absent this code, it should do that already. |
It's auto only from the host which is wrong for the reason mentioned in the commit message:
|
A few goodies, but mostly to get coreos#2221 out.
A few goodies, but mostly to get #2221 out.
The design of https://fedoraproject.org/wiki/Changes/Sqlite_Rpmdb
is problematic for us for multiple reasons. The first big reason
is that rpm-ostree is designed for "cross" builds and e.g. today
we use a Fedora-derived container to build RHEL CoreOS images.
However the default database lives inside the
rpm
package whichmeans that if we e.g. upgrade the coreos-assembler container to F33
it will suddenly try to use sqlite for RHCOS which is obviously broken.
Related to this, rebases from f32 to f33 w/layered packages
are broken: https://bugzilla.redhat.com/show_bug.cgi?id=1876194#c3
With this we can configure things to continue to use bdb for f33
for ostree-based systems, so that by enforcing an upgrade order
f32 -> f33 [bdb] -> f34 [sqlite] ... the intermediate f33 w/bdb
still understands sqlite and hence rebases will work.