[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: database locking woes part 2

On Mon, Jul 29, 2002 at 05:32:16PM -0400, Ian Peters wrote:
> More information -- lock-breaker is not able to break the database lock
> until version 4.0.3 -- previous versions did not display this behavior. 
> Peter Bowen and I are looking at the differences between the 4.0.2 and
> 4.0.3 trees now to try and find the regression.  Hopefully, once we know
> exactly what is broken, we'll be able to come up with a work-around to
> keep Red Carpet from accidentally breaking rpm locks.

Hmmm, I think I figgered what's happening.

The difference between 4.0.2 and 4.0.3 is the use of a DBENV for

The fdno used for fcntl locking is returned through a db->fd()
call which (quick check of src) returns the currently opened mempool
file fdno. I'll bet (have't checked strace yet) the file is one of the
/var/lib/rpm/__dbWX files.

On the next exec's rpmdbOpen() the __dbWX file is removed, and and a new
(__dbYZ) file is recreated.

So there are 2 fcntl advisory locks, one from the unlinked __dbXY, the
other on __dbYZ from the newly created environment.

So stale lock avoidance (by removing __dbWX) is breaking fcntl locking.

Here's what I think is gonna be needed to fix this mess:
	1) deal with stale lock(s) correctly.
	2) implement an rpm (not db) write-write locking scheme.
	3) figger a backward compatible locking scheme.

Note that Yet Another fcntl lock on a file that is removed will not be a
viable approach in Red Carpet. Hmmm, OTOH, maybe it is, if you take the
fcntl lock on the existing __dbWX file before calling rpmdbOpen().

Turning on DB_ALLCDB (and CDB) might be another scheme, as __dbWX will not
be removed if CDB is enabled, and ALLCDB will take out CDB write locks
even on read cursors, but let's not go there.

Dunno yet, time to find out.

73 de Jeff

Jeff Johnson	ARS N3NPQ
jbj@redhat.com (jbj@jbj.org)
Chapel Hill, NC

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []