[win32] Permission denied in fancy_rename

John Arbash Meinel john at arbash-meinel.com
Wed May 3 16:29:28 BST 2006


Martin Pool wrote:
> On 02/05/2006, at 11:41 PM, John Arbash Meinel wrote:
>>
>> Just so everyone realizes, that means that everything returned by
>> Transport.get() needs to be closed.
>>
>> And probably the meme:
>>
>> TransportB.put(TransportA.get())
>>
>> cannot be used. Which is a shame.
> 
> In many cases we're just constructing StringIO objects to satisfy the
> interface, which suggests to me that it's not a good fit for many callers.
> 
> Possibly we should have
> 
>   transport_b.put_bytes('foo', transport_a.get_bytes('foo'))
> 
> --Martin

I think a get_bytes/put_bytes is reasonable. Especially since we now
have readv() which returns (offset, data) tuples.

At one point get/put supported raw strings, but when we decided
no-magic-interfaces, we just got rid of the raw strings.

The only advantage of put('foo', get()) is that we use pumpfile to read
the file in 32kB chunks, rather than reading the whole thing into
memory, and writing it all out.

I did some checking, and for the bzr.dev tree we have:

files < 32K:	     1,044
files > 32K:	        86
avg size < 32K:	     4,172 bytes
avg size > 32K:    229,246 bytes
tot size < 32K:  4,355,195 bytes
tot size > 32K: 19,715,173 bytes

So while we have lots of files < 32K, the actual number of bytes is
dwarfed by the few large files that we have.

Interestingly enough, these are the largest files:
6,231,346 inventory.knit
1,898,925 revisions.knit
1,174,720 knits/c9/builtins.py-20050830033751-fc01482b9ca23183.knit
1,033,239 knits/3c/branch.py-20050309040759-e4baf4e0d046576e.knit
  596,911 %4e%45%57%53-20050323055033-4e00b5db738777ff.knit
  461,622 inventory.kndx
  444,023 knits/b5/bzr.py-20050309040720-d10f4714595cf8c3.knit
  430,597 revisions.kndx

%4e%45%57%53 => NEWS.

Interestingly enough
zcat inventory.knit | gzip | wc -c
Gives a file of about 4MB, so we are loosing 50% to have an indexable
file. Which doesn't seem that bad to me.
Now, bzip2 can compress it down to 1.8M, and LZMA down to 800K. (The raw
inventory.knit is 21MB).

We might consider using lzma compression in the future, since it is kind
of designed for how we want to use compression. (Writing is slow, but
reading is fast, good for archiving).

Anyway, I think get_bytes/put_bytes is good, but we should think about
the memory impact.

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/20060503/9f433d83/attachment.pgp 


More information about the bazaar mailing list