Show More
@@ -40,6 +40,24 b' Helper extension to intercept renames an' | |||
|
40 | 40 | > os.kill(os.getpid(), signal.SIGKILL) |
|
41 | 41 | > EOF |
|
42 | 42 | |
|
43 | $ cat > $TESTTMP/reader_wait_split.py << EOF | |
|
44 | > import os | |
|
45 | > import signal | |
|
46 | > from mercurial import extensions, revlog, testing | |
|
47 | > def _wait_post_load(orig, self, *args, **kwargs): | |
|
48 | > wait = b'data/file' in self.radix | |
|
49 | > if wait: | |
|
50 | > testing.wait_file(b"$TESTTMP/writer-revlog-split") | |
|
51 | > r = orig(self, *args, **kwargs) | |
|
52 | > if wait: | |
|
53 | > testing.write_file(b"$TESTTMP/reader-index-read") | |
|
54 | > testing.wait_file(b"$TESTTMP/writer-revlog-unsplit") | |
|
55 | > return r | |
|
56 | > | |
|
57 | > def extsetup(ui): | |
|
58 | > extensions.wrapfunction(revlog.revlog, '_loadindex', _wait_post_load) | |
|
59 | > EOF | |
|
60 | ||
|
43 | 61 | setup a repository for tests |
|
44 | 62 | ---------------------------- |
|
45 | 63 | |
@@ -333,3 +351,44 b' File are still split on disk, with the e' | |||
|
333 | 351 | hint: run "hg debugrebuildfncache" to recover from corrupt fncache |
|
334 | 352 | $ cd .. |
|
335 | 353 | |
|
354 | Read race | |
|
355 | ========= | |
|
356 | ||
|
357 | We check that a client that started reading a revlog (its index) after the | |
|
358 | split and end reading (the data) after the rollback should be fine | |
|
359 | ||
|
360 | $ hg clone --quiet --rev 1 troffset-computation troffset-computation-race | |
|
361 | $ cd troffset-computation-race | |
|
362 | $ cat > .hg/hgrc <<EOF | |
|
363 | > [hooks] | |
|
364 | > pretxnchangegroup=$RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/reader-index-read $TESTTMP/writer-revlog-split | |
|
365 | > pretxnclose = false | |
|
366 | > EOF | |
|
367 | ||
|
368 | start a reader | |
|
369 | ||
|
370 | $ hg cat --rev 0 file \ | |
|
371 | > --config "extensions.wait_read=$TESTTMP/reader_wait_split.py" \ | |
|
372 | > 2> $TESTTMP/reader.stderr \ | |
|
373 | > > $TESTTMP/reader.stdout & | |
|
374 | ||
|
375 | Do a failed pull in // | |
|
376 | ||
|
377 | $ hg pull ../troffset-computation | |
|
378 | pulling from ../troffset-computation | |
|
379 | searching for changes | |
|
380 | adding changesets | |
|
381 | adding manifests | |
|
382 | adding file changes | |
|
383 | transaction abort! | |
|
384 | rollback completed | |
|
385 | abort: pretxnclose hook exited with status 1 | |
|
386 | [40] | |
|
387 | $ touch $TESTTMP/writer-revlog-unsplit | |
|
388 | $ wait | |
|
389 | ||
|
390 | The reader should be fine | |
|
391 | $ cat $TESTTMP/reader.stderr | |
|
392 | $ cat $TESTTMP/reader.stdout | |
|
393 | 1 (no-eol) | |
|
394 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now