commit:     ca300d4fccffb8cd3d0d12f60c7c8c368f049258
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 21 19:22:21 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 21 19:27:17 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ca300d4f

binarytree.populate: avoid unnecessary index re-write (bug 638292)

Exclude hashes from the minimum_keys, so that the Packages index
will not be needlessly re-written due to missing digests.

Bug: https://bugs.gentoo.org/638292

 pym/portage/dbapi/bintree.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index f4e8a1c66..201666c41 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -569,6 +569,11 @@ class binarytree(object):
        def _populate_local(self):
                self.dbapi.clear()
                _instance_key = self.dbapi._instance_key
+               # In order to minimize disk I/O, we never compute digests here.
+               # Therefore we exclude hashes from the minimum_keys, so that
+               # the Packages file will not be needlessly re-written due to
+               # missing digests.
+               minimum_keys = 
self._pkgindex_keys.difference(self._pkgindex_hashes)
                if True:
                        pkg_paths = {}
                        self._pkg_paths = pkg_paths
@@ -631,7 +636,7 @@ class binarytree(object):
                                                                        continue
                                                        except (KeyError, 
ValueError):
                                                                continue
-                                                       if not 
self._pkgindex_keys.difference(d):
+                                                       if not 
minimum_keys.difference(d):
                                                                match = d
                                                                break
                                                if match:

Reply via email to