Differences between revisions 5 and 6
Revision 5 as of 2009-08-27 22:36:34
Size: 2895
Editor: abuehl
Comment:
Revision 6 as of 2010-02-08 13:47:41
Size: 3012
Editor: tonfa
Comment:
Deletions are marked like this. Additions are marked like this.
Line 45: Line 45:
 * [[http://markmail.org/thread/ooqvjdaor4t3sxan|[RFC] [revlog] parent-delta]] mailing list thread (September 2009)

Revlog parent deltas

The RevlogNG file format has a few known weaknesses, one of which is the lack of parent deltas. That is, new revisions are always delta'ed against the revision directly before it, when in many cases it makes much more sense to diff against the parent revision instead (e.g. when they're on very different branches). This makes some revlogs very space-inefficient, particularly in very branchy repositories or in repositories that have been converted from some other VCS. This can be seen from the reduction caused by "manual" reordering of the revlog, particularly for the manifest revlog in larger repositories.

Implementation

It would be nice to reduce at least some of the inefficiency by being able to delta against the parent revision in cases where that's an easy win. In RevlogNG, revisions can be constructed from taking the (specified) base revision and applying all revisions from that base revision, in a contiguous block, through to the requested revision. This means there's little seek time (seeks, being dependent on disk rotation speeds, are particularly expensive and resistent to Moore's law). Any algorithm for parent deltas should not expand the number of seeks too much, this means the distance between the offset of the base rev and tip should be smaller than a certain amount.

The case of merge revision should be investigated, should we always take the first parent, or can we allow both?

Strategy

Disk format changes

In current revlogs, the implicit rev to delta from is the former revision. If there are cases in which we don't want to do that anymore, we should either

  • always use (one of the) revision parent(s)
  • use some of the unused bits to designate a parent or switch parent selection
  • add a field to specify the new base-delta revision in

Of course, we also need all the backwards compatibility trappings (e.g. requires, wire protocol stuff).

Wire protocol changes

For efficiency (to avoid re-diffing every rev), the WireProtocol can be changed to allow a different changegroup format:

  • either always send a diff vs. the parent
  • or add have a bit that specify the kind of delta

If all the delta from the changegroup are using diff vs. parent, reordering on the fly during a pull/push/clone might be much cheaper (less delta to recompute).

Note: It might come in handy if we had the following amongst the delta base options:

  • previous in chain,
  • parent1,
  • parent2, or
  • none (meaning we send the full text).

This would help with shallow clones if they ever materialize.

Literature

ParentDeltaPlan (last edited 2015-03-08 04:32:20 by KevinBullock)