##// END OF EJS Templates
test: follow-up on 1c4d6ab2ecb8, stabilize test-remotefilelog-bgprefetch.t...
Boris Feld -
r41976:00c909de default
parent child Browse files
Show More
@@ -1,372 +1,375
1 1 #require no-windows
2 2
3 3 $ . "$TESTDIR/remotefilelog-library.sh"
4 4
5 5 $ hg init master
6 6 $ cd master
7 7 $ cat >> .hg/hgrc <<EOF
8 8 > [remotefilelog]
9 9 > server=True
10 10 > EOF
11 11 $ echo x > x
12 12 $ echo z > z
13 13 $ hg commit -qAm x
14 14 $ echo x2 > x
15 15 $ echo y > y
16 16 $ hg commit -qAm y
17 17 $ echo w > w
18 18 $ rm z
19 19 $ hg commit -qAm w
20 20 $ hg bookmark foo
21 21
22 22 $ cd ..
23 23
24 24 # clone the repo
25 25
26 26 $ hgcloneshallow ssh://user@dummy/master shallow --noupdate
27 27 streaming all changes
28 28 2 files to transfer, 776 bytes of data
29 29 transferred 776 bytes in * seconds (*/sec) (glob)
30 30 searching for changes
31 31 no changes found
32 32
33 33 # Set the prefetchdays config to zero so that all commits are prefetched
34 34 # no matter what their creation date is. Also set prefetchdelay config
35 35 # to zero so that there is no delay between prefetches.
36 36 $ cd shallow
37 37 $ cat >> .hg/hgrc <<EOF
38 38 > [remotefilelog]
39 39 > prefetchdays=0
40 40 > prefetchdelay=0
41 41 > EOF
42 42 $ cd ..
43 43
44 44 # prefetch a revision
45 45 $ cd shallow
46 46
47 47 $ hg prefetch -r 0
48 48 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob)
49 49
50 50 $ hg cat -r 0 x
51 51 x
52 52
53 53 # background prefetch on pull when configured
54 54
55 55 $ cat >> .hg/hgrc <<EOF
56 56 > [remotefilelog]
57 57 > pullprefetch=bookmark()
58 58 > backgroundprefetch=True
59 59 > EOF
60 60 $ hg strip tip
61 61 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/6b4b6f66ef8c-b4b8bdaf-backup.hg (glob)
62 62
63 63 $ clearcache
64 64 $ hg pull
65 65 pulling from ssh://user@dummy/master
66 66 searching for changes
67 67 adding changesets
68 68 adding manifests
69 69 adding file changes
70 70 added 1 changesets with 0 changes to 0 files
71 71 updating bookmark foo
72 72 new changesets 6b4b6f66ef8c
73 73 (run 'hg update' to get a working copy)
74 74 prefetching file contents
75 75 $ sleep 0.5
76 76 $ hg debugwaitonprefetch >/dev/null 2>%1
77 77 $ find $CACHEDIR -type f | sort
78 78 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/ef95c5376f34698742fe34f315fd82136f8f68c0
79 79 $TESTTMP/hgcache/master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/076f5e2225b3ff0400b98c92aa6cdf403ee24cca
80 80 $TESTTMP/hgcache/master/af/f024fe4ab0fece4091de044c58c9ae4233383a/bb6ccd5dceaa5e9dc220e0dad65e051b94f69a2c
81 81 $TESTTMP/hgcache/repos
82 82
83 83 # background prefetch with repack on pull when configured
84 84
85 85 $ cat >> .hg/hgrc <<EOF
86 86 > [remotefilelog]
87 87 > backgroundrepack=True
88 88 > EOF
89 89 $ hg strip tip
90 90 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/6b4b6f66ef8c-b4b8bdaf-backup.hg (glob)
91 91
92 92 $ clearcache
93 93 $ hg pull
94 94 pulling from ssh://user@dummy/master
95 95 searching for changes
96 96 adding changesets
97 97 adding manifests
98 98 adding file changes
99 99 added 1 changesets with 0 changes to 0 files
100 100 updating bookmark foo
101 101 new changesets 6b4b6f66ef8c
102 102 (run 'hg update' to get a working copy)
103 103 prefetching file contents
104 104 $ sleep 0.5
105 105 $ hg debugwaitonprefetch >/dev/null 2>%1
106 106 $ sleep 0.5
107 107 $ hg debugwaitonrepack >/dev/null 2>%1
108 108 $ sleep 0.5
109 109 $ find $CACHEDIR -type f | sort
110 110 $TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histidx
111 111 $TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histpack
112 112 $TESTTMP/hgcache/master/packs/8ce5ab3745465ab83bba30a7b9c295e0c8404652.dataidx
113 113 $TESTTMP/hgcache/master/packs/8ce5ab3745465ab83bba30a7b9c295e0c8404652.datapack
114 114 $TESTTMP/hgcache/master/packs/repacklock
115 115 $TESTTMP/hgcache/repos
116 116
117 117 # background prefetch with repack on update when wcprevset configured
118 118
119 119 $ clearcache
120 120 $ hg up -r 0
121 121 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 122 2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob)
123 123 $ find $CACHEDIR -type f | sort
124 124 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0
125 125 $TESTTMP/hgcache/master/39/5df8f7c51f007019cb30201c49e884b46b92fa/69a1b67522704ec122181c0890bd16e9d3e7516a
126 126 $TESTTMP/hgcache/repos
127 127
128 128 $ hg up -r 1
129 129 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
130 130 2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over *s (glob)
131 131
132 132 $ cat >> .hg/hgrc <<EOF
133 133 > [remotefilelog]
134 134 > bgprefetchrevs=.::
135 135 > EOF
136 136
137 137 $ clearcache
138 138 $ hg up -r 0
139 139 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
140 140 * files fetched over * fetches - (* misses, 0.00% hit ratio) over *s (glob)
141 141 $ sleep 1
142 142 $ hg debugwaitonprefetch >/dev/null 2>%1
143 143 $ sleep 1
144 144 $ hg debugwaitonrepack >/dev/null 2>%1
145 $ sleep 1
145 146 $ find $CACHEDIR -type f | sort
146 147 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx
147 148 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack
148 149 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx
149 150 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack
150 151 $TESTTMP/hgcache/master/packs/repacklock
151 152 $TESTTMP/hgcache/repos
152 153
153 154 # Ensure that file 'w' was prefetched - it was not part of the update operation and therefore
154 155 # could only be downloaded by the background prefetch
155 156
156 157 $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
157 158 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407:
158 159 w:
159 160 Node Delta Base Delta Length Blob Size
160 161 bb6ccd5dceaa 000000000000 2 2
161 162
162 163 Total: 2 2 (0.0% bigger)
163 164 x:
164 165 Node Delta Base Delta Length Blob Size
165 166 ef95c5376f34 000000000000 3 3
166 167 1406e7411862 ef95c5376f34 14 2
167 168
168 169 Total: 17 5 (240.0% bigger)
169 170 y:
170 171 Node Delta Base Delta Length Blob Size
171 172 076f5e2225b3 000000000000 2 2
172 173
173 174 Total: 2 2 (0.0% bigger)
174 175 z:
175 176 Node Delta Base Delta Length Blob Size
176 177 69a1b6752270 000000000000 2 2
177 178
178 179 Total: 2 2 (0.0% bigger)
179 180
180 181 # background prefetch with repack on commit when wcprevset configured
181 182
182 183 $ cat >> .hg/hgrc <<EOF
183 184 > [remotefilelog]
184 185 > bgprefetchrevs=0::
185 186 > EOF
186 187
187 188 $ clearcache
188 189 $ find $CACHEDIR -type f | sort
189 190 $ echo b > b
190 191 $ hg commit -qAm b
191 192 * files fetched over 1 fetches - (* misses, 0.00% hit ratio) over *s (glob)
192 193 $ hg bookmark temporary
193 194 $ sleep 1
194 195 $ hg debugwaitonprefetch >/dev/null 2>%1
195 196 $ sleep 1
196 197 $ hg debugwaitonrepack >/dev/null 2>%1
197 198 $ sleep 1
198 199 $ find $CACHEDIR -type f | sort
199 200 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx
200 201 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack
201 202 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx
202 203 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack
203 204 $TESTTMP/hgcache/master/packs/repacklock
204 205 $TESTTMP/hgcache/repos
205 206
206 207 # Ensure that file 'w' was prefetched - it was not part of the commit operation and therefore
207 208 # could only be downloaded by the background prefetch
208 209
209 210 $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
210 211 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407:
211 212 w:
212 213 Node Delta Base Delta Length Blob Size
213 214 bb6ccd5dceaa 000000000000 2 2
214 215
215 216 Total: 2 2 (0.0% bigger)
216 217 x:
217 218 Node Delta Base Delta Length Blob Size
218 219 ef95c5376f34 000000000000 3 3
219 220 1406e7411862 ef95c5376f34 14 2
220 221
221 222 Total: 17 5 (240.0% bigger)
222 223 y:
223 224 Node Delta Base Delta Length Blob Size
224 225 076f5e2225b3 000000000000 2 2
225 226
226 227 Total: 2 2 (0.0% bigger)
227 228 z:
228 229 Node Delta Base Delta Length Blob Size
229 230 69a1b6752270 000000000000 2 2
230 231
231 232 Total: 2 2 (0.0% bigger)
232 233
233 234 # background prefetch with repack on rebase when wcprevset configured
234 235
235 236 $ hg up -r 2
236 237 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
237 238 (leaving bookmark temporary)
238 239 $ clearcache
239 240 $ find $CACHEDIR -type f | sort
240 241 $ hg rebase -s temporary -d foo
241 242 rebasing 3:58147a5b5242 "b" (temporary tip)
242 243 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/58147a5b5242-c3678817-rebase.hg (glob)
243 244 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over *s (glob)
244 245 $ sleep 1
245 246 $ hg debugwaitonprefetch >/dev/null 2>%1
246 247 $ sleep 1
247 248 $ hg debugwaitonrepack >/dev/null 2>%1
248 249 $ sleep 1
249 250
250 251 # Ensure that file 'y' was prefetched - it was not part of the rebase operation and therefore
251 252 # could only be downloaded by the background prefetch
252 253
253 254 $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
254 255 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407:
255 256 w:
256 257 Node Delta Base Delta Length Blob Size
257 258 bb6ccd5dceaa 000000000000 2 2
258 259
259 260 Total: 2 2 (0.0% bigger)
260 261 x:
261 262 Node Delta Base Delta Length Blob Size
262 263 ef95c5376f34 000000000000 3 3
263 264 1406e7411862 ef95c5376f34 14 2
264 265
265 266 Total: 17 5 (240.0% bigger)
266 267 y:
267 268 Node Delta Base Delta Length Blob Size
268 269 076f5e2225b3 000000000000 2 2
269 270
270 271 Total: 2 2 (0.0% bigger)
271 272 z:
272 273 Node Delta Base Delta Length Blob Size
273 274 69a1b6752270 000000000000 2 2
274 275
275 276 Total: 2 2 (0.0% bigger)
276 277
277 278 # Check that foregound prefetch with no arguments blocks until background prefetches finish
278 279
279 280 $ hg up -r 3
280 281 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 282 $ clearcache
282 283 $ hg prefetch --repack
283 284 waiting for lock on prefetching in $TESTTMP/shallow held by process * on host * (glob) (?)
284 285 got lock after * seconds (glob) (?)
285 286 (running background incremental repack)
286 287 * files fetched over 1 fetches - (* misses, 0.00% hit ratio) over *s (glob) (?)
287 288
288 289 $ sleep 0.5
289 290 $ hg debugwaitonrepack >/dev/null 2>%1
291 $ sleep 0.5
290 292
291 293 $ find $CACHEDIR -type f | sort
292 294 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx
293 295 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack
294 296 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx
295 297 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack
296 298 $TESTTMP/hgcache/master/packs/repacklock
297 299 $TESTTMP/hgcache/repos
298 300
299 301 # Ensure that files were prefetched
300 302 $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
301 303 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407:
302 304 w:
303 305 Node Delta Base Delta Length Blob Size
304 306 bb6ccd5dceaa 000000000000 2 2
305 307
306 308 Total: 2 2 (0.0% bigger)
307 309 x:
308 310 Node Delta Base Delta Length Blob Size
309 311 ef95c5376f34 000000000000 3 3
310 312 1406e7411862 ef95c5376f34 14 2
311 313
312 314 Total: 17 5 (240.0% bigger)
313 315 y:
314 316 Node Delta Base Delta Length Blob Size
315 317 076f5e2225b3 000000000000 2 2
316 318
317 319 Total: 2 2 (0.0% bigger)
318 320 z:
319 321 Node Delta Base Delta Length Blob Size
320 322 69a1b6752270 000000000000 2 2
321 323
322 324 Total: 2 2 (0.0% bigger)
323 325
324 326 # Check that foreground prefetch fetches revs specified by '. + draft() + bgprefetchrevs + pullprefetch'
325 327
326 328 $ clearcache
327 329 $ hg prefetch --repack
328 330 waiting for lock on prefetching in $TESTTMP/shallow held by process * on host * (glob) (?)
329 331 got lock after * seconds (glob) (?)
330 332 (running background incremental repack)
331 333 * files fetched over 1 fetches - (* misses, 0.00% hit ratio) over *s (glob) (?)
332 334 $ sleep 0.5
333 335 $ hg debugwaitonrepack >/dev/null 2>%1
336 $ sleep 0.5
334 337
335 338 $ find $CACHEDIR -type f | sort
336 339 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx
337 340 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack
338 341 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx
339 342 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack
340 343 $TESTTMP/hgcache/master/packs/repacklock
341 344 $TESTTMP/hgcache/repos
342 345
343 346 # Ensure that files were prefetched
344 347 $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1`
345 348 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407:
346 349 w:
347 350 Node Delta Base Delta Length Blob Size
348 351 bb6ccd5dceaa 000000000000 2 2
349 352
350 353 Total: 2 2 (0.0% bigger)
351 354 x:
352 355 Node Delta Base Delta Length Blob Size
353 356 ef95c5376f34 000000000000 3 3
354 357 1406e7411862 ef95c5376f34 14 2
355 358
356 359 Total: 17 5 (240.0% bigger)
357 360 y:
358 361 Node Delta Base Delta Length Blob Size
359 362 076f5e2225b3 000000000000 2 2
360 363
361 364 Total: 2 2 (0.0% bigger)
362 365 z:
363 366 Node Delta Base Delta Length Blob Size
364 367 69a1b6752270 000000000000 2 2
365 368
366 369 Total: 2 2 (0.0% bigger)
367 370
368 371 # Test that if data was prefetched and repacked we dont need to prefetch it again
369 372 # It ensures that Mercurial looks not only in loose files but in packs as well
370 373
371 374 $ hg prefetch --repack
372 375 (running background incremental repack)
General Comments 0
You need to be logged in to leave comments. Login now