Bug 1373992 - [RFE] repo configured using "baseurl" should only be re-downloaded when changed, just like repo with "metalink"
Summary: [RFE] repo configured using "baseurl" should only be re-downloaded when chang...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Igor Gnatenko
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-07 15:43 UTC by Alan Jenkins
Modified: 2017-03-10 10:59 UTC (History)
7 users (show)

Fixed In Version: dnf-2.0.1-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-10 10:59:37 UTC
Type: Bug


Attachments (Terms of Use)

Description Alan Jenkins 2016-09-07 15:43:55 UTC
Description of problem:

When baseurl is *not* used, dnf apparently checks whether the repo has changed, before re-downloading it.

When dnf is configured with a repo with a baseurl (i.e. for a local repo) and the cache passes it's maximum age, dnf has to download tens of megabytes.


Version-Release number of selected component (if applicable): 
dnf-1.1.10-1.fc24.noarch

How reproducible: always

Steps to Reproduce:
1. edit /etc/yum.repo.d/fedora.repo, comment out "metalink" and uncomment "baseurl"
2. dnf --refresh check-update
3. dnf --refresh check-update

Actual results:

Step 3 re-downloads 10s of megabytes, despite the repo not having changed since step 2.

Expected results:

Only repomd.xml needs to be re-downloaded to check for changes.


Additional info:

I noticed this after configuring my system with baseurl.  I checked the source code of dnf and found this code, which relies on metalink.

The check could be changed, or a check added, to re-download repomd.xml, if the file contents are identical then the existing cache can be re-used.


        if self.metadata or self._try_cache():
            if self.sync_strategy in (SYNC_ONLY_CACHE, SYNC_LAZY) or \
               not self._expired:
                logger.debug('repo: using cache for: %s', self.id)
                return False
        if self.sync_strategy == SYNC_ONLY_CACHE:
            msg = "Cache-only enabled but no cache for '%s'" % self.id
            raise dnf.exceptions.RepoError(msg)
        try:
            if self._try_revive():
                # the expired metadata still reflect the origin:
                self.metadata.reset_age()
                self._expired = False
                return True


    def _try_revive(self):
        """Use metalink to check whether our metadata are still current."""
        if not self.metadata:
            return False
        if not self.metalink:
            return False

Comment 2 Jaroslav Mracek 2017-03-10 10:59:37 UTC
Fixed in dnf-2.0.1-1 and released into rawhide


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