Mercurial > hg
view tests/test-push-cgi.t @ 39018:e793e11e1462
changegroup: introduce requests to define delta generation
Currently, we iterate through each revision we will be producing
a delta for then call into 1 of 2 functions for generating that
delta. Deltas are emitted as we iterate.
A problem with this model is that revision generation is tightly
coupled to the changegroup code. And the storage layer needs to
expose APIs like deltaparent() so changegroup delta generation
can produce a delta with that knowledge.
Another problem is that in this model, deltas can only be produced
sequentially after the previous delta was produced and emitted.
Some storage backends might be capable of producing deltas in
parallel (e.g. if the changegroup deltas are cached somewhere).
This commit aims to solve these problems by turning delta generation
into a 2 phase implementation where the first phase determines
info about all the deltas that need to be generated and the 2nd
phase resolves those deltas.
We introduce a "revisiondeltarequest" object that holds data about
a to-be-generated delta. We perform a full pass over all revisions
whose delta is to be generated and generate a "revisiondeltarequest"
for each. Then we iterate over the "revisiondeltarequest" instances
and derive a "revisiondelta" for each.
This patch was quite large. In order to avoid even more churn, aspects
of the implementation are less than ideal. e.g. we're recording
revision numbers instead of nodes in a few places and we don't
yet have a formal API for resolving an iterable of revisiondeltarequest
instances. Things will be improved in subsequent commits.
Unfortunately, this commit reduces performance substantially. For
`hg perfchangegroupchangelog` on my hg repo:
! wall 1.512607 comb 1.510000 user 1.490000 sys 0.020000 (best of 7)
! wall 2.150863 comb 2.150000 user 2.150000 sys 0.000000 (best of 5)
And for `hg bundle -t none-v2 -a` for the mozilla-unified repo:
178.32user 4.22system 3:02.59elapsed
190.97user 4.17system 3:15.19elapsed
Some of this was attributed to changelog slowdown. `hg
perfchangegroupchangelog` on mozilla-unified:
! wall 21.688715 comb 21.690000 user 21.570000 sys 0.120000 (best of 3)
! wall 25.683659 comb 25.680000 user 25.540000 sys 0.140000 (best of 3)
Profiling seems to reveal that the changelog slowdown is due to reading
changelog revisions multiple times. First in the linknode callback
to resolve the set of files changed. Second in the delta generation.
Before, we likely had hit the last revision cache in the revlog when
doing delta generation since we performed that immediately after
performing the linknode callback.
I'm not exactly sure where the other ~8s are being spent. It might be
from overhead of constructing a few million revisiondeltarequest
objects. I'm OK with the regression for now because it is in service
of a larger cause (storage abstraction). I'll try to profile later
and claw back the performance.
Differential Revision: https://phab.mercurial-scm.org/D4215
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 09 Aug 2018 09:28:26 -0700 |
parents | 8e6f4939a69a |
children | 23b749b84b8a |
line wrap: on
line source
#require no-msys # MSYS will translate web paths as if they were file paths This is a test of the push wire protocol over CGI-based hgweb. initialize repository $ hg init r $ cd r $ echo a > a $ hg ci -A -m "0" adding a $ echo '[web]' > .hg/hgrc $ echo 'allow_push = *' >> .hg/hgrc $ echo 'push_ssl = false' >> .hg/hgrc create hgweb invocation script $ cat >hgweb.cgi <<HGWEB > import cgitb > cgitb.enable() > from mercurial import demandimport; demandimport.enable() > from mercurial.hgweb import hgweb > from mercurial.hgweb import wsgicgi > application = hgweb('.', 'test repository') > wsgicgi.launch(application) > HGWEB $ chmod 755 hgweb.cgi test preparation $ . "$TESTDIR/cgienv" $ REQUEST_METHOD="POST"; export REQUEST_METHOD $ CONTENT_TYPE="application/octet-stream"; export CONTENT_TYPE $ hg bundle --type v1 --all bundle.hg 1 changesets found $ CONTENT_LENGTH=279; export CONTENT_LENGTH; expect failure because heads doesn't match (formerly known as 'unsynced changes') $ QUERY_STRING="cmd=unbundle&heads=0000000000000000000000000000000000000000"; export QUERY_STRING $ $PYTHON hgweb.cgi <bundle.hg >page1 2>&1 $ cat page1 Status: 200 Script output follows\r (esc) Content-Type: application/mercurial-0.1\r (esc) Content-Length: 64\r (esc) \r (esc) 0 repository changed while preparing changes - please try again successful force push $ QUERY_STRING="cmd=unbundle&heads=666f726365"; export QUERY_STRING $ $PYTHON hgweb.cgi <bundle.hg >page2 2>&1 $ cat page2 Status: 200 Script output follows\r (esc) Content-Type: application/mercurial-0.1\r (esc) Content-Length: 102\r (esc) \r (esc) 1 adding changesets adding manifests adding file changes added 0 changesets with 0 changes to 1 files successful push, list of heads $ QUERY_STRING="cmd=unbundle&heads=f7b1eb17ad24730a1651fccd46c43826d1bbc2ac"; export QUERY_STRING $ $PYTHON hgweb.cgi <bundle.hg >page3 2>&1 $ cat page3 Status: 200 Script output follows\r (esc) Content-Type: application/mercurial-0.1\r (esc) Content-Length: 102\r (esc) \r (esc) 1 adding changesets adding manifests adding file changes added 0 changesets with 0 changes to 1 files successful push, SHA1 hash of heads (unbundlehash capability) $ QUERY_STRING="cmd=unbundle&heads=686173686564 5a785a5f9e0d433b88ed862b206b011b0c3a9d13"; export QUERY_STRING $ $PYTHON hgweb.cgi <bundle.hg >page4 2>&1 $ cat page4 Status: 200 Script output follows\r (esc) Content-Type: application/mercurial-0.1\r (esc) Content-Length: 102\r (esc) \r (esc) 1 adding changesets adding manifests adding file changes added 0 changesets with 0 changes to 1 files $ cd ..