tests/test-cache-abuse.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Tue, 16 Apr 2019 17:26:38 +0200
changeset 42159 4f9a89837f07
parent 35709 1a09dad8b85a
child 42893 34a46d48d24e
permissions -rw-r--r--
setdiscovery: stop limiting the number of local head we initially send In our testing this limitation provides now real gain and instead triggers pathological discovery timing for some repository with many heads. See inline documentation for details. Some timing below: Mozilla try repository, (~1M revs, ~35K heads), discovery between 2 clones with 100 head missing on each side before: ! wall 1.492111 comb 1.490000 user 1.450000 sys 0.040000 (best of 20) ! wall 1.813992 comb 1.820000 user 1.700000 sys 0.120000 (max of 20) ! wall 1.574326 comb 1.573500 user 1.522000 sys 0.051500 (avg of 20) ! wall 1.572583 comb 1.570000 user 1.520000 sys 0.050000 (median of 20) after: ! wall 1.147834 comb 1.150000 user 1.090000 sys 0.060000 (best of 20) ! wall 1.449144 comb 1.450000 user 1.330000 sys 0.120000 (max of 20) ! wall 1.204618 comb 1.202500 user 1.146500 sys 0.056000 (avg of 20) ! wall 1.194407 comb 1.190000 user 1.140000 sys 0.050000 (median of 20) pypy (~100 heads, 317 heads) discovery between clones with only 42 common heads before: ! wall 0.031653 comb 0.030000 user 0.030000 sys 0.000000 (best of 25) ! wall 0.055719 comb 0.050000 user 0.040000 sys 0.010000 (max of 25) ! wall 0.038939 comb 0.039600 user 0.038400 sys 0.001200 (avg of 25) ! wall 0.038660 comb 0.050000 user 0.040000 sys 0.010000 (median of 25) after: ! wall 0.018754 comb 0.020000 user 0.020000 sys 0.000000 (best of 49) ! wall 0.034505 comb 0.040000 user 0.030000 sys 0.010000 (max of 49) ! wall 0.019631 comb 0.019796 user 0.018367 sys 0.001429 (avg of 49) ! wall 0.019132 comb 0.020000 user 0.020000 sys 0.000000 (median of 49) Private repository (~1M revs, ~3K heads), discovery from a strip subset, about 100 changesets to be pulled. before: ! wall 1.837729 comb 1.840000 user 1.790000 sys 0.050000 (best of 20) ! wall 2.203468 comb 2.200000 user 2.100000 sys 0.100000 (max of 20) ! wall 2.049355 comb 2.048500 user 2.002500 sys 0.046000 (avg of 20) ! wall 2.035315 comb 2.040000 user 2.000000 sys 0.040000 (median of 20) after: ! wall 0.136598 comb 0.130000 user 0.110000 sys 0.020000 (best of 20) ! wall 0.330519 comb 0.330000 user 0.260000 sys 0.070000 (max of 20) ! wall 0.157254 comb 0.155500 user 0.123000 sys 0.032500 (avg of 20) ! wall 0.149870 comb 0.140000 user 0.110000 sys 0.030000 (median of 20) Same private repo, discovery between two clone with 500 different heads on each side: before: ! wall 2.372919 comb 2.370000 user 2.320000 sys 0.050000 (best of 20) ! wall 2.622422 comb 2.610000 user 2.510000 sys 0.100000 (max of 20) ! wall 2.450135 comb 2.450000 user 2.402000 sys 0.048000 (avg of 20) ! wall 2.443896 comb 2.450000 user 2.410000 sys 0.040000 (median of 20) after: ! wall 0.625497 comb 0.620000 user 0.570000 sys 0.050000 (best of 20) ! wall 0.834723 comb 0.820000 user 0.730000 sys 0.090000 (max of 20) ! wall 0.675725 comb 0.675500 user 0.628000 sys 0.047500 (avg of 20) ! wall 0.671614 comb 0.680000 user 0.640000 sys 0.040000 (median of 20)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
33542
b11e8c67fb0f debugobsolete: also report the number of obsoleted changesets
Boris Feld <boris.feld@octobus.net>
parents: 32478
diff changeset
    27
  obsoleted 1 changesets
29041
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    28
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    29
  $ hg phase -pr t1
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    30
  $ hg phase -fsr t2
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    31
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    32
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
    33
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    34
- command output shouldn't change
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    35
- cache should be present after first use
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    36
- 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
    37
- cache should survive deletion, overwrite, and append
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    38
- unreadable / unwriteable caches should be ignored
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    39
- cache should be rebuilt after corruption
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    40
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    41
  $ damage() {
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    42
  >  CMD=$1
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    43
  >  CACHE=.hg/cache/$2
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    44
  >  CLEAN=$3
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    45
  >  hg $CMD > before
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    46
  >  test -f $CACHE || echo "not present"
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    47
  >  echo bad > $CACHE
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    48
  >  test -z "$CLEAN" || $CLEAN
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    49
  >  hg $CMD > after
33612
798f7beadbc9 tests: use pdiff instead of diff for portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33542
diff changeset
    50
  >  "$RUNTESTDIR/pdiff" before after || echo "*** overwrite corruption"
29041
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    51
  >  echo corruption >> $CACHE
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    52
  >  test -z "$CLEAN" || $CLEAN
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    53
  >  hg $CMD > after
33612
798f7beadbc9 tests: use pdiff instead of diff for portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33542
diff changeset
    54
  >  "$RUNTESTDIR/pdiff" before after || echo "*** append corruption"
29041
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    55
  >  rm $CACHE
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    56
  >  mkdir $CACHE
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    57
  >  test -z "$CLEAN" || $CLEAN
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    58
  >  hg $CMD > after
33612
798f7beadbc9 tests: use pdiff instead of diff for portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33542
diff changeset
    59
  >  "$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
    60
  >  test -d $CACHE || echo "*** directory clobbered"
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    61
  >  rmdir $CACHE
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    62
  >  test -z "$CLEAN" || $CLEAN
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    63
  >  hg $CMD > after
33612
798f7beadbc9 tests: use pdiff instead of diff for portability
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33542
diff changeset
    64
  >  "$RUNTESTDIR/pdiff" before after || echo "*** missing corruption"
29041
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    65
  >  test -f $CACHE || echo "not rebuilt"
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    66
  > }
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
Beat up tags caches:
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    69
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    70
  $ damage "tags --hidden" tags2
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    71
  $ damage tags tags2-visible
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    72
  $ damage "tag -f t3" hgtagsfnodes1
35709
1a09dad8b85a evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents: 34866
diff changeset
    73
  1 new orphan changesets
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
29041
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    78
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    79
Beat up branch caches:
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    80
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    81
  $ 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
    82
  $ 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
    83
  $ damage branches branch2-visible
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    84
  $ damage "log -r branch(.)" rbc-names-v1
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    85
  $ damage "log -r branch(default)" rbc-names-v1
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    86
  $ damage "log -r branch(b2)" rbc-revs-v1
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    87
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    88
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
    89
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    90
  $ damage "log -qr branch(b2)" rbc-names-v1
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    91
  --- before	* (glob)
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    92
  +++ 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
    93
  @@ -1,8 +?,0 @@ (glob)
29041
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    94
  -2:5fb7d38b9dc4
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    95
  -3:60b597ffdafa
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    96
  -4:b1174d11b69e
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    97
  -5:6354685872c0
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    98
  -6:5ebc725f1bef
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    99
  -7:7b76eec2f273
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   100
  -8:ef3428d9d644
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   101
  -9:ba7a936bc03c
b962ae0a0a05 tests: test a variety of cache invariants
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
   102
  *** append corruption