Bug 1279282

Summary: [RFE] DNF should only update cache/metadata in the background, unless you specify otherwise.
Product: [Fedora] Fedora Reporter: Audrey Yeena Toskin <audrey>
Component: dnfAssignee: rpm-software-management
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: audrey, jmracek, jsilhan, mluscon, packaging-team-maint, pnemade, vmukhame
Target Milestone: ---Keywords: FutureFeature, Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-09 08:21:32 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:

Description Audrey Yeena Toskin 2015-11-09 02:45:16 UTC
## Description of problem:

DNF by default is already configured to periodically update the repo cache / metadata. So it's a little annoying when DNF stops to update the cache again when running certain commands, such as `repoquery`. Especially if you have enabled several external repositories, you may have to wait a while before you can get back to what you were doing.


## Possible solution:

DNF should only update its cache under two conditions:

1. Whenever DNF runs its periodic updates *in the background*.
2. When the user runs the `makecache` subcommand or adds the `--refresh` switch to the commandline.

Comment 1 Honza Silhan 2015-11-18 12:53:47 UTC
+
3. when DNF consider them as expired (see metadata_expired [1] configuration option in /etc/dnf/dnf.conf).

You can set it to higher value or completely disable (-1)

[1] http://dnf.readthedocs.org/en/latest/conf_ref.html

Comment 2 Audrey Yeena Toskin 2015-11-19 04:23:41 UTC
What? No, I don't want to disable automatic refreshing of the cached metadata. My point is that it's silly for commands like repoquery to trigger a refresh of all repositories, since dnf by default is already configured to look for updates in the background.

Perhaps we should look at it from another perspective: If a user wants to *manually* update the metadata, there are commands (makecache) and command switches (--refresh) to do so. However, if a user *does not* want to trigger extra refreshes, they have no options, and they will be forced to wait for repo information to download again when running certain dnf commands.

Comment 3 Audrey Yeena Toskin 2015-11-30 22:58:59 UTC
Perhaps there is a better solution than the one I suggested, but I don't believe changing the time expire the metadata is it. So, I'm sorry, but I don't think Jan's response really addresses the problem.

Automatic background checks for updated metadata is already fine and good. Triggering *another* refresh for simple commands (such as a --what-provides for something already installed) forces the user to wait for what should be a very simple query. It's bad User Experience.

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

Comment 5 Jaroslav Mracek 2016-08-08 11:45:30 UTC
I would like ask you about user that you use to run command ``dnf repoquery``. If you run it with root or sudo it use root's metadata cache, but if you run it like other user, you will see, that dnf download another cache. Same is applied for dnf clen command. You delete different cache if you run ``dnf clean all`` and ``sudo dnf clen all``.

Comment 6 Audrey Yeena Toskin 2016-08-08 23:35:41 UTC
I normally only run commands with sudo if it's required, so I run `dnf repoquery` as my regular user.

Maintaining a separate cache for each user seems silly: On a multi-user rig, anyone may be curious about the applications and dependencies installed on the system, but only one user account can install, remove, or upgrade packages.

Comment 7 Jaroslav Mracek 2016-08-09 08:21:32 UTC
Just think about cache problem. Just look at following questions. If every user will use only single cache - 
1. Can every user read single copy of cache - yes
2. Can every user modified or overwrite single copy of cache - no, this behavior could be a security problem. But if some user cannot modified cache, therefore they cannot download new metadata even if they are expired, corrupted or unavailable. Therefore some users can be very surprise. Also the present behavior has down-site like more space is required, presence of different versions of metadata can result in different results (commands that do not refresh metadata like with 'dnf list extras'). Also the solution could be to allow use of dnf only with root account, but it is even worse. I think there is not a perfect solution for this case. I can say feel free to help with dnf development, any contribution is welcome.

Anyway the present behavior is not a bug, therefore I am closing the report.

Comment 8 Audrey Yeena Toskin 2016-08-09 21:12:44 UTC
Sorry, Jaroslav, I didn't understand half of what you said. If only root can actually change packages, then what does it matter if other users make simple queries based on slightly out-of-date information? It is the administrator's responsibility to keep the cache and packages up-to-date. For other users, DNF queries merely satisfies their curiosity.

In fact, having only a single copy of the cache would also mean that it should *always* be up-to-date, because the dnf cache updater by default runs on a timer. If there were only one cache, everyone would always have the latest information!

Which brings me back to my point in the original post: Since dnf already regularly updates its cache in the background, triggering a cache update for repo queries and other commands is a waste of time.

I'm starting to feel bad for continually harping on this issue. I'm willing to be wrong here. But you haven't actually addressed the problem I'm talking about.

* DNF by default is set up to update its cache in the background.
* If the local administrator is really concerned, there are ways to force a metadata update, such as the makecache subcommand, or the --refresh flag.
* Therefore, why bother triggering updates *again* for dnf repoquery?

Comment 9 Jaroslav Mracek 2016-08-10 07:14:03 UTC
Thank you very much for your report. There are plans to change the behavior even with cooperation with other software management tools to use single copy of metadata, but we cannot promise any time period when it happen.