summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-04-10 06:03:38 +0000
committerZac Medico <zmedico@gentoo.org>2007-04-10 06:03:38 +0000
commiteb75791d44d2d27d3d82a24b7729188041a3d5c5 (patch)
tree6b116c09daa2af72a0c18ecb43b085850a5026e7
parentdd321817da58a22f50bb625d3812399261e4549c (diff)
downloadportage-eb75791d44d2d27d3d82a24b7729188041a3d5c5.tar.gz
portage-eb75791d44d2d27d3d82a24b7729188041a3d5c5.tar.bz2
portage-eb75791d44d2d27d3d82a24b7729188041a3d5c5.zip
Efficiently recycle partial valid vdb cache when possible. This reduces disk load when switching between versions of portage that cache different keys.
svn path=/main/trunk/; revision=6360
-rw-r--r--pym/portage/dbapi/vartree.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 2d1d7c126..e4de9c88d 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -396,13 +396,16 @@ class vardbapi(dbapi):
if pkg_data:
cache_mtime, metadata = pkg_data
cache_valid = cache_mtime == mydir_mtime
- if cache_valid and set(metadata) != self._aux_cache_keys:
+ if cache_valid:
+ cache_incomplete = self._aux_cache_keys.difference(metadata)
+ if cache_incomplete:
# Allow self._aux_cache_keys to change without a cache version
- # bump.
+ # bump and efficiently recycle partial cache whenever possible.
cache_valid = False
- if cache_valid:
+ pull_me = cache_incomplete.union(wants)
+ else:
+ pull_me = set(wants).difference(self._aux_cache_keys)
mydata.update(metadata)
- pull_me = set(wants).difference(self._aux_cache_keys)
else:
pull_me = self._aux_cache_keys.union(wants)
if pull_me: