Re: WARNING! Object DB conversion (was Re: [PATCH] write-tree performance problems)

2005-04-20 Thread Ingo Molnar

* Linus Torvalds [EMAIL PROTECTED] wrote:

 So to convert your old git setup to a new git setup, do the following:
 [...]

did this for two repositories (git and kernel-git), it works as 
advertised.

Ingo
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: WARNING! Object DB conversion (was Re: [PATCH] write-tree performance problems)

2005-04-20 Thread Jon Seymour
On 4/20/05, Linus Torvalds [EMAIL PROTECTED] wrote:
 
 
 I converted my git archives (kernel and git itself) to do the SHA1 hash
 _before_ the compression phase.
 

Linus,
 
 Am I correct to understand that with this change, all the objects in
the database are still being compressed (so no net performance benefit
now), but by doing the SHA1 calculations before compression you are
keeping open the possibility that at some point in the future you may
use a different compression technique (including none at all) for some
or all of the objects?

jon.

[ reposted to list, because list post was bounced because of rich text
formatting ]
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: WARNING! Object DB conversion (was Re: [PATCH] write-tree performance problems)

2005-04-20 Thread Martin Uecker
On Wed, Apr 20, 2005 at 10:11:10PM +1000, Jon Seymour wrote:
 On 4/20/05, Linus Torvalds [EMAIL PROTECTED] wrote:
  
  
  I converted my git archives (kernel and git itself) to do the SHA1 hash
  _before_ the compression phase.
  
 
 Linus,
  
  Am I correct to understand that with this change, all the objects in
 the database are still being compressed (so no net performance benefit
 now), but by doing the SHA1 calculations before compression you are
 keeping open the possibility that at some point in the future you may
 use a different compression technique (including none at all) for some
 or all of the objects?

The main point is not about trying different compression
techniques but that you don't need to compress at all just
to calculate the hash of some data. (to know if it is
unchanged for example)

There are still some other design decisions I am worried
about:

The storage method of the database of a collection of
files in the underlying file system. Because of the
random nature of the hashes this leads to a horrible
amount of seeking for all operations which walk the
logical structure of some tree stored in the database.

Why not store all objects linearized in one or more
flat file?


The other thing I don't like is the use of a sha1
for a complete file. Switching to some kind of hash
tree would allow to introduce chunks later. This has
two advantages:

It would allow git to scale to repositories of large
binary files. And it would allow to build a very cool
content transport algorithm for those repositories.
This algorithm could combine all the advantages of
bittorrent and rsync (without the cpu load).


And it would allow trivial merging of patches which
apply to different chunks of a file in exact the same
way as merging changesets which apply to different
files in a tree.


Martin

-- 
One night, when little Giana from Milano was fast asleep,
she had a strange dream.



signature.asc
Description: Digital signature


Re: WARNING! Object DB conversion (was Re: [PATCH] write-tree performance problems)

2005-04-20 Thread Morten Welinder
On 4/20/05, Martin Uecker [EMAIL PROTECTED] wrote:

 The storage method of the database of a collection of
 files in the underlying file system. Because of the
 random nature of the hashes this leads to a horrible
 amount of seeking for all operations which walk the
 logical structure of some tree stored in the database.
 
 Why not store all objects linearized in one or more
 flat file?

I've been thinking along the same lines and it doesn't look too hard
to factor out the
back end, i.e., provide methods to
read/write/stat/remove/mmap/whatever objects.
(Note the mmap there.  Apart from that, the backend could be an http connection
or worse.)

It will, however, seriously break rsync as transport for people who
commit to their trees.
Thus you need an alternative in place before you can present it as an
alternative.

Morten
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: WARNING! Object DB conversion (was Re: [PATCH] write-tree performance problems)

2005-04-20 Thread Jon Seymour
 The main point is not about trying different compression
 techniques but that you don't need to compress at all just
 to calculate the hash of some data. (to know if it is
 unchanged for example)
 

Ah, ok, I didn't understand that there were extra compresses being
performed for that reason. Thanks for the explanation.

jon.
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: WARNING! Object DB conversion (was Re: [PATCH] write-tree performance problems)

2005-04-20 Thread David Woodhouse
On Wed, 2005-04-20 at 02:08 -0700, Linus Torvalds wrote:
 I converted my git archives (kernel and git itself) to do the SHA1
 hash _before_ the compression phase.

I'm happy to see that -- because I'm going to be asking you to make
another change which will also require a simple repository conversion. 

We are working on getting the complete history since 2.4.0 into git
form. When it's done and checked (which should be RSN) I'd like you to
edit the first commit object in your tree -- the import of 2.6.12-rc2,
and give it a parent. That parent will be the sha1 hash of the
2.6.12-rc2 commit in the newly-provided history, and of course will
change the sha1 hash of your first commit, and all subsequent commits. 
We'll provide a tool to do that, of course.

The history itself will be absent from your tree. Obviously we'll need
to make sure that the tools can cope with an absentee parent, probably
by just treating that case as if no parent exists. That won't be hard,
it'll be useful for people to prune their trees of unwanted older
history in the general case too. That history won't be lost or undone --
it'll just be archived elsewhere.

The reason for doing this is that without it, we can't ever have a full
history actually connected to the current trees. There'd always be a
break at 2.6.12-rc2, at which point you'd have to switch to an entirely
different git repository.

-- 
dwmw2

-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: WARNING! Object DB conversion (was Re: [PATCH] write-tree performance problems)

2005-04-20 Thread Linus Torvalds


On Wed, 20 Apr 2005, Jon Seymour wrote:
 
 Am I correct to understand that with this change, all the objects in the 
 database are still being compressed (so no net performance benefit), but by 
 doing the SHA1 calculations before compression you are keeping open the 
 possibility that at some point in the future you may use a different 
 compression technique (including none at all) for some or all of the 
 objects?

Correct. There is zero performance benefit to this right now, and the only 
reason for doing it is because it will allow other things to happen.

Note that the other things include:
 - change the compression format to make it cheaper
 - _keep_ the same compression format, but notice that we already have an 
   object by looking at the uncompressed one.

I'm actually leaning towards just #2 at this time. I like how things
compress, and it sure is simple. The fact that we use the equivalent of
-9 may be expensive, but the thing is, we don't actually write new files
that often, and it's just CPU time (no seeking on disk or anything like
that), which tends to get cheaper over time.

So I suspect that once I optimize the tree writing to notice that oh, I
already have this tree object, and thus build it up but never compressing
it, write-tree performance will go up _hugely_ even without removing the
compressioin. Because most of the time, write-tree actually only needs to
create a couple of small new tree objects.

Linus
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: WARNING! Object DB conversion (was Re: [PATCH] write-tree performance problems)

2005-04-20 Thread Martin Uecker
On Wed, Apr 20, 2005 at 10:30:15AM -0400, C. Scott Ananian wrote:

Hi,

your code looks pretty cool. thank you!

 On Wed, 20 Apr 2005, Martin Uecker wrote:
 
 The other thing I don't like is the use of a sha1
 for a complete file. Switching to some kind of hash
 tree would allow to introduce chunks later. This has
 two advantages:
 
 You can (and my code demonstrates/will demonstrate) still use a whole-file 
 hash to use chunking.  With content prefixes, this takes O(N ln M) time 
 (where N is the file size and M is the number of chunks) to compute all 
 hashes; if subtrees can share the same prefix, then you can do this in 
 O(N) time (ie, as fast as possible, modulo a constant factor, which is 
 '2').  You don't *need* internal hashing functions.

I don't understand this paragraph. What is an internal
hash function? Your code seems to do exactly what I want.
The hashes are computed recusively as in a hash tree
with O(N ln N). The only difference between your design
and a design based on a conventional (binary) hash tree
seems to be that data is stored in the intermediate nodes
too. 

 It would allow git to scale to repositories of large
 binary files. And it would allow to build a very cool
 content transport algorithm for those repositories.
 This algorithm could combine all the advantages of
 bittorrent and rsync (without the cpu load).
 
 Yes, the big benefit of internal hashing is that it lets you check 
 validity of a chunk w/o having the entire file available.  I'm not sure 
 that's terribly useful in this case.  [And, if it is, then it can 
 obviously be done w/ other means.]

If I don't miss anything essential, you can validate
each treap piece at the moment you get it from the
network with its SHA1 hash and then proceed with
downloading the prefix and suffix tree (in parallel
if you have more than one peer a la bittorrent).

 And it would allow trivial merging of patches which
 apply to different chunks of a file in exact the same
 way as merging changesets which apply to different
 files in a tree.
 
 I'm not sure anyone should be looking at chunks.  To me, at least, they 
 are an object-store-implementation detail only.  For merging, etc, we 
 should be looking at whole files, or (better) the whole repository.
 The chunking algorithm is guaranteed not to respect semantic boundaries 
 (for *some* semantics of *some* file).

You might be right. I just wanted to point out this
possibility because it would allow to avoid calling
external merging code for a lot of trivial merges.

bye,
Martin



-- 
One night, when little Giana from Milano was fast asleep,
she had a strange dream.



signature.asc
Description: Digital signature


Re: WARNING! Object DB conversion (was Re: [PATCH] write-tree performance problems)

2005-04-20 Thread Martin Uecker
On Wed, Apr 20, 2005 at 11:28:20AM -0400, C. Scott Ananian wrote:

Hi,
 
 A merkle-tree (which I think you initially pointed me at) makes the hash 
 of the internal nodes be a hash of the chunk's hashes; ie not a straight 
 content hash.  This is roughly what my current implementation does, but
 I would like to identify each subtree with the hash of the 
 *(expanded) contents of that subtree* (ie no explicit reference to 
 subtree hashes).  This makes it interoperable with non-chunked or 
 differently-chunked representations, in that the top-level hash is *just 
 the hash of the complete content*, not some hash-of-subtree-hashes.  Does 
 that make more sense?

Yes, thank you. But I would like to argue against this:

You can make the representations interoperable
if you calculate the hash for the non-chunked
representations exactly as if this file is stored
chunked but simple do not store it in that way.

Of course this is not backward compatible to the
monolithic hash and not compatible with a differently
chunked representation (but you could store subtrees
unchunked if you think your chunks are too small).

 The code I posted doesn't demonstrate this very well, but now that Linus 
 has abandoned the 'hash of compressed content' stuff, my next code posting 
 should show this more clearly.

I think the hash of the treap piece should be calculated
from the hash of the prefix and suffix tree and the already
calculated hash of the uncompressed data. This makes hashing
nearly as cheap as in Linus version which is important
because checking whether a given file has identically
content as a stored version should be fast.

 If I don't miss anything essential, you can validate
 each treap piece at the moment you get it from the
 network with its SHA1 hash and then proceed with
 downloading the prefix and suffix tree (in parallel
 if you have more than one peer a la bittorrent).
 
 Yes, I guess this is the detail I was going to abandon. =)
 
 I viewed the fact that the top-level hash was dependent on the exact chunk 
 makeup a 'misfeature', because it doesn't allow easy interoperability with 
 existing non-chunked repos.

I thought this as a misfeature too before I realized how
many advantages this has.

Martin
 

-- 
One night, when little Giana from Milano was fast asleep,
she had a strange dream.



signature.asc
Description: Digital signature


Re: WARNING! Object DB conversion (was Re: [PATCH] write-tree performance problems)

2005-04-20 Thread David Woodhouse
On Wed, 2005-04-20 at 07:59 -0700, Linus Torvalds wrote:
 external-parent commit-hash external-parent-ID
 comment for this parent
 
 and the nice thing about that is that now that information allows you to 
 add external parents at any point. 
 
 Why do it like this? First off, I think that the initial import ends up
 being just one special case of the much more _generic_ issue of having
 patches come in from other source control systems 

This isn't about patches coming in from other systems -- it's about
_history_, and the fact that it's imported from another system is just
an implementation detail. It's git history now, and what we have here is
just a special case of wanting to prune ancient git history to keep the
size of our working trees down. You refer to this yourself...

 Secondly, we do need something like this for pruning off history anyway, 
 so that the tools have a better way of saying history has been pruned 
 off than just hitting a missing commit. 

Having a more explicit way of saying history is pruned than just a
reference to a missing commit is a reasonable request -- but I really
don't see how we can do that by changing the now-oldest commit object to
contain an 'external-parent' field. Doing that would change the sha1 of
the commit object in question, and then ripple through all the
subsequent commits.

Come this time next year, if I decide I want to prune anything older
than 2.6.40 from all the trees on my laptop, it has to happen _without_
changing the commit objects which occur after my arbitrarily-chosen
cutoff point.

If we want to have an explicit record of pruning rather than just
copying with a missing object, then I think we'd need to do it with an
external note to say It's OK that commit XXX is missing.

 Thirdly, I don't actually want my new tree to depend on a conversion of
 the old BK tree.
 
 Two reasons: if it's a really full conversion, there are definitely going
 to be issues with BitMover. They do not want people to try to reverse
 engineer how they do namespace merges

Don't think of it as a conversion of the old BK tree. It's just an
import of Linux's development history. This isn't going to help
reverse-engineer how BK does merges; it's just our own revision history.
I'm not sure exactly how Thomas is extracting it, but AIUI it's all
obtainable from the SCCS files anyway without actually resorting to
using BK itself. 

There's nothing here for Larry to worry about. It's not as if we're
actually using BK to develop git by observing BK's behaviour w.r.t
merges and trying to emulate it. Besides -- if we wanted to do that,
we'd need to use the _BK_ version of the tree; the git version wouldn't
help us much anyway.

And given that BK's merges are based on individual files and we're not
going that route with git, it's not clear how much we could lift
directly from BK even if we _were_ going to try that.

 The other reason is just the really obvious one: in the last week, I've
 already changed the format _twice_ in ways that change the hash. As long
 as it's 119MB of data, it's not going to be too nasty to do again.

That's fine. But by the time we settle on a format and actually start
using it in anger, it'd be good to be sure that it _is_ possible to
track development from current trees all the way back -- be that with
explicit reference to pruned history as you suggest, or with absent
parents as I still prefer.

 it's not that it's necessarily the wrong thing to do, but I think it
 is the wrogn thing to do _now_.

OK, time for us to keep arguing over the implementation details of how
we prune history then :)

-- 
dwmw2

-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html