[RFC] Ways to make initial knit creation faster (both push and commit)
John Arbash Meinel
john at arbash-meinel.com
Wed Aug 23 19:55:56 BST 2006
Robey Pointer wrote:
...
> Something about this didn't seem "right" to me so I dug into it, in
> paramiko. I'm now pretty convinced that the stat() is unnecessary.
>
> The later sftp RFC drafts make it clear that the offset in a write is
> ignored when a file is opened for append. (That makes sense because it
> follows posix: writes to an append-mode file go to the end, no matter
> where the seek pointer is.)
So now we need to decide if it is better to have 'non_atomic_put_bytes'
as a function call. Because it is similar to 'append()', and append has
better "don't destroy existing data" semantics.
I could go either way. Some of my changes just delay when we create the
file, which would help for append just as easily as non_atomic_put_bytes.
I'm tempted to leave non_atomic_put* in, for the case when people don't
have the latest paramiko. But since it was mostly a workaround for
paramiko, it may be better to leave it out.
>
> The earlier drafts -- the ones that describe the sftp protocol version
> in common use -- are shorter and don't say anything about it, but after
> looking at the sftp code in openssh, they're relying on the same posix
> behavior. So I think it's safe to assume that if both openssh *and* the
> RFC agree, that's the right thing to do. (The reason I'm hedging so
> much here is that the RFC tends, in some places, to drift way out beyond
> what any actual implementation does.)
>
> I've changed paramiko's trunk to avoid the stat() on files opened in
> append mode, postponing it until/if we need it (for example, seek() on
> an O_APPEND|O_RDWR file). If you think it might still help, I'd
> appreciate any feedback.
>
> robey
>
Have you run the 'bzr' test suite with this version of paramiko? I don't
see anything in bzrlib/tests/stub_sftp.py that explicitly handles append
mode. Most likely the 'flags' parameter has the O_APPEND set, but I'm
not sure how that interacts with os.fdopen('rb+')
John
=:->
-------------- 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/20060823/df62c98a/attachment.pgp
More information about the bazaar
mailing list