##// END OF EJS Templates
debug-revlog: details about non-ancestors delta-bases...
debug-revlog: details about non-ancestors delta-bases Deltas against a base that is not an ancestor of the revision that owns this delta are notable. For example, they introduce complexity during the bundling process as the base might not exist on the unbundling side. We detect them in `hg debugrevlog` and print information about them.

File last commit:

r50556:511106bc default
r50556:511106bc default
Show More
test-sparse-revlog.t
323 lines | 13.9 KiB | text/troff | Tads3Lexer
/ tests / test-sparse-revlog.t
Boris Feld
sparse-revlog: add a test checking revlog deltas for a churning file...
r39527 ====================================
Test delta choice with sparse revlog
====================================
Sparse-revlog usually shows the most gain on Manifest. However, it is simpler
to general an appropriate file, so we test with a single file instead. The
goal is to observe intermediate snapshot being created.
We need a large enough file. Part of the content needs to be replaced
repeatedly while some of it changes rarely.
$ bundlepath="$TESTDIR/artifacts/cache/big-file-churn.hg"
$ expectedhash=`cat "$bundlepath".md5`
test: generate the `test-sparse-revlog` artifact when slow-test is allowed...
r41970
#if slow
$ if [ ! -f "$bundlepath" ]; then
> "$TESTDIR"/artifacts/scripts/generate-churning-bundle.py > /dev/null
> fi
#else
Boris Feld
sparse-revlog: add a test checking revlog deltas for a churning file...
r39527 $ if [ ! -f "$bundlepath" ]; then
> echo 'skipped: missing artifact, run "'"$TESTDIR"'/artifacts/scripts/generate-churning-bundle.py"'
> exit 80
> fi
test: generate the `test-sparse-revlog` artifact when slow-test is allowed...
r41970
#endif
Boris Feld
sparse-revlog: add a test checking revlog deltas for a churning file...
r39527 $ currenthash=`f -M "$bundlepath" | cut -d = -f 2`
$ if [ "$currenthash" != "$expectedhash" ]; then
> echo 'skipped: outdated artifact, md5 "'"$currenthash"'" expected "'"$expectedhash"'" run "'"$TESTDIR"'/artifacts/scripts/generate-churning-bundle.py"'
> exit 80
> fi
$ cat >> $HGRCPATH << EOF
> [format]
> sparse-revlog = yes
Boris Feld
sparse-revlog: set max delta chain length to on thousand...
r39542 > maxchainlen = 15
Boris Feld
sparse-revlog: add a test checking revlog deltas for a churning file...
r39527 > [storage]
> revlog.optimize-delta-parent-choice = yes
storage: introduce a `revlog.reuse-external-delta` config...
r41985 > revlog.reuse-external-delta = no
Boris Feld
sparse-revlog: add a test checking revlog deltas for a churning file...
r39527 > EOF
$ hg init sparse-repo
$ cd sparse-repo
$ hg unbundle $bundlepath
adding changesets
adding manifests
adding file changes
added 5001 changesets with 5001 changes to 1 files (+89 heads)
new changesets 9706f5af64f4:d9032adc8114 (5001 drafts)
(run 'hg heads' to see heads, 'hg merge' to merge)
$ hg up
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
updated to "d9032adc8114: commit #5000"
89 other heads for branch "default"
$ hg log --stat -r 0:3
changeset: 0:9706f5af64f4
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: initial commit
SPARSE-REVLOG-TEST-FILE | 10500 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 10500 insertions(+), 0 deletions(-)
changeset: 1:724907deaa5e
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit #1
SPARSE-REVLOG-TEST-FILE | 1068 +++++++++++++++++++++++-----------------------
1 files changed, 534 insertions(+), 534 deletions(-)
changeset: 2:62c41bce3e5d
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit #2
SPARSE-REVLOG-TEST-FILE | 1068 +++++++++++++++++++++++-----------------------
1 files changed, 534 insertions(+), 534 deletions(-)
changeset: 3:348a9cbd6959
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: commit #3
SPARSE-REVLOG-TEST-FILE | 1068 +++++++++++++++++++++++-----------------------
1 files changed, 534 insertions(+), 534 deletions(-)
$ f -s .hg/store/data/*.d
test: update `test-sparse-revlog` output...
r50120 .hg/store/data/_s_p_a_r_s_e-_r_e_v_l_o_g-_t_e_s_t-_f_i_l_e.d: size=58616973
Boris Feld
sparse-revlog: add a test checking revlog deltas for a churning file...
r39527 $ hg debugrevlog *
format : 1
flags : generaldelta
revisions : 5001
merges : 625 (12.50%)
normal : 4376 (87.50%)
revisions : 5001
empty : 0 ( 0.00%)
text : 0 (100.00%)
delta : 0 (100.00%)
test: don't trust delta bases from the bundle in test-sparse-revlog.t...
r41963 snapshot : 383 ( 7.66%)
lvl-0 : 3 ( 0.06%)
debug-revlog: details about non-ancestors delta-bases...
r50556 lvl-1 : 18 ( 0.36%) non-ancestor-bases: 9 (50.00%)
lvl-2 : 62 ( 1.24%) non-ancestor-bases: 58 (93.55%)
lvl-3 : 108 ( 2.16%) non-ancestor-bases: 108 (100.00%)
lvl-4 : 191 ( 3.82%) non-ancestor-bases: 180 (94.24%)
lvl-5 : 1 ( 0.02%) non-ancestor-bases: 1 (100.00%)
test: don't trust delta bases from the bundle in test-sparse-revlog.t...
r41963 deltas : 4618 (92.34%)
test: update `test-sparse-revlog` output...
r50120 revision size : 58616973
snapshot : 9247844 (15.78%)
lvl-0 : 539532 ( 0.92%)
lvl-1 : 1467743 ( 2.50%)
lvl-2 : 1873820 ( 3.20%)
lvl-3 : 2326874 ( 3.97%)
lvl-4 : 3029118 ( 5.17%)
lvl-5 : 10757 ( 0.02%)
deltas : 49369129 (84.22%)
Boris Feld
sparse-revlog: add a test checking revlog deltas for a churning file...
r39527
chunks : 5001
test: update `test-sparse-revlog` output...
r50120 0x28 : 5001 (100.00%)
chunks size : 58616973
0x28 : 58616973 (100.00%)
Boris Feld
sparse-revlog: add a test checking revlog deltas for a churning file...
r39527
Boris Feld
sparse-revlog: set max delta chain length to on thousand...
r39542 avg chain length : 9
max chain length : 15
test: update `test-sparse-revlog` output...
r50120 max chain reach : 27366701
compression ratio : 29
Boris Feld
sparse-revlog: add a test checking revlog deltas for a churning file...
r39527
uncompressed data size (min/max/avg) : 346468 / 346472 / 346471
test: update `test-sparse-revlog` output...
r50120 full revision size (min/max/avg) : 179288 / 180786 / 179844
inter-snapshot size (min/max/avg) : 10757 / 169507 / 22916
level-1 (min/max/avg) : 13905 / 169507 / 81541
level-2 (min/max/avg) : 10887 / 83873 / 30222
level-3 (min/max/avg) : 10911 / 43047 / 21545
level-4 (min/max/avg) : 10838 / 21390 / 15859
level-5 (min/max/avg) : 10757 / 10757 / 10757
delta size (min/max/avg) : 9672 / 108072 / 10690
Boris Feld
sparse-revlog: add a test checking revlog deltas for a churning file...
r39527
test: update `test-sparse-revlog` output...
r50120 deltas against prev : 3906 (84.58%)
where prev = p1 : 3906 (100.00%)
Boris Feld
sparse-revlog: add a test checking revlog deltas for a churning file...
r39527 where prev = p2 : 0 ( 0.00%)
debug-revlog: details about non-ancestors delta-bases...
r50556 other-ancestor : 0 ( 0.00%)
unrelated : 0 ( 0.00%)
test: update `test-sparse-revlog` output...
r50120 deltas against p1 : 649 (14.05%)
deltas against p2 : 63 ( 1.36%)
debug-revlog: details about non-ancestors delta-bases...
r50556 deltas against ancs : 0 ( 0.00%)
test: don't trust delta bases from the bundle in test-sparse-revlog.t...
r41963 deltas against other : 0 ( 0.00%)
test: update `test-sparse-revlog` output...
r50120
deltas: add a debug-delta-find command to analyse delta search...
r50123
Test `debug-delta-find`
-----------------------
$ ls -1
SPARSE-REVLOG-TEST-FILE
test: fix test-sparse-revlog output after debugdeltachain change...
r50248 $ hg debugdeltachain SPARSE-REVLOG-TEST-FILE | grep snap | tail -1
4971 4970 -1 3 5 4930 snap 19179 346472 427596 1.23414 15994877 15567281 36.40652 427596 179288 1.00000 5
deltas: add a debug-delta-find command to analyse delta search...
r50123 $ hg debug-delta-find SPARSE-REVLOG-TEST-FILE 4971
DBG-DELTAS-SEARCH: SEARCH rev=4971
delta-find: move pre-filtering with other pre-filtering logic...
r50508 DBG-DELTAS-SEARCH: ROUND #1 - 1 candidates - search-down
deltas: add a debug-delta-find command to analyse delta search...
r50123 DBG-DELTAS-SEARCH: CANDIDATE: rev=4962
DBG-DELTAS-SEARCH: type=snapshot-4
DBG-DELTAS-SEARCH: size=18296
DBG-DELTAS-SEARCH: base=4930
DBG-DELTAS-SEARCH: uncompressed-delta-size=30377
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=16872 (BAD)
DBG-DELTAS-SEARCH: ROUND #2 - 1 candidates - search-down
DBG-DELTAS-SEARCH: CANDIDATE: rev=4930
DBG-DELTAS-SEARCH: type=snapshot-3
DBG-DELTAS-SEARCH: size=39228
DBG-DELTAS-SEARCH: base=4799
DBG-DELTAS-SEARCH: uncompressed-delta-size=33050
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=19179 (GOOD)
DBG-DELTAS-SEARCH: ROUND #3 - 1 candidates - refine-down
DBG-DELTAS-SEARCH: CONTENDER: rev=4930 - length=19179
DBG-DELTAS-SEARCH: CANDIDATE: rev=4799
DBG-DELTAS-SEARCH: type=snapshot-2
DBG-DELTAS-SEARCH: size=50213
DBG-DELTAS-SEARCH: base=4623
DBG-DELTAS-SEARCH: uncompressed-delta-size=82661
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=49132 (BAD)
delta-find: add debug information about reuse of cached data...
r50504 DBG-DELTAS: FILELOG:SPARSE-REVLOG-TEST-FILE: rev=4971: delta-base=4930 is-cached=0 - search-rounds=3 try-count=3 - delta-type=snapshot snap-depth=4 - p1-chain-length=15 p2-chain-length=-1 - duration=* (glob)
deltas: add a debug-delta-find command to analyse delta search...
r50123
debug-delta-find: add a --source option...
r50484 $ cat << EOF >>.hg/hgrc
> [storage]
> revlog.optimize-delta-parent-choice = no
> revlog.reuse-external-delta = yes
> EOF
$ hg debug-delta-find SPARSE-REVLOG-TEST-FILE 4971 --quiet
delta-find: add debug information about reuse of cached data...
r50504 DBG-DELTAS: FILELOG:SPARSE-REVLOG-TEST-FILE: rev=4971: delta-base=4930 is-cached=0 - search-rounds=3 try-count=3 - delta-type=snapshot snap-depth=4 - p1-chain-length=15 p2-chain-length=-1 - duration=* (glob)
debug-delta-find: add a --source option...
r50484 $ hg debug-delta-find SPARSE-REVLOG-TEST-FILE 4971 --source full
DBG-DELTAS-SEARCH: SEARCH rev=4971
tests: fix test-sparse-revlog...
r50521 DBG-DELTAS-SEARCH: ROUND #1 - 1 candidates - search-down
debug-delta-find: add a --source option...
r50484 DBG-DELTAS-SEARCH: CANDIDATE: rev=4962
DBG-DELTAS-SEARCH: type=snapshot-4
DBG-DELTAS-SEARCH: size=18296
DBG-DELTAS-SEARCH: base=4930
DBG-DELTAS-SEARCH: uncompressed-delta-size=30377
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=16872 (BAD)
DBG-DELTAS-SEARCH: ROUND #2 - 1 candidates - search-down
DBG-DELTAS-SEARCH: CANDIDATE: rev=4930
DBG-DELTAS-SEARCH: type=snapshot-3
DBG-DELTAS-SEARCH: size=39228
DBG-DELTAS-SEARCH: base=4799
DBG-DELTAS-SEARCH: uncompressed-delta-size=33050
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=19179 (GOOD)
DBG-DELTAS-SEARCH: ROUND #3 - 1 candidates - refine-down
DBG-DELTAS-SEARCH: CONTENDER: rev=4930 - length=19179
DBG-DELTAS-SEARCH: CANDIDATE: rev=4799
DBG-DELTAS-SEARCH: type=snapshot-2
DBG-DELTAS-SEARCH: size=50213
DBG-DELTAS-SEARCH: base=4623
DBG-DELTAS-SEARCH: uncompressed-delta-size=82661
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=49132 (BAD)
delta-find: add debug information about reuse of cached data...
r50504 DBG-DELTAS: FILELOG:SPARSE-REVLOG-TEST-FILE: rev=4971: delta-base=4930 is-cached=0 - search-rounds=3 try-count=3 - delta-type=snapshot snap-depth=4 - p1-chain-length=15 p2-chain-length=-1 - duration=* (glob)
debug-delta-find: add a --source option...
r50484 $ hg debug-delta-find SPARSE-REVLOG-TEST-FILE 4971 --source storage
DBG-DELTAS-SEARCH: SEARCH rev=4971
delta-find: add debug information about reuse of cached data...
r50504 DBG-DELTAS-SEARCH: ROUND #1 - 1 candidates - cached-delta
debug-delta-find: add a --source option...
r50484 DBG-DELTAS-SEARCH: CANDIDATE: rev=4930
DBG-DELTAS-SEARCH: type=snapshot-3
DBG-DELTAS-SEARCH: size=39228
DBG-DELTAS-SEARCH: base=4799
DBG-DELTAS-SEARCH: uncompressed-delta-size=33050
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=19179 (GOOD)
delta-find: add debug information about reuse of cached data...
r50504 DBG-DELTAS: FILELOG:SPARSE-REVLOG-TEST-FILE: rev=4971: delta-base=4930 is-cached=1 - search-rounds=1 try-count=1 - delta-type=snapshot snap-depth=4 - p1-chain-length=15 p2-chain-length=-1 - duration=* (glob)
debug-delta-find: add a --source option...
r50484 $ hg debug-delta-find SPARSE-REVLOG-TEST-FILE 4971 --source p1
DBG-DELTAS-SEARCH: SEARCH rev=4971
tests: fix test-sparse-revlog...
r50521 DBG-DELTAS-SEARCH: ROUND #1 - 1 candidates - search-down
debug-delta-find: add a --source option...
r50484 DBG-DELTAS-SEARCH: CANDIDATE: rev=4962
DBG-DELTAS-SEARCH: type=snapshot-4
DBG-DELTAS-SEARCH: size=18296
DBG-DELTAS-SEARCH: base=4930
DBG-DELTAS-SEARCH: uncompressed-delta-size=30377
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=16872 (BAD)
DBG-DELTAS-SEARCH: ROUND #2 - 1 candidates - search-down
DBG-DELTAS-SEARCH: CANDIDATE: rev=4930
DBG-DELTAS-SEARCH: type=snapshot-3
DBG-DELTAS-SEARCH: size=39228
DBG-DELTAS-SEARCH: base=4799
DBG-DELTAS-SEARCH: uncompressed-delta-size=33050
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=19179 (GOOD)
DBG-DELTAS-SEARCH: ROUND #3 - 1 candidates - refine-down
DBG-DELTAS-SEARCH: CONTENDER: rev=4930 - length=19179
DBG-DELTAS-SEARCH: CANDIDATE: rev=4799
DBG-DELTAS-SEARCH: type=snapshot-2
DBG-DELTAS-SEARCH: size=50213
DBG-DELTAS-SEARCH: base=4623
DBG-DELTAS-SEARCH: uncompressed-delta-size=82661
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=49132 (BAD)
delta-find: add debug information about reuse of cached data...
r50504 DBG-DELTAS: FILELOG:SPARSE-REVLOG-TEST-FILE: rev=4971: delta-base=4930 is-cached=0 - search-rounds=3 try-count=3 - delta-type=snapshot snap-depth=4 - p1-chain-length=15 p2-chain-length=-1 - duration=* (glob)
debug-delta-find: add a --source option...
r50484 $ hg debug-delta-find SPARSE-REVLOG-TEST-FILE 4971 --source p2
DBG-DELTAS-SEARCH: SEARCH rev=4971
tests: fix test-sparse-revlog...
r50521 DBG-DELTAS-SEARCH: ROUND #1 - 1 candidates - search-down
debug-delta-find: add a --source option...
r50484 DBG-DELTAS-SEARCH: CANDIDATE: rev=4962
DBG-DELTAS-SEARCH: type=snapshot-4
DBG-DELTAS-SEARCH: size=18296
DBG-DELTAS-SEARCH: base=4930
DBG-DELTAS-SEARCH: uncompressed-delta-size=30377
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=16872 (BAD)
DBG-DELTAS-SEARCH: ROUND #2 - 1 candidates - search-down
DBG-DELTAS-SEARCH: CANDIDATE: rev=4930
DBG-DELTAS-SEARCH: type=snapshot-3
DBG-DELTAS-SEARCH: size=39228
DBG-DELTAS-SEARCH: base=4799
DBG-DELTAS-SEARCH: uncompressed-delta-size=33050
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=19179 (GOOD)
DBG-DELTAS-SEARCH: ROUND #3 - 1 candidates - refine-down
DBG-DELTAS-SEARCH: CONTENDER: rev=4930 - length=19179
DBG-DELTAS-SEARCH: CANDIDATE: rev=4799
DBG-DELTAS-SEARCH: type=snapshot-2
DBG-DELTAS-SEARCH: size=50213
DBG-DELTAS-SEARCH: base=4623
DBG-DELTAS-SEARCH: uncompressed-delta-size=82661
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=49132 (BAD)
delta-find: add debug information about reuse of cached data...
r50504 DBG-DELTAS: FILELOG:SPARSE-REVLOG-TEST-FILE: rev=4971: delta-base=4930 is-cached=0 - search-rounds=3 try-count=3 - delta-type=snapshot snap-depth=4 - p1-chain-length=15 p2-chain-length=-1 - duration=* (glob)
debug-delta-find: add a --source option...
r50484 $ hg debug-delta-find SPARSE-REVLOG-TEST-FILE 4971 --source prev
DBG-DELTAS-SEARCH: SEARCH rev=4971
tests: fix test-sparse-revlog...
r50521 DBG-DELTAS-SEARCH: ROUND #1 - 1 candidates - search-down
debug-delta-find: add a --source option...
r50484 DBG-DELTAS-SEARCH: CANDIDATE: rev=4962
DBG-DELTAS-SEARCH: type=snapshot-4
DBG-DELTAS-SEARCH: size=18296
DBG-DELTAS-SEARCH: base=4930
DBG-DELTAS-SEARCH: uncompressed-delta-size=30377
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=16872 (BAD)
DBG-DELTAS-SEARCH: ROUND #2 - 1 candidates - search-down
DBG-DELTAS-SEARCH: CANDIDATE: rev=4930
DBG-DELTAS-SEARCH: type=snapshot-3
DBG-DELTAS-SEARCH: size=39228
DBG-DELTAS-SEARCH: base=4799
DBG-DELTAS-SEARCH: uncompressed-delta-size=33050
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=19179 (GOOD)
DBG-DELTAS-SEARCH: ROUND #3 - 1 candidates - refine-down
DBG-DELTAS-SEARCH: CONTENDER: rev=4930 - length=19179
DBG-DELTAS-SEARCH: CANDIDATE: rev=4799
DBG-DELTAS-SEARCH: type=snapshot-2
DBG-DELTAS-SEARCH: size=50213
DBG-DELTAS-SEARCH: base=4623
DBG-DELTAS-SEARCH: uncompressed-delta-size=82661
DBG-DELTAS-SEARCH: delta-search-time=* (glob)
DBG-DELTAS-SEARCH: DELTA: length=49132 (BAD)
delta-find: add debug information about reuse of cached data...
r50504 DBG-DELTAS: FILELOG:SPARSE-REVLOG-TEST-FILE: rev=4971: delta-base=4930 is-cached=0 - search-rounds=3 try-count=3 - delta-type=snapshot snap-depth=4 - p1-chain-length=15 p2-chain-length=-1 - duration=* (glob)
debug-delta-find: add a --source option...
r50484
test: update `test-sparse-revlog` output...
r50120 $ cd ..