Gentoo Archives: gentoo-portage-dev

From: Gregorio Guidi <g.guidi@×××.it>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] Current portage well designed, but badly used
Date: Wed, 01 Dec 2004 13:25:28
Message-Id: 200412011425.25395.g.guidi@sns.it
In Reply to: Re: [gentoo-portage-dev] Current portage well designed, but badly used by Brian Harring
1 On Wednesday 01 December 2004 13:08, Brian Harring wrote:
2 > > > 1) don't modify $portdir/metadata/cache. Modifying the rsync'd cache
3 > > > directly results in more to rsync for the next sync. Going that route
4 > > > would result in a lot of dial up users out for blood.
5 > > > 2) the user may not be using the same cache backend as the distributed
6 > > > cache- the rsync'd cache is portage_db_flat, while the user may be
7 > > > using a custom sqlite backend. I suspect this will be come more common
8 > > > place whenever cvs becomes stabled- the cache backend is being
9 > > > refactored currently.
10 > > > 3) cleanse stale entries from the cache, so you don't end up w/ a
11 > > > couple thousand extra files sitting in your local cache. Stable
12 > > > portage accomplishes this by wiping *all* local cache entries, and
13 > > > transferring the *entire* rsync'd cache over. Cvs is smarter,
14 > > > transfers only what has changed, and removes the stale entries (this is
15 > > > why it's faster).
16
17 > > With respect to point 3, the solution you imlpemented is surely the right
18 > > thing to do.
19 > > With respect to point 1, maybe a good solution could be to just check
20 > > cache validity in $portdir/metadata when the cache is needed, and write a
21 > > new cache in /var/cache/edb if it is not valid.
22 >
23 > Err... elaborate
24 > Assuming I'm following, you're proposing doing the updates to local
25 > cache, and reading from the metacache? If so, that's twice the level of
26 > potential stats/reads required, which won't speed it up much :)
27 > ~brian
28
29 Nah, it would be something like:
30 - see if cache exists in /var/cache/edb (one cheap access() call)
31 - if it exists, validate (costly stat() calls, but 99% success)
32 - if it does not exists or is not valid, read cache in $portdir/metadata and
33 validate (stat() calls, 99% success).
34 - if cache is not valid, create new cache in /var/cache/edb (ebuild
35 sourcing: takes a lot of times).
36 - read cache.
37
38 - after emerge sync, go through cache files in /var/cache/edb (usually not
39 many) and remove entries corresponding to deleted ebuilds.
40
41 But I'm not aware of portage internals, for instance, I'm thinking of a system
42 where the cache is read only one time and then stored in memory.
43 Does portage does so, or does it read the cache every time a key is needed
44 from there?
45
46 Gregorio
47
48 --
49 gentoo-portage-dev@g.o mailing list

Replies