RPM Community Forums

Mailing List Message of <rpm-devel>

Re: strange RPMDB problem: messed up entries (regularily)

From: Jeff Johnson <n3npq@mac.com>
Date: Mon 18 Aug 2008 - 16:42:39 CEST
Message-id: <3D5046EC-1C61-49AE-A2AD-6BD98190F3C9@mac.com>

On Aug 18, 2008, at 8:26 AM, Ralf S. Engelschall wrote:

> Notice the "--db-rebuild" instead of "--rebuildb" here and the fact
> that with "--rebuilddb" I usually loose the "openpkg" entry while with
> "--db-rebuild" I do not.
> To explain: "--db-xxxx" are RPM aliases to OpenPKG's "rpmdb" addon
> script and its "--db-rebuild" actually does a full "dump" and  
> "restore"
> with the Berkeley-DB tool (for details see the attached script) while
> "--rebuildb" is RPM-internal.
> Very interesting that the full dump/restore via external tools is
> able to resurrect the database without information loss while RPM's
> --rebuilddb seems to kick away data. Hmm...

OK, your scriptie now vetted.

I'd suggest adding a db_stat() function to identify stale locks.  

     /usr/lib/rpm/rpmdb_stat -Cl -h /var/lib/rpm

(aside) you might want to track other info, like no. of hash buckets,  
likely a (modest) speedup in --rebuilddb if dynamic resizing is avoided
by initializing no. of hash buckets explicitly with DB_HASH. I  
haven't bothered
because --rebuilddb has almost nothing to do with "package management".

Also a db_verify() method to detect inconsistencies in Berkeley DB  
data structures
would be useful. The header blobs in Packages are already sanity/ 
checked as you have seen. Your scriptie basically bulldozes all  
existing state and
recreates, it would likely be useful to know if there was actually  
any need to recreate

Note that --rebuilddb recreates all the indices, so there's little  
reason to
perform db_dump ... | db_load ... on anything but Packages if -- 
is going to be run. There can/will be changes to the index "tables"  
on macro configuration as well that perhaps could be handled, but  
your internal
table is certainly gud enuf.

So --db-rebuilddb "works" but --rebuilddb doesn't because the  
db_unbreak() method
removes (possibly damaged) cache afaict.


73 de Jeff
Received on Mon Aug 18 16:43:32 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.