[MERGE] Faster LocalTransport.put() and append() methods.
Robert Collins
robertc at robertcollins.net
Thu Jun 15 12:23:38 BST 2006
On Thu, 2006-06-15 at 05:23 +1000, Martin Pool wrote:
> On 14/06/2006, at 7:16 PM, Robert Collins wrote:
>
> > On Wed, 2006-06-14 at 13:36 +1000, Martin Pool wrote:
> >
> >> Since you're creating the file with O_EXCL I don't see any need to
> >> include the PID. Instead, if that fails with EEXIST then just e.g.
> >> add a sequence number and try again.
> >
> > O_EXCL is documented as broken on NFS. if use a static suffix - i.e.
> > filename + '.bzrtmp', if someone has a file that looks like that,
> > we may
> > overwrite it unintentionally - *depending on the manner of the
> > brokenness for NFS*.
>
> But you may overwrite something called foo.$pid.tmp too. ??
>
> > If its 'race conditions with two clients writing the same file'
> > broken -
> > then I'm happy to remove the pid. If its 'O_EXCL is simply ignored on
> > some implementations' then I think the pid is a not-too-bad price to
> > pay.
>
> I think your patch had the problem that if the file happens to exist
> (e.g. a previous run crashed) then the open will fail, which would be
> unfortunate. Including the pid makes it less likely but it can still
> happen. So you do need to catch that case, and I would suggest just
> retrying.
>
> On local filesystems, O_EXCL will be safe. On NFS, even including
> the pid is not enough (and I don't think the atomic rename is
> guaranteed either). So I don't see what the pid really gains you.
I'm happy to pull it out - I think you put it in in the first place ;).
I agree with that bug condition, I'll add a fix for that before
resubmitting.
> > And thread safety may be an issue too. I think calculating the umask
> > when the module is first used, and then chmodding IFF its needed is a
> > reasonable compromise.
>
> That's OK with me.
Cool.
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: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060615/b1e7639c/attachment.pgp
More information about the bazaar
mailing list