RPM Community Forums

Mailing List Message of <rpm-users>

Re: About the consistency of /var/lib/rpm/__db.00?

From: Jeff Johnson <n3npq@mac.com>
Date: Tue 25 May 2010 - 19:09:12 CEST
Message-id: <9E695EE7-0560-4CC7-AC73-082696063D05@mac.com>

On May 25, 2010, at 1:00 PM, Marc MERLIN wrote:

> On Fri, May 21, 2010 at 07:52:23PM -0700, Marc MERLIN wrote:
>> On Fri, May 21, 2010 at 08:38:23PM -0400, Jeff Johnson wrote:
>>>> So running most rpm versions from this century :) creates
>>>> /var/lib/rpm/__db.00? when accessing the rpm dbs.
>>>> 
>>>> My understanding is that they are a temporary index created by the DB
>>>> libraries and I know they get recreated as needed.
>>>> 
>>> 
>>> Nope. There are (at least) 3 RPM user visible uses of __db* files, none of them
>>> "temporary" or "index":
>>> 	1) a version stamp
>>> 	2) names of locks (and with thread_count, "stale lock" registration
>>> 	for clean-up after exceptional conditions like reboot and segfault
>>> 	and programmer error). Note "names", not the locks themselves.
>>> 	3) data caching
> 
> Ok, I'm working on this some more because this _db* files really need to die
> for us.

There's always
	rm -f /var/lib/rpm/__db*
No fuss, no muss.

> As you know 
> 1) older rpms (much older) ran fine without having to create them for any
>   rpm operation.
> 2) rpm -q as root creates them but rpm -q as a user doesn't.
> 
> 
> My questions:
> 1) it is the db library that is creating them, right?

Yes. The __db* files are how interprocess locks are shared
in Berkeley DB. Its known as a DBENV.

> 2) can't it be told to stop making when it's called?

You're barking the wrong tree. Databases (with concurrent access) need locks,
the locks are shared in an environment, and the environment is carried
in __db* files in the Berkeley DB implementation.

> 3) rpm -q as a user doesn't create the lock/cache files and needlessly
>   creates them when it's root. Can't rpm be told not to make them at 
>   all for at least read only operations?
> 

Yep. That doesn't mean correct, only that non-root risks segfaulting
if a database is changing while the non-root query is running.

73 de Jeff
Received on Tue May 25 19:09:46 2010
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.