Commit Graph

379 Commits

Author SHA1 Message Date
Matt Mackall
66805ccfed revlog: stop exporting node.short 2011-05-21 15:01:28 -05:00
Matt Mackall
a6f2ad6f1e revlog: drop base() again
deltaparent does what's needed, and more "portably".
2011-05-18 17:05:30 -05:00
Sune Foldager
9a73f9bed3 revlog: linearize created changegroups in generaldelta revlogs
This greatly improves the speed of the bundling process, and often reduces the
bundle size considerably. (Although if the repository is already ordered, this
has little effect on both time and bundle size.)

For non-generaldelta clients, the reduced bundle size translates to a reduced
repository size, similar to shrinking the revlogs (which uses the exact same
algorithm). For generaldelta clients the difference is minor.

When the new bundle format comes, reordering will not be necessary since we
can then store the deltaparent relationsships directly. The eventual default
behavior for clients and servers is presented in the table below, where "new"
implies support for GD as well as the new bundle format:

                    old client                    new client
old server          old bundle, no reorder        old bundle, no reorder
new server, non-GD  old bundle, no reorder[1]     old bundle, no reorder[2]
new server, GD      old bundle, reorder[3]        new bundle, no reorder[4]

[1] reordering is expensive on the server in this case, skip it
[2] client can choose to do its own redelta here
[3] reordering is needed because otherwise the pull does a lot of extra
    work on the server
[4] reordering isn't needed because client can get deltabase in bundle
    format

Currently, the default is to reorder on GD-servers, and not otherwise. A new
setting, bundle.reorder, has been added to override the default reordering
behavior. It can be set to either 'auto' (the default), or any true or false
value as a standard boolean setting, to either force the reordering on or off
regardless of generaldelta.


Some timing data from a relatively branch test repository follows. All
bundling is done with --all --type none options.

Non-generaldelta, non-shrunk repo:
-----------------------------------
Size: 276M

Without reorder (default):
Bundle time: 14.4 seconds
Bundle size: 939M

With reorder:
Bundle time: 1 minute, 29.3 seconds
Bundle size: 381M

Generaldelta, non-shrunk repo:
-----------------------------------
Size: 87M

Without reorder:
Bundle time: 2 minutes, 1.4 seconds
Bundle size: 939M

With reorder (default):
Bundle time: 25.5 seconds
Bundle size: 381M
2011-05-18 23:26:26 +02:00
Sune Foldager
c222fc4662 changelog: don't use generaldelta 2011-05-16 13:06:48 +02:00
Sune Foldager
d7f01e602b revlog: get rid of defversion
defversion was a property (later option) on the store opener, used to propagate
the changelog revlog format to the other revlogs, so they would be created with
the same format.

This required that the changelog instance was created before any other revlog;
an invariant that wasn't directly enforced (or documented) anywhere.

We now use the revlogv1 requirement instead, which is transfered to the store
opener options. If this option is missing, v0 revlogs are created.
2011-05-16 12:44:34 +02:00
Matt Mackall
608041d55e revlog: restore the base method 2011-05-15 11:50:15 -05:00
Sune Foldager
2ce60e2564 revlog: improve delta generation heuristics for generaldelta
Without this change, pulls (and clones) into a generaldelta repository could
generate very inefficient revlogs, the size of which could be at least twice
the original size.

This was caused by the generated delta chains covering too large distances,
causing new chains to be built far too often. This change addresses the
problem by forcing a delta against second parent or against the previous
revision, when the first parent delta is in danger of creating a long chain.
2011-05-12 15:24:33 +02:00
Sune Foldager
7b30600f6b revlog: fix bug in chainbase cache
The bug didn't cause corruption, and thus wasn't caught in hg verify or in
tests. It could lead to delta chains longer than normally allowed, by
affecting the code that decides when to add a full revision. This could,
in turn, lead to performance regression.
2011-05-12 13:47:17 +02:00
Sune Foldager
762090a2c7 revlog: add docstring to _addrevision 2011-05-11 11:04:44 +02:00
Sune Foldager
1c7dece034 revlog: support writing generaldelta revlogs
With generaldelta switched on, deltas are always computed against the first
parent when adding revisions. This is done regardless of what revision the
incoming bundle, if any, is deltaed against.

The exact delta building strategy is subject to change, but this will not
affect compatibility.

Generaldelta is switched off by default.
2011-05-08 21:32:33 +02:00
Sune Foldager
8bdf02181a revlog: support reading generaldelta revlogs
Generaldelta is a new revlog global flag. When it's turned on, the base field
of each revision entry holds the deltaparent instead of the base revision of
the current delta chain.

This allows for great potential flexibility when generating deltas, as any
revision can serve as deltaparent. Previously, the deltaparent for revision r
was hardcoded to be r - 1.

The base revision of the delta chain can still be accessed as before, since it
is now computed in an iterative fashion, following the deltaparents backwards.
2011-05-07 22:40:17 +02:00
Sune Foldager
88485e9322 revlog: calculate base revisions iteratively
This is in preparation for generaldelta, where the revlog entry base field is
reinterpreted as the deltaparent. For that reason we also rename the base
function to chainbase.

Without generaldelta, performance is unaffected, but generaldelta will suffer
from this in _addrevision, since delta chains will be walked repeatedly.
A cache has been added to eliminate this problem completely.
2011-05-07 22:40:14 +02:00
Sune Foldager
be6386433b revlog: remove the last bits of punched/shallow
Most of it was removed in fa05c723ac8c, but a few pieces were accidentally
left behind.
2011-05-07 22:37:40 +02:00
Martin Geisler
d04646b8d9 revlog: use real Booleans instead of 0/1 in nodesbetween 2011-05-06 12:09:20 +02:00
Sune Foldager
750dcd7b48 revlog: compute correct deltaparent in the deltaparent function
It now returns nullrev for chain base revisions, since they are conceptually
deltas against nullrev. The revdiff function was updated accordingly.
2011-05-05 18:05:24 +02:00
Sune Foldager
bb96ed66fc revlog: remove support for punched/shallow
The feature was never finished, and there has been restructuring going on
since it was added.
2011-05-05 12:46:02 +02:00
Sune Foldager
d959ff1e97 revlog: remove support for parentdelta
We will introduce a more powerful and general delta concept instead,
called generaldelta.
2011-05-05 12:55:12 +02:00
Peter Arrenbrecht
75fa0e5ea9 discovery: add new set-based discovery
Adds a new discovery method based on repeatedly sampling the still
undecided subset of the local node graph to determine the set of nodes
common to both the client and the server.

For small differences between client and server, it uses about the same
or slightly fewer roundtrips than the old tree-based discovery. For
larger differences, it typically reduces the number of roundtrips
drastically (from 150 to 4, for instance).

The old discovery code now lives in treediscovery.py, the new code is
in setdiscovery.py.

Still missing is a hook for extensions to contribute nodes to the
initial sample. For instance, Augie's remotebranches could contribute
the last known state of the server's heads.

Credits for the actual sampler and computing common heads instead of
bases go to Benoit Boissinot.
2011-05-02 19:21:30 +02:00
Benoit Boissinot
b805aced54 unbundler: separate delta and header parsing
Add header parsing for changelog and manifest (currently no headers might
change for next-gen bundle).
2011-04-30 19:01:24 +02:00
Benoit Boissinot
e3152ec807 changegroup: new bundler API 2011-04-30 11:03:28 +02:00
Benoit Boissinot
c5f5260aea bundler: make parsechunk return the base revision of the delta 2011-04-30 10:00:41 +02:00
Sune Foldager
9b847e3562 revlog: introduce _chunkbase to allow filelog to override
Used by revlog.revision to retrieve the base-chunk in a delta chain.
2011-04-30 16:33:47 +02:00
Alexander Solovyov
0eb3836642 remove unused imports and variables 2011-04-30 13:59:14 +02:00
Matt Mackall
1fb0b59ceb changegroup: introduce bundler objects
This makes the bundler pluggable at lower levels.
2011-03-31 15:24:06 -05:00
Matt Mackall
c9e7d5507f changegroup: add revlog to the group callback 2011-03-28 11:18:56 -05:00
Matt Mackall
d9e86660be changegroup: move sorting down into group 2011-03-28 11:18:56 -05:00
Matt Mackall
f94b6206a0 changegroup: combine infocollect and lookup callbacks 2011-03-28 11:18:56 -05:00
Matt Mackall
af08071ace changegroup: drop unused fullrev
This is unfinished and unused and complicates expanding the wire protocol.
2011-03-24 17:16:30 -05:00
Matt Mackall
f689cccd2c revlog: change variable name to avoid reuse 2011-03-26 17:12:02 -05:00
Peter Arrenbrecht
6646f48826 wireproto: add getbundle() function
getbundle(common, heads) -> bundle

Returns the changegroup for all ancestors of heads which are not ancestors of common. For both
sets, the heads are included in the set.

Intended to eventually supercede changegroupsubset and changegroup. Uses heads of common region
to exclude unwanted changesets instead of bases of desired region, which is more useful and
easier to implement.

Designed to be extensible with new optional arguments (which will have to be guarded by
corresponding capabilities).
2011-03-23 16:02:11 +01:00
Dan Villiom Podlaski Christiansen
ec590d5cd4 explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
2010-12-24 15:23:01 +01:00
Matt Mackall
f549de8060 revlog: remove stray test in rev() 2011-01-21 16:26:01 -06:00
Matt Mackall
856c224de7 revlog: pass rev to _checkhash 2011-01-18 15:55:48 -06:00
Matt Mackall
275d2d9cb0 revlog: incrementally build node cache with linear searches
This avoids needing to prime the cache for operations like verify
which visit most or all of the index.
2011-01-18 15:55:46 -06:00
Benoit Boissinot
8acffa3308 revlog: explicit test and explicit variable names 2011-01-16 12:25:46 +01:00
Benoit Boissinot
3ada8fe22e revlog: if the nodemap is set, use the fast version of revlog.rev() 2011-01-16 12:24:48 +01:00
Benoit Boissinot
383d62511b revlog/parseindex: construct the nodemap if it is empty 2011-01-15 15:06:53 +01:00
Benoit Boissinot
4072e97b7c revlog: always add the magic nullid/nullrev entry in parseindex 2011-01-15 13:02:19 +01:00
Benoit Boissinot
b75c111431 revlog/parseindex: no need to pass the file around 2011-01-15 15:04:58 +01:00
Matt Mackall
1e3dbac7f5 revlog: do revlog node->rev mapping by scanning
Now that the nodemap is lazily created, we use linear scanning back
from tip for typical node to rev mapping. Given that nodemap creation
is O(n log n) and revisions searched for are usually very close to
tip, this is often a significant performance win for a small number of
searches.

When we do end up building a nodemap for bulk lookups, the scanning
function is replaced with a hash lookup.
2011-01-11 21:52:03 -06:00
Matt Mackall
a1c37f5749 revlog: introduce a cache for partial lookups
Partial lookups are always O(n), and often we look up the same
one multiple times.
2011-01-11 17:12:32 -06:00
Matt Mackall
846d35e24f revlog: only build the nodemap on demand 2011-01-11 17:01:04 -06:00
Matt Mackall
efaaee2894 revlog: remove lazy index 2011-01-04 14:12:52 -06:00
Matt Mackall
a399da7502 revlog: break hash checking into subfunction 2011-01-06 17:04:41 -06:00
Martin Geisler
6a3d9310ab code style: prefer 'is' and 'is not' tests with singletons 2010-11-22 18:15:58 +01:00
Nicolas Dumazet
f48c256c16 revlog: fix descendants() if nullrev is in revs
We were not returning the correct result if nullrev was in revs, as we
are checking parent(currentrev) != nullrev before yielding currentrev

test-convert-hg-startrev was wrong: if we start converting from rev -1 and
onwards, all the descendants of -1 (full repo) should be converted.
2010-11-07 18:23:48 +09:00
Nicolas Dumazet
31a27ed9b9 revlog: if start is nullrev, end is always a descendant 2010-11-07 18:16:07 +09:00
Matt Mackall
90141f6021 revlog: choose best delta for parentdelta (issue2466)
When parentdelta is enabled, we choose the delta that has the minimum
distance to its base. Otherwise, base may be sufficiently far away to
require a full version, resulting in greatly reduced compression.
2010-10-30 02:47:34 -05:00
Matt Mackall
d0eecfc8e5 revlog: precalculate p1 and p2 revisions 2010-10-30 02:47:34 -05:00
Matt Mackall
9e1ed89cc3 revlog: extract delta building to a subfunction 2010-10-30 02:47:34 -05:00