[Critical] dirstate format use OS file locking
Robert Collins
robertc at robertcollins.net
Thu Mar 8 21:58:47 GMT 2007
On Thu, 2007-03-08 at 16:39 +1100, Martin Pool wrote:
>
> Read locks are needed for dirstate because it can be updated in place,
> and isn't safe to read while that is happening.
>
> If the locking problems are insoluble we could potentially go back to
> always replacing the whole thing.
That will fail on windows; its not a good solution.
The reason is that we want the mutual exclusion so that readers doing
bisection into the disk dirstate (and this code !is! written) dont have
the db changed under them. The read lock and write locks are to prevent
accidental changes like this. (When taking a read lock, we can read the
crc32 at the top, if its the same, keep buffered and partial state if
not, flush our state for the tree.)
So on windows, you cannot replace an in-use file, and this very scenario
has the file in-use.
-Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070309/e163b4e2/attachment-0001.pgp
More information about the bazaar
mailing list