Mercurial > hg
comparison tests/test-remotefilelog-bgprefetch.t @ 42943:5fadf6103790
remotefilelog: replace repack lock to solve race condition
2c74337e6483 reduced the probability of race-conditions when starting
background repack and prefetch and we saw the difference in our CI instance
with all failures disappearing except one where one call to waitonrepack seems
to returns too early.
I'm not sure what exactly goes wrong but I realized that while the prefetch
operation uses a standard Mercurial lock, the repack operation is using a
custom lock based on `fcntl.flock` on available platforms. As `extutil.flock`
fallback on traditional Mercurial locks on other platforms and the tests are
stable on my laptop, our CI environment and GCC112, I'm sending this patch to
standardize the behavior across environments.
Differential Revision: https://phab.mercurial-scm.org/D6844
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 11 Sep 2019 17:41:13 +0200 |
parents | d7304434390f |
children | 88ab1295db4c |
comparison
equal
deleted
inserted
replaced
42942:adac17faa72e | 42943:5fadf6103790 |
---|---|
115 $ find $CACHEDIR -type f | sort | 115 $ find $CACHEDIR -type f | sort |
116 $TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histidx | 116 $TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histidx |
117 $TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histpack | 117 $TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histpack |
118 $TESTTMP/hgcache/master/packs/8ce5ab3745465ab83bba30a7b9c295e0c8404652.dataidx | 118 $TESTTMP/hgcache/master/packs/8ce5ab3745465ab83bba30a7b9c295e0c8404652.dataidx |
119 $TESTTMP/hgcache/master/packs/8ce5ab3745465ab83bba30a7b9c295e0c8404652.datapack | 119 $TESTTMP/hgcache/master/packs/8ce5ab3745465ab83bba30a7b9c295e0c8404652.datapack |
120 $TESTTMP/hgcache/master/packs/repacklock | |
121 $TESTTMP/hgcache/repos | 120 $TESTTMP/hgcache/repos |
122 | 121 |
123 # background prefetch with repack on update when wcprevset configured | 122 # background prefetch with repack on update when wcprevset configured |
124 | 123 |
125 $ clearcache | 124 $ clearcache |
152 $ find $CACHEDIR -type f | sort | 151 $ find $CACHEDIR -type f | sort |
153 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx | 152 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx |
154 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack | 153 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack |
155 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx | 154 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx |
156 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack | 155 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack |
157 $TESTTMP/hgcache/master/packs/repacklock | |
158 $TESTTMP/hgcache/repos | 156 $TESTTMP/hgcache/repos |
159 | 157 |
160 # Ensure that file 'w' was prefetched - it was not part of the update operation and therefore | 158 # Ensure that file 'w' was prefetched - it was not part of the update operation and therefore |
161 # could only be downloaded by the background prefetch | 159 # could only be downloaded by the background prefetch |
162 | 160 |
205 $ find $CACHEDIR -type f | sort | 203 $ find $CACHEDIR -type f | sort |
206 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx | 204 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx |
207 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack | 205 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack |
208 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx | 206 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx |
209 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack | 207 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack |
210 $TESTTMP/hgcache/master/packs/repacklock | |
211 $TESTTMP/hgcache/repos | 208 $TESTTMP/hgcache/repos |
212 | 209 |
213 # Ensure that file 'w' was prefetched - it was not part of the commit operation and therefore | 210 # Ensure that file 'w' was prefetched - it was not part of the commit operation and therefore |
214 # could only be downloaded by the background prefetch | 211 # could only be downloaded by the background prefetch |
215 | 212 |
244 (leaving bookmark temporary) | 241 (leaving bookmark temporary) |
245 $ clearcache | 242 $ clearcache |
246 $ find $CACHEDIR -type f | sort | 243 $ find $CACHEDIR -type f | sort |
247 $ hg rebase -s temporary -d foo | 244 $ hg rebase -s temporary -d foo |
248 rebasing 3:58147a5b5242 "b" (temporary tip) | 245 rebasing 3:58147a5b5242 "b" (temporary tip) |
249 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/58147a5b5242-c3678817-rebase.hg (glob) | 246 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/58147a5b5242-c3678817-rebase.hg |
250 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over *s (glob) | 247 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over *s (glob) |
251 $ sleep 1 | 248 $ sleep 1 |
252 $ hg debugwaitonprefetch >/dev/null 2>%1 | 249 $ hg debugwaitonprefetch >/dev/null 2>%1 |
253 $ sleep 1 | 250 $ sleep 1 |
254 $ hg debugwaitonrepack >/dev/null 2>%1 | 251 $ hg debugwaitonrepack >/dev/null 2>%1 |
299 $ find $CACHEDIR -type f | sort | 296 $ find $CACHEDIR -type f | sort |
300 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx | 297 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx |
301 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack | 298 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack |
302 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx | 299 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx |
303 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack | 300 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack |
304 $TESTTMP/hgcache/master/packs/repacklock | |
305 $TESTTMP/hgcache/repos | 301 $TESTTMP/hgcache/repos |
306 | 302 |
307 # Ensure that files were prefetched | 303 # Ensure that files were prefetched |
308 $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` | 304 $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` |
309 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407: | 305 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407: |
344 $ find $CACHEDIR -type f | sort | 340 $ find $CACHEDIR -type f | sort |
345 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx | 341 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx |
346 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack | 342 $TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack |
347 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx | 343 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.dataidx |
348 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack | 344 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407.datapack |
349 $TESTTMP/hgcache/master/packs/repacklock | |
350 $TESTTMP/hgcache/repos | 345 $TESTTMP/hgcache/repos |
351 | 346 |
352 # Ensure that files were prefetched | 347 # Ensure that files were prefetched |
353 $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` | 348 $ hg debugdatapack `ls -ct $TESTTMP/hgcache/master/packs/*.datapack | head -n 1` |
354 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407: | 349 $TESTTMP/hgcache/master/packs/f4d50848e0b465e9bfd2875f213044c06cfd7407: |