Skip to content

On Carbon and develop branches Executing a pkg state on Windows causes a pkg repo refresh EVERY time. #36088

Closed

Description

@UtahDave

Description of Issue/Question

Executing a pkg state on Windows causes a pkg repo refresh EVERY time. This causes states to be very slow unnecessarily.

Setup

install Salt from Carbon or Develop branch on Windows.

Steps to Reproduce Issue

Execute a salt pkg state like this:

salt davewintest state.single pkg.installed name=filezilla

This was introduced by this PR: #35899

Activity

  1. added
    severity-critical
    on Sep 6, 2016
  2. added
    bug
    Platform
    on Sep 6, 2016
  3. added this to the C 4 milestone on Sep 6, 2016
  4. damon-atkins commented on Sep 7, 2016

    @damon-atkins
    Contributor

    "This was introduced by this PR: #35899 " this is not correct. Its been in existence for a long time and is on all platforms not just windows. Other non-windows platforms are smarter at doing a refresh

    In fact #35899 added code to allow a minimum time between refresh and warn if a refresh happens with 1 minute, so you can see if the issue is happening. i.e. you will see
    2016-09-07 11:58:30 [salt.loaded.int.module.win_pkg][WARNING ] pkg meta db less than a minute old and been asked to refresh it

    The code is in state/pkg.py which does the refresh #35899, only change two lines associated with the name space, anything to do with refresh has not been changed.
    i.e.

    -    from salt.modules.win_pkg import _get_local_repo_dir       
    -    _get_local_repo_dir = _namespaced_function(_get_local_repo_dir, globals())
    

    The refresh is slow on windows because their is no sync feature for the cache, so everyone seems to delete everything in the cache and copy it again. Which is what the previous and existing windows code does. What it needs to speed it up, is a sync function for the cache or for general files so it only copies new files and removes files which no longer exist.

    The long time existing code. If you call "installed" or "latest" it ask the platform implementation to do a refresh. The below code dates back to version 0.11 https://github.com/saltstack/salt/blob/0.11/salt/states/pkg.py

    def mod_init(low):
        ret = True
        if 'pkg.ex_mod_init' in __salt__:
            ret = __salt__['pkg.ex_mod_init'](low)
    
        if low['fun'] == 'installed' or low['fun'] == 'latest':
            rtag = __gen_rtag()
            if not os.path.exists(rtag):
                with salt.utils.fopen(rtag, 'w+'):
                    pass
            return ret
        return False
    
  5. morganwillcock commented on Sep 7, 2016

    @morganwillcock
    Contributor

    How many sls files are we talking about here?

  6. damon-atkins commented on Sep 8, 2016

    @damon-atkins
    Contributor

    The title should be
    pkg state on all platforms causes a pkg repo refresh per individual run of installed or latest.

    The look at why this code has existed since version 0.11 it hurts windows the most because its the lowest, but it would also hurt OS with slow connections to a repo

  7. damon-atkins commented on Sep 8, 2016

    @damon-atkins
    Contributor

    @morganwillcock if you use the sls files from https://github.com/saltstack/salt-winrepo-ng thats about 200 odd files. which are re-fetch every time you do a pkg.refresh_db due to a lack of smart sync function.

  8. UtahDave commented on Sep 8, 2016

    @UtahDave
    ContributorAuthor

    This issue is better described in #36133 so I'm going to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

PlatformWindowsbugseverity-critical

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions