Mercurial > hg
view tests/test-narrow-widen-no-ellipsis.t @ 49777:e1953a34c110
bundle: emit full snapshot as is, without doing a redelta
With the new `forced` delta-reused policy, it become important to be able to
send full snapshot where full snapshot are needed. Otherwise, the fallback delta
will simply be used on the client sideā¦ creating monstrous delta chain, since
revision that are meant as a reset of delta-chain chain becoming too complex are
simply adding a new full delta-tree on the leaf of another one.
In the `non-forced` cases, client process full snapshot from the bundle
differently from deltas, so client will still try to convert the full snapshot
into a delta if possible. So this will no lead to pathological storage
explosion.
I have considered making this configurable, but the impact seems limited enough
that it does not seems to be worth it. Especially with the current
sparse-revlog format that use "delta-tree" with multiple level snapshots, full
snapshot are much less frequent and not that different from other intermediate
snapshot that we are already sending over the wire anyway.
CPU wise, this will help the bundling side a little as it will not need to
reconstruct revisions and compute deltas. The unbundling side might save a tiny
amount of CPU as it won't need to reconstruct the delta-base to reconstruct the
revision full text. This only slightly visible in some of the benchmarks. And
have no real impact on most of them.
### data-env-vars.name = pypy-2018-08-01-zstd-sparse-revlog
# benchmark.name = perf-bundle
# benchmark.variants.revs = last-40000
before: 11.467186 seconds
just-emit-full: 11.190576 seconds (-2.41%)
with-pull-force: 11.041091 seconds (-3.72%)
# benchmark.name = perf-unbundle
# benchmark.variants.revs = last-40000
before: 16.744862
just-emit-full:: 16.561036 seconds (-1.10%)
with-pull-force: 16.389344 seconds (-2.12%)
# benchmark.name = pull
# benchmark.variants.revs = last-40000
before: 26.870569
just-emit-full: 26.391188 seconds (-1.78%)
with-pull-force: 25.633184 seconds (-4.60%)
Space wise (so network-wise) the impact is fairly small. When taking compression into
account.
Below are tests the size of `hg bundle --all` for a handful of benchmark repositories
(with bzip, zstd compression and without it)
This show a small increase in the bundle size, but nothing really significant
except maybe for mozilla-try (+12%) that nobody really pulls large chunk of anyway.
Mozilla-try is also the repository that benefit the most for not having to
recompute deltas client size.
### mercurial:
bzip-before: 26 406 342 bytes
bzip-after: 26 691 543 bytes +1.08%
zstd-before: 27 918 645 bytes
zstd-after: 28 075 896 bytes +0.56%
none-before: 98 675 601 bytes
none-after: 100 411 237 bytes +1.76%
### pypy
bzip-before: 201 295 752 bytes
bzip-after: 209 780 282 bytes +4.21%
zstd-before: 202 974 795 bytes
zstd-after: 205 165 780 bytes +1.08%
none-before: 871 070 261 bytes
none-after: 993 595 057 bytes +14.07%
### netbeans
bzip-before: 601 314 330 bytes
bzip-after: 614 246 241 bytes +2.15%
zstd-before: 604 745 136 bytes
zstd-after: 615 497 705 bytes +1.78%
none-before: 3 338 238 571 bytes
none-after: 3 439 422 535 bytes +3.03%
### mozilla-central
bzip-before: 1 493 006 921 bytes
bzip-after: 1 549 650 570 bytes +3.79%
zstd-before: 1 481 910 102 bytes
zstd-after: 1 513 052 415 bytes +2.10%
none-before: 6 535 929 910 bytes
none-after: 7 010 191 342 bytes +7.26%
### mozilla-try
bzip-before: 6 583 425 999 bytes
bzip-after: 7 423 536 928 bytes +12.76%
zstd-before: 6 021 009 212 bytes
zstd-after: 6 674 922 420 bytes +10.86%
none-before: 22 954 739 558 bytes
none-after: 26 013 854 771 bytes +13.32%
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 07 Dec 2022 20:12:23 +0100 |
parents | d72378f93a44 |
children | 2f2682f40ea0 |
line wrap: on
line source
#testcases tree flat $ . "$TESTDIR/narrow-library.sh" #if tree $ cat << EOF >> $HGRCPATH > [experimental] > treemanifest = 1 > EOF #endif $ hg init master $ cd master $ mkdir inside $ echo 'inside' > inside/f $ hg add inside/f $ hg commit -m 'add inside' $ mkdir widest $ echo 'widest' > widest/f $ hg add widest/f $ hg commit -m 'add widest' $ mkdir outside $ echo 'outside' > outside/f $ hg add outside/f $ hg commit -m 'add outside' $ cd .. narrow clone the inside file $ hg clone --narrow ssh://user@dummy/master narrow requesting all changes adding changesets adding manifests adding file changes added 3 changesets with 0 changes to 0 files new changesets *:* (glob) updating to branch default 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd narrow $ hg tracked $ hg files [1] widen from an empty clone $ hg tracked --addinclude inside comparing with ssh://user@dummy/master searching for changes adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files $ hg tracked I path:inside $ ls -A .hg inside $ cat inside/f inside $ cd .. add more upstream files which we will include in a wider narrow spec $ cd master $ mkdir wider $ echo 'wider' > wider/f $ hg add wider/f $ echo 'widest v2' > widest/f $ hg commit -m 'add wider, update widest' $ echo 'widest v3' > widest/f $ hg commit -m 'update widest v3' $ echo 'inside v2' > inside/f $ hg commit -m 'update inside' $ mkdir outside2 $ echo 'outside2' > outside2/f $ hg add outside2/f $ hg commit -m 'add outside2' $ echo 'widest v4' > widest/f $ hg commit -m 'update widest v4' $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 7: update widest v4 6: add outside2 5: update inside 4: update widest v3 3: add wider, update widest 2: add outside 1: add widest 0: add inside $ cd .. Widen the narrow spec to see the widest file. This should not get the newly added upstream revisions. $ cd narrow $ hg id -n 2 $ hg tracked --addinclude widest/f --debug comparing with ssh://user@dummy/master running * "*dummyssh" *user@dummy* *hg -R master serve --stdio* (glob) sending hello command sending between command remote: * (glob) remote: capabilities: * (glob) remote: 1 sending protocaps command query 1; heads sending batch command searching for changes all local changesets known remotely sending narrow_widen command bundle2-input-bundle: with-transaction bundle2-input-part: "changegroup" (params: * mandatory) supported (glob) adding changesets adding manifests adding widest/ revisions (tree !) adding file changes adding widest/f revisions bundle2-input-part: total payload size * (glob) bundle2-input-bundle: 1 parts total added 0 changesets with 1 changes to 1 files widest/f: narrowspec updated -> g getting widest/f $ hg tracked I path:inside I path:widest/f $ cat widest/f widest $ hg id -n 2 Test that extending already included files should not call narrow_widen wireprotocol command $ hg tracked --addinclude widest/f nothing to widen or narrow Pull down the newly added upstream revision. $ hg pull pulling from ssh://user@dummy/master searching for changes adding changesets adding manifests adding file changes added 5 changesets with 4 changes to 2 files new changesets *:* (glob) (run 'hg update' to get a working copy) $ hg update -r 'desc("add wider")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cat widest/f widest v2 $ hg update -r 'desc("update inside")' 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cat widest/f widest v3 $ cat inside/f inside v2 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 7: update widest v4 6: add outside2 5: update inside 4: update widest v3 3: add wider, update widest 2: add outside 1: add widest 0: add inside Check that widening with a newline fails $ hg tracked --addinclude 'widest > ' abort: newlines are not allowed in narrowspec paths [255] widen the narrow spec to include the wider file $ hg tracked --addinclude wider comparing with ssh://user@dummy/master searching for changes adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files $ hg tracked I path:inside I path:wider I path:widest/f $ hg update 'desc("add widest")' 2 files updated, 0 files merged, 1 files removed, 0 files unresolved $ cat widest/f widest $ hg update 'desc("add wider, update widest")' 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cat wider/f wider $ cat widest/f widest v2 $ hg update 'desc("update widest v3")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cat widest/f widest v3 $ hg update 'desc("update widest v4")' 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cat widest/f widest v4 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 7: update widest v4 6: add outside2 5: update inside 4: update widest v3 3: add wider, update widest 2: add outside 1: add widest 0: add inside separate suite of tests: files from 0-10 modified in changes 0-10. This allows more obvious precise tests tickling particular corner cases. $ cd .. $ hg init upstream $ cd upstream $ for x in `$TESTDIR/seq.py 0 10` > do > mkdir d$x > echo $x > d$x/f > hg add d$x/f > hg commit -m "add d$x/f" > done $ hg log -T "{rev}: {desc}\n" 10: add d10/f 9: add d9/f 8: add d8/f 7: add d7/f 6: add d6/f 5: add d5/f 4: add d4/f 3: add d3/f 2: add d2/f 1: add d1/f 0: add d0/f make narrow clone with every third node. $ cd .. $ hg clone --narrow ssh://user@dummy/upstream narrow2 --include d0 --include d3 --include d6 --include d9 requesting all changes adding changesets adding manifests adding file changes added 11 changesets with 4 changes to 4 files new changesets *:* (glob) updating to branch default 4 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd narrow2 $ hg tracked I path:d0 I path:d3 I path:d6 I path:d9 $ hg verify checking changesets checking manifests checking directory manifests (tree !) crosschecking files in changesets and manifests checking files checked 11 changesets with 4 changes to 4 files $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 10: add d10/f 9: add d9/f 8: add d8/f 7: add d7/f 6: add d6/f 5: add d5/f 4: add d4/f 3: add d3/f 2: add d2/f 1: add d1/f 0: add d0/f $ hg tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files $ hg tracked I path:d0 I path:d1 I path:d3 I path:d6 I path:d9 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 10: add d10/f 9: add d9/f 8: add d8/f 7: add d7/f 6: add d6/f 5: add d5/f 4: add d4/f 3: add d3/f 2: add d2/f 1: add d1/f 0: add d0/f Verify shouldn't claim the repo is corrupt after a widen. $ hg verify checking changesets checking manifests checking directory manifests (tree !) crosschecking files in changesets and manifests checking files checked 11 changesets with 5 changes to 5 files Widening preserves parent of local commit $ cd .. $ hg clone -q --narrow ssh://user@dummy/upstream narrow3 --include d2 -r 2 $ cd narrow3 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 2: add d2/f 1: add d1/f 0: add d0/f $ hg pull -q -r 3 $ hg co -q tip $ hg pull -q -r 4 $ echo local > d2/f $ hg ci -m local created new head $ hg tracked -q --addinclude d0 --addinclude d9 Widening preserves bookmarks $ cd .. $ hg clone -q --narrow ssh://user@dummy/upstream narrow-bookmarks --include d4 $ cd narrow-bookmarks $ echo local > d4/f $ hg ci -m local $ hg bookmarks bookmark $ hg bookmarks * bookmark 11:* (glob) $ hg -q tracked --addinclude d2 $ hg bookmarks * bookmark 11:* (glob) $ hg log -r bookmark -T '{desc}\n' local Widening that fails can be recovered from $ cd .. $ hg clone -q --narrow ssh://user@dummy/upstream interrupted --include d0 $ cd interrupted $ echo local > d0/f $ hg ci -m local $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 11: local 10: add d10/f 9: add d9/f 8: add d8/f 7: add d7/f 6: add d6/f 5: add d5/f 4: add d4/f 3: add d3/f 2: add d2/f 1: add d1/f 0: add d0/f $ hg bookmarks bookmark $ hg --config hooks.pretxnchangegroup.bad=false tracked --addinclude d1 comparing with ssh://user@dummy/upstream searching for changes adding changesets adding manifests adding file changes added 0 changesets with 1 changes to 1 files $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 11: local 10: add d10/f 9: add d9/f 8: add d8/f 7: add d7/f 6: add d6/f 5: add d5/f 4: add d4/f 3: add d3/f 2: add d2/f 1: add d1/f 0: add d0/f $ hg bookmarks * bookmark 11:* (glob) $ hg unbundle .hg/strip-backup/*-widen.hg abort: .hg/strip-backup/*-widen.hg: $ENOTDIR$ (windows !) abort: $ENOENT$: '.hg/strip-backup/*-widen.hg' (no-windows !) [255] $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n" 11: local 10: add d10/f 9: add d9/f 8: add d8/f 7: add d7/f 6: add d6/f 5: add d5/f 4: add d4/f 3: add d3/f 2: add d2/f 1: add d1/f 0: add d0/f $ hg bookmarks * bookmark 11:* (glob)