Skip to content

Commit

Permalink
Set POOL_FLAG_ADDFILEPROVIDESFILTERED only when not loading filelists
Browse files Browse the repository at this point in the history
It is set in `dnf_sack_load_repo` which means its done for each repo,
this is not needed, it would be sufficient to set the flag only once.
However there is a ready access to whether filelists are loaded and the
call `pool_set_flag` is very cheap.

Any alternatives I could see would probably require extending the API
which seems unnecessary.
  • Loading branch information
kontura authored and m-blaha committed Oct 4, 2024
1 parent fbd3447 commit cd51f57
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions libdnf/dnf-sack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,6 @@ dnf_sack_init(DnfSack *sack)
priv->pool = pool_create();
pool_set_flag(priv->pool, POOL_FLAG_WHATPROVIDESWITHDISABLED, 1);

// Configures the pool_addfileprovides_queue() method to only add files from primary.xml.
// This ensures the method works correctly even if filelist.xml metadata are not loaded.
// At the same time when filelist.xml are loaded libsolv is able to search them for required
// files if needed.
pool_set_flag(priv->pool, POOL_FLAG_ADDFILEPROVIDESFILTERED, 1);

priv->running_kernel_id = -1;
priv->running_kernel_fn = running_kernel;
priv->considered_uptodate = TRUE;
Expand Down Expand Up @@ -1890,6 +1884,13 @@ dnf_sack_load_repo(DnfSack *sack, HyRepo repo, int flags, GError **error) try
HY_EXT_FILENAMES, error))
return FALSE;
}
} else {
// Configures the pool_addfileprovides_queue() method to only add files from primary.xml.
// This ensures the method works correctly even if filelist.xml metadata are not loaded.
// When searching for file provides outside of primary.xml this flag incurs a big performance
// hit because libsolv has to go through all the files for each file provide therefore don't
// set it if filelists are loaded.
pool_set_flag(priv->pool, POOL_FLAG_ADDFILEPROVIDESFILTERED, 1);
}
if (flags & DNF_SACK_LOAD_FLAG_USE_OTHER) {
retval = load_ext(sack, repo, _HY_REPODATA_OTHER,
Expand Down

0 comments on commit cd51f57

Please sign in to comment.