1 |
commit: ca300d4fccffb8cd3d0d12f60c7c8c368f049258 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Nov 21 19:22:21 2017 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 21 19:27:17 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ca300d4f |
7 |
|
8 |
binarytree.populate: avoid unnecessary index re-write (bug 638292) |
9 |
|
10 |
Exclude hashes from the minimum_keys, so that the Packages index |
11 |
will not be needlessly re-written due to missing digests. |
12 |
|
13 |
Bug: https://bugs.gentoo.org/638292 |
14 |
|
15 |
pym/portage/dbapi/bintree.py | 7 ++++++- |
16 |
1 file changed, 6 insertions(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py |
19 |
index f4e8a1c66..201666c41 100644 |
20 |
--- a/pym/portage/dbapi/bintree.py |
21 |
+++ b/pym/portage/dbapi/bintree.py |
22 |
@@ -569,6 +569,11 @@ class binarytree(object): |
23 |
def _populate_local(self): |
24 |
self.dbapi.clear() |
25 |
_instance_key = self.dbapi._instance_key |
26 |
+ # In order to minimize disk I/O, we never compute digests here. |
27 |
+ # Therefore we exclude hashes from the minimum_keys, so that |
28 |
+ # the Packages file will not be needlessly re-written due to |
29 |
+ # missing digests. |
30 |
+ minimum_keys = self._pkgindex_keys.difference(self._pkgindex_hashes) |
31 |
if True: |
32 |
pkg_paths = {} |
33 |
self._pkg_paths = pkg_paths |
34 |
@@ -631,7 +636,7 @@ class binarytree(object): |
35 |
continue |
36 |
except (KeyError, ValueError): |
37 |
continue |
38 |
- if not self._pkgindex_keys.difference(d): |
39 |
+ if not minimum_keys.difference(d): |
40 |
match = d |
41 |
break |
42 |
if match: |