Bug 1194222

Summary: [perf] dnf reinstall `rpm -qa` is slow
Product: [Fedora] Fedora Reporter: Daniel Mach <dmach>
Component: dnfAssignee: rpm-software-management
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: rawhideCC: dmach, jmracek, kparal, lkocman, mluscon, packaging-team-maint, pbrobinson, pnemade, tim.lauridsen, zkabelac
Target Milestone: ---Keywords: Reopened, Tracking, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-05-22 11:59:49 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:
Bug Depends On: 1167239    
Bug Blocks: 1156501    

Description Daniel Mach 2015-02-19 11:13:18 UTC
I was upgrading f21 to f22 and it crashed.
I ended up with quite inconsistent installed package set, which I had to fix manually. As part of that, I reinstalled all existing packages by running:
$ dnf reinstall `rpm -qa`

It takes a long time before depsolving starts.
I suppose lookups for individual packages are slow.
Is there a way how to speed it up?

This is a low priority fix, probably falling into nice-to-have category.

Comment 1 Honza Silhan 2015-04-16 15:53:27 UTC
Thanks for the report. The bottleneck could be in accessing yumdb (filesystem) for `from_repo` flag. This could be fixed by swdb arrival. Btw yum is a lot slower.

Comment 2 Daniel Mach 2015-04-17 08:31:59 UTC
Isn't yumdb loaded to memory when dnf/hawkey starts?

I think this is rather caused by retrieving 1 package at a time.
It would be nice if the query worked like this (I'm making this completely up):

input:
query([pattern1, pattern2, pattern3, ...])

output:
[
   [all pkgs matching pattern1],
   [], # <-- nothing matches pattern 2
   [all pkgs matching pattern3],
   ...
]

Comment 3 Zdenek Kabelac 2015-06-23 13:31:53 UTC
See my closed Bug 536818

From the POV of our 'rpm' developers problem is solved ;)

Comment 4 Zdenek Kabelac 2015-06-23 13:35:01 UTC
Comment 2 relates only for the timing  of  'rpm -qa' operation.

Comment 5 Honza Silhan 2015-07-29 11:37:58 UTC
*** Bug 1234907 has been marked as a duplicate of this bug. ***

Comment 6 Radek Holy 2015-07-29 12:02:25 UTC
*** Bug 1236046 has been marked as a duplicate of this bug. ***

Comment 7 Fedora Admin XMLRPC Client 2016-07-08 09:30:31 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 8 Fedora End Of Life 2016-07-19 20:52:41 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 9 Jaroslav Mracek 2017-03-27 15:40:08 UTC
Please can you try "sudo dnf reinstall '*' --assumeno" ?

It required only 2.2s and it has same functionality as reported syntax (but it do not report if package cannot be reinstalled). 

Syntax "sudo dnf reinstall `rpm -qa` --assumeno" required 36.3s what is not terrible I would say.

Syntax "sudo yum-deprecated reinstall `rpm -qa` --assumeno" required about 300s.

Tested on dnf-2.1.1_1-11g5af2514.fc25.noarch.

Are you satisfy with this result or 36s is too long?

Comment 10 Daniel Mach 2017-05-22 11:59:49 UTC
Reinstalling '*' works like a charm. It takes just couple seconds.

I used the
dnf reinstall `rpm -qa`
command as an example of poor query performance.
I think it works a bit faster.

As I'm part of the DNF team now, I'm closing the bug myself.