On Jan 10, 2011, at 8:00 AM, Trevor Vaughan wrote:

> I've been trying to wrap my head around this and have some ideas.
> 
> 1) Obviously, size is a dead giveaway if something changed.
> 2) Yes, we do need to store checksum and size when we write a file
> 3) For any file object where the content is in the catalog (i.e. we're
> using content =>) then we should pass along the appropriate type of
> hash in the catalog.
> 
> Doing #3 will allow for a direct comparison of the old hash to the new
> hash *and* preclude us from having to actually calculate the hash on
> the client since it can just be copied from what the server gave you!
> I think this will give us the most gain for 99% of all file cases
> right now since file serving was such a dog until the 2.6 series.

I think that's a good optimization.  It'll require some changes to the 
internals, I think - there's currently no way to specify a desired checksum 
alongside the content.  The short answer is that it's definitely worthwhile to 
implement some of these optimizations, but it'll take some work to get them 
into the system.

We need to do that anyway, because:

You can currently actually post-process your catalogs and replace content with 
checksums, and Puppet will use the file bucket to get the associated content by 
checksum.  This is a bit of a bug, because it means you can't write a file 
whose entire contents are just a checksum, but it hasn't come up that I know of.

Anyway, given that, you can do the pre-calculation now with a bit of hackery, 
which saves you half of the time.  You could actually write a post-processor 
for the server that filled in the checksum, mode, group, and owner of the file, 
so you didn't need to do the metadata call at all.  You'd just need to make 
sure the server had the content stored in its filebucket, so when the client 
went to get the file when needed, it could do so.

Note that we'll be providing this functionality at some point, but if you want 
to jump the gun, it is possible.

I don't know how we'll end up implementing it, so I can't really provide much 
help if you wanted to actually submit patches.  You'd basically need to write a 
catalog terminus to replace the existing 'compiler' terminus - your new 
terminus would call the compiler terminus, do the post-processing you wanted, 
and then return the results.

-- 
A classic is something that everybody wants to have read and nobody
wants to read.  -- Mark Twain
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199




-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to