Mercurial > hg
annotate tests/test-cache-abuse.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 | 34a46d48d24e |
children |
rev | line source |
---|---|
29041
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
1 Enable obsolete markers |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
3 $ cat >> $HGRCPATH << EOF |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
4 > [experimental] |
34866
1644623ab096
config: use 'experimental.evolution.create-markers'
Boris Feld <boris.feld@octobus.net>
parents:
33773
diff
changeset
|
5 > evolution.createmarkers=True |
29041
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
6 > [phases] |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
7 > publish=False |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
8 > EOF |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
9 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
10 Build a repo with some cacheable bits: |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
11 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
12 $ hg init a |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
13 $ cd a |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
14 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
15 $ echo a > a |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
16 $ hg ci -qAm0 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
17 $ hg tag t1 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
18 $ hg book -i bk1 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
19 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
20 $ hg branch -q b2 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
21 $ hg ci -Am1 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
22 $ hg tag t2 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
23 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
24 $ echo dumb > dumb |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
25 $ hg ci -qAmdumb |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
26 $ hg debugobsolete b1174d11b69e63cb0c5726621a43c859f0858d7f |
42893
34a46d48d24e
debugobsolete: also issue the "new obsmarkers" messsage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
35709
diff
changeset
|
27 1 new obsolescence markers |
33542
b11e8c67fb0f
debugobsolete: also report the number of obsoleted changesets
Boris Feld <boris.feld@octobus.net>
parents:
32478
diff
changeset
|
28 obsoleted 1 changesets |
29041
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
29 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
30 $ hg phase -pr t1 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
31 $ hg phase -fsr t2 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
32 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
33 Make a helper function to check cache damage invariants: |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
34 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
35 - command output shouldn't change |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
36 - cache should be present after first use |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
37 - corruption/repair should be silent (no exceptions or warnings) |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
38 - cache should survive deletion, overwrite, and append |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
39 - unreadable / unwriteable caches should be ignored |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
40 - cache should be rebuilt after corruption |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
41 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
42 $ damage() { |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
43 > CMD=$1 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
44 > CACHE=.hg/cache/$2 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
45 > CLEAN=$3 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
46 > hg $CMD > before |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
47 > test -f $CACHE || echo "not present" |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
48 > echo bad > $CACHE |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
49 > test -z "$CLEAN" || $CLEAN |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
50 > hg $CMD > after |
33612
798f7beadbc9
tests: use pdiff instead of diff for portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33542
diff
changeset
|
51 > "$RUNTESTDIR/pdiff" before after || echo "*** overwrite corruption" |
29041
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
52 > echo corruption >> $CACHE |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
53 > test -z "$CLEAN" || $CLEAN |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
54 > hg $CMD > after |
33612
798f7beadbc9
tests: use pdiff instead of diff for portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33542
diff
changeset
|
55 > "$RUNTESTDIR/pdiff" before after || echo "*** append corruption" |
29041
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
56 > rm $CACHE |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
57 > mkdir $CACHE |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
58 > test -z "$CLEAN" || $CLEAN |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
59 > hg $CMD > after |
33612
798f7beadbc9
tests: use pdiff instead of diff for portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33542
diff
changeset
|
60 > "$RUNTESTDIR/pdiff" before after || echo "*** read-only corruption" |
29041
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
61 > test -d $CACHE || echo "*** directory clobbered" |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
62 > rmdir $CACHE |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
63 > test -z "$CLEAN" || $CLEAN |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
64 > hg $CMD > after |
33612
798f7beadbc9
tests: use pdiff instead of diff for portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
33542
diff
changeset
|
65 > "$RUNTESTDIR/pdiff" before after || echo "*** missing corruption" |
29041
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
66 > test -f $CACHE || echo "not rebuilt" |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
67 > } |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
68 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
69 Beat up tags caches: |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
70 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
71 $ damage "tags --hidden" tags2 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
72 $ damage tags tags2-visible |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
73 $ damage "tag -f t3" hgtagsfnodes1 |
35709
1a09dad8b85a
evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents:
34866
diff
changeset
|
74 1 new orphan changesets |
1a09dad8b85a
evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents:
34866
diff
changeset
|
75 1 new orphan changesets |
1a09dad8b85a
evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents:
34866
diff
changeset
|
76 1 new orphan changesets |
1a09dad8b85a
evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents:
34866
diff
changeset
|
77 1 new orphan changesets |
1a09dad8b85a
evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents:
34866
diff
changeset
|
78 1 new orphan changesets |
29041
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
79 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
80 Beat up branch caches: |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
81 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
82 $ damage branches branch2-base "rm .hg/cache/branch2-[vs]*" |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
83 $ damage branches branch2-served "rm .hg/cache/branch2-[bv]*" |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
84 $ damage branches branch2-visible |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
85 $ damage "log -r branch(.)" rbc-names-v1 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
86 $ damage "log -r branch(default)" rbc-names-v1 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
87 $ damage "log -r branch(b2)" rbc-revs-v1 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
88 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
89 We currently can't detect an rbc cache with unknown names: |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
90 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
91 $ damage "log -qr branch(b2)" rbc-names-v1 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
92 --- before * (glob) |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
93 +++ after * (glob) |
29255
b0b85d8695cb
test-cache-abuse: correct for different hunk headers between Solaris and GNU
Danek Duvall <danek.duvall@oracle.com>
parents:
29041
diff
changeset
|
94 @@ -1,8 +?,0 @@ (glob) |
29041
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
95 -2:5fb7d38b9dc4 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
96 -3:60b597ffdafa |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
97 -4:b1174d11b69e |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
98 -5:6354685872c0 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
99 -6:5ebc725f1bef |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
100 -7:7b76eec2f273 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
101 -8:ef3428d9d644 |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
102 -9:ba7a936bc03c |
b962ae0a0a05
tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
103 *** append corruption |