Adding .db support to pkg_tools

Tim Kientzle kientzle at freebsd.org
Tue May 13 04:20:42 UTC 2008


> I think this is a really bad idea.  The problem with the tools is not
> with the files.  It is that the files need to be parsed on each run,
> often recursively, and your solution would not help at all.

Parsing one file isn't expensive; parsing several hundred files
to find one bit of information is expensive.

> The database(s) should just be a cache of the information stored in the
> files.

Bingo!  As long as the .db version can be easily recreated
from scratch from the master data stored in the same files
as always, it doesn't really matter if the BDB is occasionally
corrupted, as long as it can be rebuilt fairly quickly.

So, the key points are:
   * Use the .db file for lookups that can't be done quickly
against the existing data.  In particular, look for operations
where the pkg tools have to scan a lot of files to verify a single
fact.
   * Ensure the .db file can be deleted and rebuilt from scratch
from the data in the regular files.

Tim Kientzle


More information about the freebsd-hackers mailing list