[Rpm-maint] Rpm Database musings
mls at suse.de
Mon Mar 11 12:14:21 UTC 2013
On Fri, Mar 08, 2013 at 09:21:33PM +0200, Panu Matilainen wrote:
> It has its advantages of course. Having headers spread in different files
> would probably make some things easier but also slower, so you'd really
> want to avoid having to go to the headers. I did a quick test-case in
> python yesterday: reading through all the ~2160 headers in my rpmdb with
> the current libdb implementation (with no signature checking) takes about
> 0.11s, loading them from separate files takes about 0.15s. Small numbers
> but in percentages thats quite a lot.
Is that with dropped caches (echo 3 > /proc/sys/vm/drop_caches)?
>> Anyway, attached is a little Packages database implementation I did yesterday
>> and today. The code is very careful not to destroy things if the database
>> is corrupt, i.e. it makes sure that it does not overwrite data.
> Wow, that didn't take long. One might get the idea that you're even more
> eager to get rid of BDB than I am :D Can't blame you for that...
Well, I did it because A) it was a fun little hack and B) it's good
to have something to verify our ideas.
> We could perhaps take some advantage of knowing the way how rpm does
> transactions: erases always come after installs, so on upgrades there are
> never free slots originating from the same transaction. So we could just do
> lazy deletion: just flag the removed headers for erasure but dont actually
> bother deleting and zeroing them, the next transaction that occurs will do
> that. Should reduce the amount of data needing fdatasync() as well.
Yes, that could work. OTOH it makes crash recovery a bit harder.
> Kinda related to the above: I dont see the header timestamp being actually
> used for anything (but then I might've missed something).
I added the timestamp so that when there was a crash and we need to scan the
database and there are multiple good headers for the same pkgid, we know which
one to take.
Michael Schroeder mls at suse.de
SUSE LINUX Products GmbH, GF Jeff Hawn, HRB 16746 AG Nuernberg
More information about the Rpm-maint