Why break-lock instead of unlock?

John Arbash Meinel john at arbash-meinel.com
Tue Jun 3 18:15:55 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Panagiotis Papadakos wrote:
| Hello list.
|
| I find unlock much more user friendly and intuitive than break-lock.
| Any reason why bzr uses break-lock?
|
| Regards
|     Panagiotis Papadakos
|
|

Because you are breaking a lock that may or may not be held by yourself. It is
intended to make people cautious, because if you use the command while someone
else holds the lock, you *can* get into race conditions that could trigger data
corruption. Pack repositories are much more resilient against this than knit
repositories were (but they also hold the lock for a much shorter period of
time, only for the time to update the pack-names file, not the whole time spent
uploading the data).
Specifically, with knit repositories we appended to existing files. With 2
people appending to the same file, you can't guarantee the ordering of the
writes. (it is possible to have 2 people's data interleaved, which would be very
broken.) Pack repositories write to new files and just update the reference list.

Our current branch format is also rather resilient. Barring 'upgrade' there are
only 2 files which are modified, last-revision and tags. And both are written
atomically (rename into place). So 2 people racing would still result in a
consistent view. Though you may lose a tag if both were creating a new tag at
the same time.

So... 'break-lock' was specifically chosen to indicate to the user that care
should be taken. 'unlock' does not carry the same "weight".

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhFfEsACgkQJdeBCYSNAAMcFQCfewkhO23MyX9O305jByikkugc
+JcAn3Mo6COutslgBPvSZCAt0Is+qnk1
=OxUK
-----END PGP SIGNATURE-----



More information about the bazaar mailing list