Bug 1226724 - dnf redownloads metadata already downloaded with the same checksums
Summary: dnf redownloads metadata already downloaded with the same checksums
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-31 22:50 UTC by Enrico Scholz
Modified: 2017-05-05 12:42 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-05 12:42:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Enrico Scholz 2015-05-31 22:50:04 UTC
Description of problem:

dnf downloads everytime the full metadata although it has not changed.  E.g. I have a local mirror (which definitively does not changed between the calls below), but I see:

[root@sheridan ~]# date; dnf upgrade
Mon Jun  1 00:38:13 CEST 2015
Fedora 22 - x86_64 - Misc                                             3.8 MB/s |  73 kB     00:00    
RPM Fusion for Fedora 22 - Nonfree - Updates                           41 kB/s | 257  B     00:00    
Fedora 22 - x86_64 - Local                                            3.2 MB/s |  34 kB     00:00    
RPM Fusion for Fedora 22 - Free - Updates                              43 kB/s | 257  B     00:00    
Fedora 22 - x86_64 - Base (Install)                                   4.9 MB/s | 210 kB     00:00    
Fedora 22 - x86_64 - Base                                             7.7 MB/s |  22 MB     00:02    
Fedora 22 - x86_64 - Updates                                          7.4 MB/s | 2.3 MB     00:00    
RPM Fusion for Fedora 22 - Free                                       6.6 MB/s | 479 kB     00:00    
RPM Fusion for Fedora 22 - Nonfree                                    6.0 MB/s | 130 kB     00:00    
Last metadata expiration check performed 0:00:00 ago on Mon Jun  1 00:38:17 2015.
Dependencies resolved.

----------------

[root@sheridan ~]# date; dnf upgrade
Mon Jun  1 00:38:24 CEST 2015
Fedora 22 - x86_64 - Misc                                             4.3 MB/s |  73 kB     00:00    
RPM Fusion for Fedora 22 - Nonfree - Updates                           34 kB/s | 257  B     00:00    
Fedora 22 - x86_64 - Local                                            2.4 MB/s |  34 kB     00:00    
RPM Fusion for Fedora 22 - Free - Updates                              40 kB/s | 257  B     00:00    
Fedora 22 - x86_64 - Base (Install)                                   4.8 MB/s | 210 kB     00:00    
Fedora 22 - x86_64 - Base                                             8.1 MB/s |  22 MB     00:02    
Fedora 22 - x86_64 - Updates                                          7.9 MB/s | 2.3 MB     00:00    
RPM Fusion for Fedora 22 - Free                                       7.0 MB/s | 479 kB     00:00    
RPM Fusion for Fedora 22 - Nonfree                                    5.4 MB/s | 130 kB     00:00    
Last metadata expiration check performed 0:00:00 ago on Mon Jun  1 00:38:28 2015.
Dependencies resolved.

------


Note the 22 MB download, which is annoying when done over a slow wifi connection.

yum downloaded only the small 'repomd.xml' and used it to decide whether further downloads are required.



Version-Release number of selected component (if applicable):

dnf-1.0.0-1.fc22.noarch


How reproducible:

100%

Comment 1 Honza Silhan 2015-06-01 10:40:06 UTC
Hi, it caches metadata. You see the checking if metadata are up-to-date. You can set different metadata expire policy by `metadata_expire` option in each repo config file (etc/yum.repos.d/*.repo) or wait for bug 850896 to be implemented.

Comment 2 Enrico Scholz 2015-06-01 11:12:03 UTC
metadata_expire is set to 0 which works fine in yum. Higher values cause too large latencies and fetching the small repomd.xml (< 10KiB) does not matter.

Using other protocols for metadata download (as discussed in 850896) is an orthogonal problem which deals with downloading *new* metadata.

Comment 3 Honza Silhan 2015-07-24 09:28:10 UTC
We should not download metadata with the same checksums even when they are marked as expired.

Comment 4 Miroslav Suchý 2015-07-28 08:05:06 UTC
IMO all metadata and even repomd.xml should be requested with header If-Modified-Since.
See section 14.25 of:
  http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
When correctly implemented and files are not modified, then only HTTP headers are transfered and no real data.

Comment 5 Naresh Sukhija 2015-09-17 04:09:27 UTC
Since everybody (including me) are affected, even i386 version, the priority of this bug should be increased
Also, I suspect Fedora 23 and Rawhide would be equally affected (though not verified)

Comment 6 Eduard Vopicka 2015-12-16 20:48:49 UTC
It appears to me that DNF uses metadata_expire entirely differently than yum. Please read the following quote from "man yum.conf":

===
metadata_expire Time (in seconds) after which the metadata  will expire. So that if the current metadata downloaded is less than this many seconds old then yum  will not update the metadata against the repository. If you find that yum is not downloading information on updates as often as you would like lower the value of this option.
(...truncated...)
The default is 6 hours, to compliment yum-updatesd running once an hour.
===

Again: "So that if the current metadata downloaded is less than this many seconds old then yum  will  not  update  the  metadata against the repository."

This IMHO means that yum uses metadata_expire to avoid excessively frequent downloading of metadata. Once fresh metadata are downloaded, yum does not download metadata from the repository, even when newer metadata are possibly available in the repository. Once the metadata_expire time interval expires, yum absolutely does not force the metadata re-downloading for no reason, e.g. if there are no newer metadata available in the repo.

In contrast, dnf IMHO uses metadata_expire in such a way that it really expires the local copy of metadata by declaring them as outdated and unconditionally (and possibly for no practical reason, if the local copy of the metadata still matches the repo metadata) causes the unchanged metadata to be redownload again and againg, with really strange and annoying result like
Fedora 23 - i386                                898 kB/s |  39 MB     00:45
If there is only small number of small .drpms to be downloaded, the ~40MB size of unnecessary re-download of just this Fedore release repo is frequently multiple of the size of .drpms to be downloaded. Provided you are connected through 8Mbit ADSL line, it took 45 seconds in this example. If there is possibly FUP omn your line, you have lost not only the time, but also megabytes from yout FUP limit.

Taken into account how long this issue is reported and discussed again and again, you should definitely to fix this, I hate to say ASAP, but I say really soon.

(Koukejte, chlapi v Brne, neco s tim konecne udelat. Jak to je ted, je to skutecne rozcilujici, otravne, zere to cas, megabajty... A snad nemuze byt zas az tak tezke to nejak spravit.)

Brgds,

Eduard

Comment 7 Honza Silhan 2016-01-11 12:14:37 UTC
*** Bug 1293910 has been marked as a duplicate of this bug. ***

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

Comment 9 Fedora End Of Life 2016-07-19 14:25:32 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 10 Enrico Scholz 2016-07-19 18:26:13 UTC
still with dnf-1.1.9-2.fc23.noarch

Comment 11 Eduard Vopicka 2016-07-19 18:57:57 UTC
Hello.

In my opinion, this is one of the most annoying bugs during some past years. Please just put your Fedora systems behing some 8, 4 or 2Mbit DSL line and you will see what I am talking about. Sometimes, if there are only few small DRPMs in the update set, the metadata are much bigger than updates to be downloaded. 

Please read my comment #6 in this BZ entry and *fix*this*bug*.

Thanks in advance,

Eduard

Comment 12 Jan Kurik 2016-07-26 05:00:41 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 13 Michael Mráka 2016-11-01 14:11:43 UTC
Hello,

I am not able to reproduce described behaviour. Do you still experience the issue? Do you have some non-standard network environment (http proxies, ipv6 env, etc.)?

Comment 14 Enrico Scholz 2017-01-11 18:19:56 UTC
Still with dnf-1.1.10-4.fc25.noarch

| Fedora 25 - x86_64 - Base                      4.1 MB/s |  26 MB     00:06    

Proxy is usually required, but mirror can be reached directly.

Comment 15 Eduard Vopicka 2017-03-22 19:33:04 UTC
Hello.

It may be just my opinion, but this bug does no longer manifest in my environment, even after "dnf clean expire-cache" which was the way to force it to always manifest on the next "dnf update".

Brgds,

Ed

Comment 16 Jaroslav Mracek 2017-04-29 07:45:21 UTC
We prepared a major improvement with dnf-2.3 that is available for rawhide and fc26. We also provide it for Fedora 24+ from our testing repository (dnf copr enable rpmsoftwaremanagement/dnf-nightly). Please can you try the latest version of dnf-2.3 and report if your problem appears again?

Comment 17 Eduard Vopicka 2017-04-29 09:45:30 UTC
Hi Jaroslav.

Once I ugrade to nightly build of dnf-2.3 on F25, will it be downgradeable back to the current F25 dnf version via "dnf  distro-sync" ? E.g., databases backward compatility and similar things?

I would like to help with testing, but I have to try on physical computer and do not wish to wait some two months for F26 with nightly build of dnf installed.

Thanks,

Eduard

Comment 18 Eduard Vopicka 2017-04-29 10:08:08 UTC
Just tried "what will happen if I try to upgrade dnf t version 2...

dnf copr enable rpmsoftwaremanagement/dnf-nightly
dnf update

offers skipping about three fullscreens of dnf-2 packages and the suggested

dnf update -- best --allowerasing

is only slightly better with offer of installing/upgrading/replacing lots of packages, but also

Skipping packages with broken dependencies:
 dnf               src    2.4.0-0.28ge949aaa.fc25
                                        rpmsoftwaremanagement-dnf-nightly 552 k
 dnf-plugins-core  src    2.0.0-0.30gb26c810.fc25
                                        rpmsoftwaremanagement-dnf-nightly 128 k
 dnf-plugins-extras
                   src    2.0.0-0.24gc320b3a.fc25
                                        rpmsoftwaremanagement-dnf-nightly  76 k

Transaction Summary
================================================================================
Install  11 Packages
Upgrade  23 Packages
Remove    9 Packages
Skip      3 Packages

Total download size: 3.0 M

It does not look OK to me to proceed, so for now I did

dnf copr disable  rpmsoftwaremanagement/dnf-nightly

and I am ready to give it another try in the future. These three src packages are only sources not needed for dnf-2.3 operation? Your advice pls?

Please note that the above happened on physical computer with up-to-date 32bit F25 installed.

[vopicka@localhost tmp]$ rpm -qa|grep ^dnf|sort
dnf-automatic-1.1.10-6.fc25.noarch
dnf-conf-1.1.10-6.fc25.noarch
dnfdaemon-selinux-0.3.16-3.fc25.noarch
dnfdaemon-0.3.16-3.fc25.noarch
dnf-plugins-core-0.1.21-5.fc25.noarch
dnf-plugins-extras-0.0.12-4.fc25.noarch
dnf-plugin-system-upgrade-0.7.1-4.fc25.noarch
dnf-yum-1.1.10-6.fc25.noarch
dnf-1.1.10-6.fc25.noarch
[vopicka@localhost tmp]$ 


Brgds,

Eduard

Comment 19 Jaroslav Mracek 2017-04-29 13:14:21 UTC
Thanks for your try. Skipped packages src - this is bug in dnf-1.1.x . This packages are uninstallable because they contain source code. With dnf-2.3 you will not see them and dnf will not try to install them.
How to downgrade dnf-2.3 to dnf-1.1:
Just do "dnf downgrade dnf-1.1*". Or may be + --allowerasing.

What could happen with downgrade:
Probably some of plugins could be removed, but then you can install them back (depends on installed plugins). 
What is incompatible in Fedora25 with dnf-2.3:
yumex-dnf
anaconda

Personally I did downgrade dnf-2.X to dnf-1.1 many times for testing purposes, but only I experience removal of plugins (the packages were renamed, therefore obsoletes were used. But obsoletes cannot handle downgrades to restore original situation).
Thanks a lot for your cooperation.

Comment 20 Eduard Vopicka 2017-05-03 20:39:43 UTC
So here it goes.

[root@localhost dnf]# dnf --version
2.4.0
  Installed: dnf-0:2.4.0_1-1g48506ee.fc25.noarch at 2017-05-03 20:15
  Built    :  at 2017-05-03 01:45

  Installed: rpm-0:4.13.0.1-1.fc25.i686 at 2017-03-01 17:58
  Built    : Fedora Project at 2017-02-24 12:49
[root@localhost dnf]# 

And my first observations: Promising, the following command sequence does not cause unneeded metadata redownload:

dnf clean all
dnf update
# Here fresh repo meadata ale downloaded for all repos
dnf update
dnf clean expire-cache
dnf update
dnf update
rm -f /var/cache/dnf/expired_repos.json
dnf update
dnf update

Now I must wait 6 or more hours (my metadata_exire interval in dnf.conf).

Comment 21 Vít Ondruch 2017-05-04 05:58:45 UTC
My experiences are negative ... Using mock for development, DNF refresh the metadata all the time.

Comment 22 Eduard Vopicka 2017-05-04 10:33:35 UTC
Hmmm... Looks to me like that metadata of "expired" repos are now correctly checked and downloaded only if server has newer version.

@vit Ondruch: Please chech especially if metadata of "fedora" repo (these metadata should be static) are redownloaded for no apparent reason?

[root@czlx-vopicka dnf]# dnf --version
2.4.0
  Installed: dnf-0:2.4.0_1-4gbb5ed9a.fc25.noarch at 2017-05-04 10:04
  Built    :  at 2017-05-04 01:50

  Installed: rpm-0:4.13.0.1-1.fc25.x86_64 at 2017-03-01 08:58
  Built    : Fedora Project at 2017-02-24 12:48
[root@czlx-vopicka dnf]# dnf update
Last metadata expiration check: 0:00:24 ago on Thu May 04 12:22:41 2017 CEST.
Dependencies resolved.
Nothing to do.
Complete!
[root@czlx-vopicka dnf]# dnf clean expire-cache
Cache was expired
0 files removed
[root@czlx-vopicka dnf]# cat expired_repos.json ;echo ""
["rpmfusion-nonfree-updates", "rpmfusion-free-updates", "updates", "rpmsoftwaremanagement-dnf-nightly", "heliocastro-hack-fonts", "rpmfusion-nonfree", "google-chrome", "adobe-linux-x86_64", "fedora", "google64", "rpmfusion-free"]
[root@czlx-vopicka dnf]# dnf update
Last metadata expiration check: 0:00:00 ago on Thu May 04 12:23:30 2017 CEST.
Dependencies resolved.
Nothing to do.
Complete!
[root@czlx-vopicka dnf]#

Comment 23 Vít Ondruch 2017-05-05 12:41:34 UTC
(In reply to Eduard Vopicka from comment #22)
> @vit Ondruch: Please chech especially if metadata of "fedora" repo (these
> metadata should be static) are redownloaded for no apparent reason?

You are probably right and the issue I am hitting is different then this. I'm going to reopen my bug 1293910 since I believe that I found the reason for the issues I observe.


Note You need to log in before you can comment on or make changes to this bug.