Skip to content

Conversation

@m-blaha
Copy link
Member

@m-blaha m-blaha commented Sep 17, 2024

Introduce a new API to clear all solvables from the system repo and
reload fresh data from the RPM database.

Re-creating the Base object can be resource-intensive, and there is a
use case in dnfdaemon where the current session (which wraps around the
Base instance) needs to be reused even after executing an RPM
transaction - whether for queries or running another transaction.

For: #1653

Introduce a new API to clear all solvables from the system repo and
reload fresh data from the RPM database.

Re-creating the Base object can be resource-intensive, and there is a
use case in dnfdaemon where the current session (which wraps around the
Base instance) needs to be reused even after executing an RPM
transaction - whether for queries or running another transaction.
@m-blaha
Copy link
Member Author

m-blaha commented Sep 17, 2024

@jrohel @kontura do you see any issues with this?
It can also be used by dnfdaemon to handle messages from rpm-plugin-dbus-announce rpm plugin.

@kontura
Copy link
Contributor

kontura commented Sep 17, 2024

@jrohel @kontura do you see any issues with this? It can also be used by dnfdaemon to handle messages from rpm-plugin-dbus-announce rpm plugin.

It does make me feel uneasy. It basically invalidates the pool right? Libsolv ids might have changed. So any Package object, Goal or PackageQuery in progress should be invalidated as well.

If I understand correctly for example existing Package could simply transform into a different one after the reload is used. I could see this causing quite hard to find bugs.

@m-blaha
Copy link
Member Author

m-blaha commented Sep 17, 2024

Yes, that's right. Any place that keeps an id of an installed package is invalid after this call.

@jan-kolarik jan-kolarik self-requested a review September 17, 2024 14:45
}

void SolvRepo::empty() {
// TODO(mblaha): is resuseid=true safe enough?
Copy link
Contributor

@jrohel jrohel Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code from libsolv:

  if (reuseids && repo->end == pool->nsolvables)
    {
      /* it's ok to reuse the ids. As this is the last repo, we can
         just shrink the solvable array */

It looks like reuseids works only when the repo is last. DNF places the system repo first. Behind it are available repos. The system repo is last only if it is the only one (we don't have available repos loaded).

Note:
OK. Maybe after the first reload the system repository will be the last one.

@jrohel
Copy link
Contributor

jrohel commented Sep 18, 2024

You are introducing a new API method void reload_system_repo(). DNF saves the system repository to the pool first, followed by the others. Thus, installed solvables have a lower id than available. What do you expect to happen after calling the libsolv function repo_empty(repo, true) when there are other repos after the repo? Will space and solvables ids be able to be reused? I'm not sure about that. And what if the new system repo is larger (a package has been installed)? Surely the repo won't fit in the original space. Will the entire repo be saved to the end of the pool? Or will it be scattered in the pool - part in the original location and part at the end of the pool?

When we sort packages and they have the same nevra, the solvable id comes into play. Thus, moving the system repo to the end affects the sorting of the packages. The question is how much does it matter.

In general we are getting into the untested area of using libsolv.

@jan-kolarik jan-kolarik removed their request for review March 6, 2025 13:40
We would like to switch to exclusively using Packit for building and
testing pull requests, so we are retiring this GitHub Action workflow.
We will want to configure Packit to check that DNF5 compiles with both
GCC and clang, like the Package Build action did.

In order to fully disable the action, this commit must be applied on
each branch in the upstream DNF5 repository. Otherwise, the action might
be triggered by a pull request to some stale branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants