bzr too slow
John Arbash Meinel
john at arbash-meinel.com
Wed Jan 11 12:28:09 GMT 2006
Denys Duchier wrote:
> Robert Collins <robertc at robertcollins.net> writes:
>
>
>>- if self._hashcache.needs_write:
>>- self._hashcache.write()
>>- return self.branch.unlock()
>>+ result = self.branch.unlock()
>>+ if self.branch._lock is None:
>>+ if self._hashcache.needs_write:
>>+ self._hashcache.write()
>>+ return result
>>
>>Which is completely trivial and does not depend on the transaction layer
>>at all
>
>
> It may be trivial, but it is wrong: you are performing the write outside the
> protection of the lock.
>
>
>>- transactions are a higher level consideration than this I think.
>
>
> In my view, transactions have 2 purposes:
>
> - they guarantee an integrity of view (coherence with outside stateful data)
> - they bundle actions modifying such outside stateful data and execute them on
> commit
>
> My proposal merely extends slightly the latter: there is stateful data that it
> is useful to write back whether we choose to commit or not.
>
> Cheers,
>
> --Denys
Well, hash-cache is written whether we hold a write lock or a read lock.
It is a cache file that cannot be invalid, just incorrect. (It gets
corrected if it is incorrect.)
The same thing is true for .bzr/basis-inventory.
Both are atomically written, and contain information to invalidate
themselves if they are out of date.
Which is why it is okay to write them outside of the lock.
Otherwise, if you really only want to do it when the lock is held, you
can do:
if self.branch._lock_count == 1:
# write hash cache
return self.branch.unlock()
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060111/16314b17/attachment.pgp
More information about the bazaar
mailing list