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. Essentially

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

(aside) you might want to track other info, like no. of hash buckets, there's
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/ digest/signature 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
everything.

Note that --rebuilddb recreates all the indices, so there's little reason to perform db_dump ... | db_load ... on anything but Packages if -- rebuilddb is going to be run. There can/will be changes to the index "tables" depending 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.

hth

73 de Jeff
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        rpm-devel@rpm5.org

Reply via email to