[MERGE] Wait for locks
John Arbash Meinel
john at arbash-meinel.com
Wed Sep 20 19:08:55 BST 2006
The attached patch updates our lock handling so that it waits on locks,
rather than failing instantly. It also changes how this is reported to
the user, so that it looks nice.
1) Wait for a lock (up to 1hr), polling every 1s. (This is not an exact
polling mechanism, since it takes some time to setup a lock).
2) If the lock is held, report to the user about what is going on. If
the lock owner changes while we are waiting, the user is also informed.
Included in the report is helpful information about who, what, and how
long the lock has been held.
3) There is still some bike-shedding that could be done (exponential
backoff, lock timeout, changing apis slightly so that lock timeouts
could be user configurable, etc). But I think this is better than what
we have, and worth merging in its own right.
This is what the new texts look like:
liliana % ./bzr break-lock
Break lock file:///home/jameinel/dev/bzr/.bzr/repository/lock
held by john at arbash-meinel.com on host liliana [process #6791]
locked 4 minutes, 20 seconds ago? [y/n]:n
liliana % ./bzr pull
Using saved location: /home/jameinel/dev/bzr/bzr.dev
Unable to obtain lock file:///home/jameinel/dev/bzr/.bzr/repository/lock
held by john at arbash-meinel.com on host liliana [process #6791]
locked 4 minutes, 32 seconds ago
Will continue to try for 3599 seconds
Lock owner changed for lock
file:///home/jameinel/dev/bzr/.bzr/repository/lock
held by john at arbash-meinel.com on host liliana [process #6791]
locked 1 second ago
Will continue to try for 3591 seconds
bzr: ERROR: Could not acquire lock
LockDir(file:///home/jameinel/dev/bzr/.bzr/repository/lock)
(Now, this lock was actually manually acquired and changed, so it is the
same process, but you can see that what is reported might actually change).
This is probably too big of a change for 0.11, but it would address:
https://launchpad.net/products/bzr/+bug/43521
as well as:
https://launchpad.net/products/bzr/+bug/49556
There are also some issues about how the lock is reported. It is
reported through 'note()' though really it should probably be more of a
bzrlib.ui function. (That is, if we made the ui use the self.outf file)
Anyway, I think this patch has a lot of worth on its own, as it cleans
up a lot of locking issues, and we can come back later and clean the
rest up.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wait-on-lock.diff
Type: text/x-patch
Size: 19325 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060920/ce42fc17/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060920/ce42fc17/attachment.pgp
More information about the bazaar
mailing list