Mercurial > hg
comparison tests/test-remotefilelog-gcrepack.t @ 40495:3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
This is remotefilelog as of my recent patches for compatibility with
current tip of hg, minus support for old versions of Mercurial and
some FB-specific features like their treemanifest extension and
fetching linkrev data from a patched phabricator. The file extutil.py
moved from hgext3rd to remotefilelog.
This is not yet ready to be landed, consider it a preview for
now. Planned changes include:
* replace lz4 with zstd
* rename some capabilities, requirements and wireproto commands to mark
them as experimental
* consolidate bits of shallowutil with related functions (eg readfile)
I'm certainly open to other (small) changes, but my rough mission is
to land this largely as-is so we can use it as a model of the
functionality we need going forward for lazy-fetching of file contents
from a server.
# no-check-commit because of a few foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D4782
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 27 Sep 2018 13:03:19 -0400 |
parents | |
children | b6b2a3d22344 |
comparison
equal
deleted
inserted
replaced
40494:9aeb9e2d28a7 | 40495:3a333a582d7b |
---|---|
1 $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH | |
2 $ export PYTHONPATH | |
3 | |
4 $ . "$TESTDIR/remotefilelog-library.sh" | |
5 | |
6 $ hginit master | |
7 $ cd master | |
8 $ cat >> .hg/hgrc <<EOF | |
9 > [remotefilelog] | |
10 > server=True | |
11 > EOF | |
12 $ echo x > x | |
13 $ hg commit -qAm x | |
14 $ echo y > y | |
15 $ rm x | |
16 $ hg commit -qAm DxAy | |
17 $ echo yy > y | |
18 $ hg commit -qAm y | |
19 $ cd .. | |
20 | |
21 $ hgcloneshallow ssh://user@dummy/master shallow -q | |
22 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) | |
23 | |
24 # Set the prefetchdays config to zero so that all commits are prefetched | |
25 # no matter what their creation date is. | |
26 $ cd shallow | |
27 $ cat >> .hg/hgrc <<EOF | |
28 > [remotefilelog] | |
29 > prefetchdays=0 | |
30 > EOF | |
31 $ cd .. | |
32 | |
33 # Prefetch all data and repack | |
34 | |
35 $ cd shallow | |
36 $ cat >> .hg/hgrc <<EOF | |
37 > [remotefilelog] | |
38 > bgprefetchrevs=all() | |
39 > EOF | |
40 | |
41 $ hg prefetch | |
42 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) | |
43 $ hg repack | |
44 $ sleep 0.5 | |
45 $ hg debugwaitonrepack >/dev/null 2>%1 | |
46 | |
47 $ find $CACHEDIR | sort | grep ".datapack\|.histpack" | |
48 $TESTTMP/hgcache/master/packs/9a2ea858fe2967db9b6ea4c0ca238881cae9d6eb.histpack | |
49 $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack | |
50 | |
51 # Ensure that all file versions were prefetched | |
52 | |
53 $ hg debugdatapack $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack | |
54 $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4: | |
55 x: | |
56 Node Delta Base Delta Length Blob Size | |
57 1406e7411862 000000000000 2 2 | |
58 | |
59 Total: 2 2 (0.0% bigger) | |
60 y: | |
61 Node Delta Base Delta Length Blob Size | |
62 50dbc4572b8e 000000000000 3 3 | |
63 076f5e2225b3 50dbc4572b8e 14 2 | |
64 | |
65 Total: 17 5 (240.0% bigger) | |
66 | |
67 # Test garbage collection during repack | |
68 | |
69 $ cat >> .hg/hgrc <<EOF | |
70 > [remotefilelog] | |
71 > bgprefetchrevs=tip | |
72 > gcrepack=True | |
73 > nodettl=86400 | |
74 > EOF | |
75 | |
76 $ hg repack | |
77 $ sleep 0.5 | |
78 $ hg debugwaitonrepack >/dev/null 2>%1 | |
79 | |
80 $ find $CACHEDIR | sort | grep ".datapack\|.histpack" | |
81 $TESTTMP/hgcache/master/packs/05baa499c6b07f2bf0ea3d2c8151da1cb86f5e33.datapack | |
82 $TESTTMP/hgcache/master/packs/9a2ea858fe2967db9b6ea4c0ca238881cae9d6eb.histpack | |
83 | |
84 # Ensure that file 'x' was garbage collected. It should be GCed because it is not in the keepset | |
85 # and is old (commit date is 0.0 in tests). Ensure that file 'y' is present as it is in the keepset. | |
86 | |
87 $ hg debugdatapack $TESTTMP/hgcache/master/packs/05baa499c6b07f2bf0ea3d2c8151da1cb86f5e33.datapack | |
88 $TESTTMP/hgcache/master/packs/05baa499c6b07f2bf0ea3d2c8151da1cb86f5e33: | |
89 y: | |
90 Node Delta Base Delta Length Blob Size | |
91 50dbc4572b8e 000000000000 3 3 | |
92 | |
93 Total: 3 3 (0.0% bigger) | |
94 | |
95 # Prefetch all data again and repack for later garbage collection | |
96 | |
97 $ cat >> .hg/hgrc <<EOF | |
98 > [remotefilelog] | |
99 > bgprefetchrevs=all() | |
100 > EOF | |
101 | |
102 $ hg prefetch | |
103 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob) | |
104 $ hg repack | |
105 $ sleep 0.5 | |
106 $ hg debugwaitonrepack >/dev/null 2>%1 | |
107 | |
108 $ find $CACHEDIR | sort | grep ".datapack\|.histpack" | |
109 $TESTTMP/hgcache/master/packs/9a2ea858fe2967db9b6ea4c0ca238881cae9d6eb.histpack | |
110 $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack | |
111 | |
112 # Ensure that all file versions were prefetched | |
113 | |
114 $ hg debugdatapack $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack | |
115 $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4: | |
116 x: | |
117 Node Delta Base Delta Length Blob Size | |
118 1406e7411862 000000000000 2 2 | |
119 | |
120 Total: 2 2 (0.0% bigger) | |
121 y: | |
122 Node Delta Base Delta Length Blob Size | |
123 50dbc4572b8e 000000000000 3 3 | |
124 076f5e2225b3 50dbc4572b8e 14 2 | |
125 | |
126 Total: 17 5 (240.0% bigger) | |
127 | |
128 # Test garbage collection during repack. Ensure that new files are not removed even though they are not in the keepset | |
129 # For the purposes of the test the TTL of a file is set to current time + 100 seconds. i.e. all commits in tests have | |
130 # a date of 1970 and therefore to prevent garbage collection we have to set nodettl to be farther from 1970 than we are now. | |
131 | |
132 $ cat >> .hg/hgrc <<EOF | |
133 > [remotefilelog] | |
134 > bgprefetchrevs= | |
135 > nodettl=$(($(date +%s) + 100)) | |
136 > EOF | |
137 | |
138 $ hg repack | |
139 $ sleep 0.5 | |
140 $ hg debugwaitonrepack >/dev/null 2>%1 | |
141 | |
142 $ find $CACHEDIR | sort | grep ".datapack\|.histpack" | |
143 $TESTTMP/hgcache/master/packs/9a2ea858fe2967db9b6ea4c0ca238881cae9d6eb.histpack | |
144 $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack | |
145 | |
146 # Ensure that all file versions were prefetched | |
147 | |
148 $ hg debugdatapack $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4.datapack | |
149 $TESTTMP/hgcache/master/packs/f7a942a6e4673d2c7b697fdd926ca2d153831ca4: | |
150 x: | |
151 Node Delta Base Delta Length Blob Size | |
152 1406e7411862 000000000000 2 2 | |
153 | |
154 Total: 2 2 (0.0% bigger) | |
155 y: | |
156 Node Delta Base Delta Length Blob Size | |
157 50dbc4572b8e 000000000000 3 3 | |
158 076f5e2225b3 50dbc4572b8e 14 2 | |
159 | |
160 Total: 17 5 (240.0% bigger) |