Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] Log changes between vdb_metadata.pickle updates
Date: Fri, 07 Nov 2014 20:17:49
Message-Id: 545D28E5.7050105@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] Log changes between vdb_metadata.pickle updates by Brian Dolbec
1 On 11/07/2014 08:51 AM, Brian Dolbec wrote:
2 > On Fri, 7 Nov 2014 00:45:55 -0800
3 > Zac Medico <zmedico@g.o> wrote:
4 >
5 >> This adds add support to generate a vdb_metadata_delta.json file
6 >> which tracks package merges / unmerges that occur between updates to
7 >> vdb_metadata.pickle. IndexedVardb can use the delta together with
8 >> vdb_metadata.pickle to reconstruct a complete view of /var/db/pkg,
9 >> so that it can avoid expensive listdir calls in /var/db/pkg/*.
10 >> Note that vdb_metadata.pickle is only updated periodically, in
11 >> order to avoid excessive re-writes of a large file.
12 >>
13 >> In order to test the performance gains from this patch, you need to
14 >> generate /var/cache/edb/vdb_metadata_delta.json first, which will
15 >> happen automatically if you run 'emerge -p anything' with root
16 >> privileges.
17 >> ---
18 >
19 > The following code I would like to see either as an independant class
20 > and file if possible, then just instantiated here in the main vardbapi.
21 > Looking over the code, I didn't see much use of other class functions.
22 > This class is already too large in many ways.
23
24 Yeah, I definitely want to split it out.
25
26 > Also is there a
27 > possibility this code could be re-used as a generic delta cache
28 > anywhere else?
29
30 Maybe. For example, the PreservedLibsRegistry and WorldSelectedSet
31 classes both have similarities in the way that encapsulate an on-disk
32 data store and manage concurrency. Maybe I'll create a helper class that
33 can be utilized by these classes to manage concurrency with on-disk data
34 stores.
35
36 > Another possibility is moving this code and the aux_cache code to
37 > another class that the vardbapi class also subclasses. This would move
38 > all the cache code to a small class easily viewed, edited, maintained.
39
40 In this case, I think a helper class will work just fine, so there will
41 be no need for inheritance.
42 --
43 Thanks,
44 Zac