tests/test-transaction-rollback-on-revlog-split.t
author Raphaël Gomès <rgomes@octobus.net>
Tue, 18 Apr 2023 11:40:57 +0200
branchstable
changeset 50349 98ddff854d8a
parent 50334 2231f7d8a602
child 50364 f930af431193
permissions -rw-r--r--
Added tag 6.4.2 for changeset f952be90b051
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47284
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     1
Test correctness of revlog inline -> non-inline transition
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     2
----------------------------------------------------------
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     3
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
     4
Helper extension to intercept renames and kill process
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
     5
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
     6
  $ cat > $TESTTMP/intercept_before_rename.py << EOF
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
     7
  > import os
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
     8
  > import signal
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
     9
  > from mercurial import extensions, util
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    10
  > 
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    11
  > def extsetup(ui):
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    12
  >     def rename(orig, src, dest, *args, **kwargs):
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    13
  >         path = util.normpath(dest)
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    14
  >         if path.endswith(b'data/file.i'):
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    15
  >             os.kill(os.getpid(), signal.SIGKILL)
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    16
  >         return orig(src, dest, *args, **kwargs)
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    17
  >     extensions.wrapfunction(util, 'rename', rename)
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    18
  > EOF
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    19
50312
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    20
  $ cat > $TESTTMP/intercept_after_rename.py << EOF
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    21
  > import os
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    22
  > import signal
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    23
  > from mercurial import extensions, util
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    24
  > 
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    25
  > def extsetup(ui):
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    26
  >     def close(orig, *args, **kwargs):
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    27
  >         path = util.normpath(args[0]._atomictempfile__name)
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    28
  >         r = orig(*args, **kwargs)
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    29
  >         if path.endswith(b'/.hg/store/data/file.i'):
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    30
  >             os.kill(os.getpid(), signal.SIGKILL)
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    31
  >         return r
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    32
  >     extensions.wrapfunction(util.atomictempfile, 'close', close)
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    33
  > def extsetup(ui):
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    34
  >     def rename(orig, src, dest, *args, **kwargs):
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    35
  >         path = util.normpath(dest)
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    36
  >         r = orig(src, dest, *args, **kwargs)
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    37
  >         if path.endswith(b'data/file.i'):
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    38
  >             os.kill(os.getpid(), signal.SIGKILL)
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    39
  >         return r
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    40
  >     extensions.wrapfunction(util, 'rename', rename)
50312
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    41
  > EOF
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
    42
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    43
  $ cat > $TESTTMP/killme.py << EOF
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    44
  > import os
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    45
  > import signal
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    46
  > 
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    47
  > def killme(ui, repo, hooktype, **kwargs):
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    48
  >     os.kill(os.getpid(), signal.SIGKILL)
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    49
  > EOF
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    50
50313
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    51
  $ cat > $TESTTMP/reader_wait_split.py << EOF
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    52
  > import os
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    53
  > import signal
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    54
  > from mercurial import extensions, revlog, testing
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    55
  > def _wait_post_load(orig, self, *args, **kwargs):
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    56
  >     wait = b'data/file' in self.radix
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    57
  >     if wait:
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    58
  >         testing.wait_file(b"$TESTTMP/writer-revlog-split")
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    59
  >     r = orig(self, *args, **kwargs)
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    60
  >     if wait:
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    61
  >         testing.write_file(b"$TESTTMP/reader-index-read")
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    62
  >         testing.wait_file(b"$TESTTMP/writer-revlog-unsplit")
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    63
  >     return r
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    64
  > 
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    65
  > def extsetup(ui):
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    66
  >     extensions.wrapfunction(revlog.revlog, '_loadindex', _wait_post_load)
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    67
  > EOF
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
    68
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    69
setup a repository for tests
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    70
----------------------------
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    71
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    72
  $ cat >> $HGRCPATH << EOF
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    73
  > [format]
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    74
  > revlog-compression=none
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    75
  > EOF
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    76
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    77
  $ hg init troffset-computation
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    78
  $ cd troffset-computation
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    79
  $ printf '%20d' '1' > file
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    80
  $ hg commit -Aqma
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    81
  $ printf '%1024d' '1' > file
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    82
  $ hg commit -Aqmb
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    83
  $ printf '%20d' '1' > file
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    84
  $ hg commit -Aqmc
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    85
  $ dd if=/dev/zero of=file bs=1k count=128 > /dev/null 2>&1
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
    86
  $ hg commit -AqmD --traceback
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    87
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    88
Reference size:
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    89
  $ f -s file
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    90
  file: size=131072
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    91
  $ f -s .hg/store/data/file*
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    92
  .hg/store/data/file.d: size=132139
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    93
  .hg/store/data/file.i: size=256
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    94
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    95
  $ cd ..
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    96
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    97
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    98
Test a hard crash after the file was split but before the transaction was committed
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
    99
===================================================================================
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   100
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   101
Test offset computation to correctly factor in the index entries themselves.
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   102
Also test that the new data size has the correct size if the transaction is aborted
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   103
after the index has been replaced.
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   104
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   105
Test repo has commits a, b, c, D, where D is large (grows the revlog enough that it
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   106
transitions to non-inline storage). The clone initially has changes a, b
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   107
and will transition to non-inline storage when adding c, D.
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   108
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   109
If the transaction adding c, D is rolled back, then we don't undo the revlog split,
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   110
but truncate the index and the data to remove both c and D.
47284
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   111
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   112
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   113
  $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy
47284
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   114
  $ cd troffset-computation-copy
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   115
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   116
Reference size:
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   117
  $ f -s file
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   118
  file: size=1024
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   119
  $ f -s .hg/store/data/file*
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   120
  .hg/store/data/file.i: size=1174
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   121
47284
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   122
  $ cat > .hg/hgrc <<EOF
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   123
  > [hooks]
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   124
  > pretxnchangegroup = python:$TESTTMP/killme.py:killme
47284
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   125
  > EOF
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   126
#if chg
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   127
  $ hg pull ../troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   128
  pulling from ../troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   129
  [255]
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   130
#else
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   131
  $ hg pull ../troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   132
  pulling from ../troffset-computation
50334
2231f7d8a602 test-tx-rollback: more lenient glob for kill status (issue6807)
pacien <pacien.trangirard@pacien.net>
parents: 50316
diff changeset
   133
  *Killed* (glob)
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   134
  [137]
47284
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   135
#endif
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   136
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   137
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   138
The inline revlog still exist, but a split version exist next to it
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   139
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   140
  $ f -s .hg/store/data/file*
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   141
  .hg/store/data/file.d: size=132139
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   142
  .hg/store/data/file.i: size=132395
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   143
  .hg/store/data/file.i.s: size=256
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   144
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   145
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   146
The first file.i entry should match the "Reference size" above.
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   147
The first file.d entry is the temporary record during the split,
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   148
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   149
A "temporary file" entry exist for the split index.
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   150
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   151
  $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   152
  data/file.i 1174
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   153
  data/file.d 0
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   154
  $ cat .hg/store/journal.backupfiles | tr -s '\000' ' ' | tr -s '\00' ' '| grep data/file
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   155
   data/file.i data/journal.backup.file.i 0
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   156
   data/file.i.s 0
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   157
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   158
recover is rolling the split back, the fncache is still valid
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   159
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   160
  $ hg recover
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   161
  rolling back interrupted transaction
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   162
  (verify step skipped, run `hg verify` to check your repository content)
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   163
  $ f -s .hg/store/data/file*
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   164
  .hg/store/data/file.i: size=1174
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   165
  $ hg tip
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   166
  changeset:   1:cfa8d6e60429
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   167
  tag:         tip
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   168
  user:        test
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   169
  date:        Thu Jan 01 00:00:00 1970 +0000
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   170
  summary:     b
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   171
  
47874
308e843f24b1 test: reduce noise, so the important bits stand out
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47561
diff changeset
   172
  $ hg verify -q
47875
0fb328bb2459 debugrebuildfncache: add a cheaper option to rebuild the fncache
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47874
diff changeset
   173
  $ hg debugrebuildfncache --only-data
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   174
  fncache already up to date
47875
0fb328bb2459 debugrebuildfncache: add a cheaper option to rebuild the fncache
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47874
diff changeset
   175
  $ hg verify -q
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   176
  $ cd ..
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   177
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   178
Test a hard crash right before the index is move into place
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   179
===========================================================
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   180
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   181
Now retry the procedure but intercept the rename of the index and check that
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   182
the journal does not contain the new index size. This demonstrates the edge case
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   183
where the data file is left as garbage.
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   184
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   185
  $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy2
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   186
  $ cd troffset-computation-copy2
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   187
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   188
Reference size:
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   189
  $ f -s file
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   190
  file: size=1024
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   191
  $ f -s .hg/store/data/file*
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   192
  .hg/store/data/file.i: size=1174
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   193
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   194
  $ cat > .hg/hgrc <<EOF
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   195
  > [extensions]
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   196
  > intercept_rename = $TESTTMP/intercept_before_rename.py
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   197
  > EOF
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   198
#if chg
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   199
  $ hg pull ../troffset-computation
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   200
  pulling from ../troffset-computation
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   201
  searching for changes
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   202
  adding changesets
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   203
  adding manifests
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   204
  adding file changes
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   205
  [255]
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   206
#else
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   207
  $ hg pull ../troffset-computation
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   208
  pulling from ../troffset-computation
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   209
  searching for changes
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   210
  adding changesets
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   211
  adding manifests
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   212
  adding file changes
50334
2231f7d8a602 test-tx-rollback: more lenient glob for kill status (issue6807)
pacien <pacien.trangirard@pacien.net>
parents: 50316
diff changeset
   213
  *Killed* (glob)
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   214
  [137]
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   215
#endif
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   216
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   217
The inline revlog still exist, but a split version exist next to it
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   218
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   219
  $ f -s .hg/store/data/file*
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   220
  .hg/store/data/file.d: size=132139
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   221
  .hg/store/data/file.i: size=132395
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   222
  .hg/store/data/file.i.s: size=256
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   223
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   224
  $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   225
  data/file.i 1174
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   226
  data/file.d 0
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   227
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   228
recover is rolling the split back, the fncache is still valid
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   229
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   230
  $ hg recover
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   231
  rolling back interrupted transaction
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   232
  (verify step skipped, run `hg verify` to check your repository content)
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   233
  $ f -s .hg/store/data/file*
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   234
  .hg/store/data/file.i: size=1174
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   235
  $ hg tip
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   236
  changeset:   1:cfa8d6e60429
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   237
  tag:         tip
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   238
  user:        test
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   239
  date:        Thu Jan 01 00:00:00 1970 +0000
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   240
  summary:     b
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   241
  
47874
308e843f24b1 test: reduce noise, so the important bits stand out
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47561
diff changeset
   242
  $ hg verify -q
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   243
  $ cd ..
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   244
50312
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   245
Test a hard crash right after the index is move into place
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   246
===========================================================
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   247
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   248
Now retry the procedure but intercept the rename of the index.
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   249
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   250
  $ hg clone --quiet --rev 1 troffset-computation troffset-computation-crash-after-rename
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   251
  $ cd troffset-computation-crash-after-rename
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   252
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   253
Reference size:
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   254
  $ f -s file
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   255
  file: size=1024
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   256
  $ f -s .hg/store/data/file*
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   257
  .hg/store/data/file.i: size=1174
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   258
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   259
  $ cat > .hg/hgrc <<EOF
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   260
  > [extensions]
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   261
  > intercept_rename = $TESTTMP/intercept_after_rename.py
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   262
  > EOF
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   263
#if chg
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   264
  $ hg pull ../troffset-computation
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   265
  pulling from ../troffset-computation
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   266
  searching for changes
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   267
  adding changesets
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   268
  adding manifests
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   269
  adding file changes
50312
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   270
  [255]
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   271
#else
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   272
  $ hg pull ../troffset-computation
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   273
  pulling from ../troffset-computation
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   274
  searching for changes
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   275
  adding changesets
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   276
  adding manifests
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   277
  adding file changes
50334
2231f7d8a602 test-tx-rollback: more lenient glob for kill status (issue6807)
pacien <pacien.trangirard@pacien.net>
parents: 50316
diff changeset
   278
  *Killed* (glob)
50312
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   279
  [137]
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   280
#endif
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   281
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   282
The inline revlog was over written on disk
50312
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   283
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   284
  $ f -s .hg/store/data/file*
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   285
  .hg/store/data/file.d: size=132139
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   286
  .hg/store/data/file.i: size=256
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   287
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   288
  $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   289
  data/file.i 1174
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   290
  data/file.d 0
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   291
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   292
recover is rolling the split back, the fncache is still valid
50312
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   293
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   294
  $ hg recover
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   295
  rolling back interrupted transaction
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   296
  (verify step skipped, run `hg verify` to check your repository content)
50312
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   297
  $ f -s .hg/store/data/file*
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   298
  .hg/store/data/file.i: size=1174
50312
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   299
  $ hg tip
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   300
  changeset:   1:cfa8d6e60429
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   301
  tag:         tip
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   302
  user:        test
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   303
  date:        Thu Jan 01 00:00:00 1970 +0000
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   304
  summary:     b
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   305
  
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   306
  $ hg verify -q
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   307
  $ cd ..
c185545a4c69 revlog: add a failing variant of the the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50311
diff changeset
   308
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   309
Have the transaction rollback itself without any hard crash
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   310
===========================================================
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   311
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   312
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   313
Repeat the original test but let hg rollback the transaction.
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   314
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   315
  $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy-rb
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   316
  $ cd troffset-computation-copy-rb
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   317
  $ cat > .hg/hgrc <<EOF
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   318
  > [hooks]
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   319
  > pretxnchangegroup = false
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   320
  > EOF
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   321
  $ hg pull ../troffset-computation
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   322
  pulling from ../troffset-computation
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   323
  searching for changes
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   324
  adding changesets
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   325
  adding manifests
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   326
  adding file changes
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   327
  transaction abort!
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   328
  rollback completed
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   329
  abort: pretxnchangegroup hook exited with status 1
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   330
  [40]
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   331
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   332
The split was rollback
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   333
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   334
  $ f -s .hg/store/data/file*
50316
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   335
  .hg/store/data/file.d: size=0
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   336
  .hg/store/data/file.i: size=1174
87f0155d68aa revlog: improve the robustness of the splitting process
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50314
diff changeset
   337
50311
e2ba2234bf1c revlog: update the split + transaction test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48571
diff changeset
   338
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   339
  $ hg tip
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   340
  changeset:   1:cfa8d6e60429
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   341
  tag:         tip
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   342
  user:        test
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   343
  date:        Thu Jan 01 00:00:00 1970 +0000
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   344
  summary:     b
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   345
  
47874
308e843f24b1 test: reduce noise, so the important bits stand out
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47561
diff changeset
   346
  $ hg verify -q
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   347
  $ cd ..
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   348
50313
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   349
Read race
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   350
=========
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   351
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   352
We check that a client that started reading a revlog (its index) after the
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   353
split and end reading (the data) after the rollback should be fine
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   354
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   355
  $ hg clone --quiet --rev 1 troffset-computation troffset-computation-race
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   356
  $ cd troffset-computation-race
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   357
  $ cat > .hg/hgrc <<EOF
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   358
  > [hooks]
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   359
  > pretxnchangegroup=$RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/reader-index-read $TESTTMP/writer-revlog-split
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   360
  > pretxnclose = false
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   361
  > EOF
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   362
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   363
start a reader
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   364
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   365
  $ hg cat --rev 0 file \
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   366
  > --config "extensions.wait_read=$TESTTMP/reader_wait_split.py" \
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   367
  > 2> $TESTTMP/reader.stderr \
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   368
  > > $TESTTMP/reader.stdout &
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   369
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   370
Do a failed pull in //
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   371
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   372
  $ hg pull ../troffset-computation
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   373
  pulling from ../troffset-computation
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   374
  searching for changes
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   375
  adding changesets
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   376
  adding manifests
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   377
  adding file changes
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   378
  transaction abort!
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   379
  rollback completed
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   380
  abort: pretxnclose hook exited with status 1
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   381
  [40]
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   382
  $ touch $TESTTMP/writer-revlog-unsplit
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   383
  $ wait
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   384
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   385
The reader should be fine
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   386
  $ cat $TESTTMP/reader.stderr
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   387
  $ cat $TESTTMP/reader.stdout
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   388
                     1 (no-eol)
b0cdd0bea103 revlog: test possible read race condition with splitting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50312
diff changeset
   389
  $ cd ..
50314
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   390
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   391
pending hooks
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   392
=============
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   393
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   394
We checks that hooks properly see the inside of the transaction, while other process don't.
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   395
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   396
  $ hg clone --quiet --rev 1 troffset-computation troffset-computation-hooks
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   397
  $ cd troffset-computation-hooks
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   398
  $ cat > .hg/hgrc <<EOF
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   399
  > [hooks]
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   400
  > pretxnclose.01-echo = hg cat -r 'max(all())' file | f --size
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   401
  > pretxnclose.02-echo = $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/hook-done $TESTTMP/hook-tr-ready
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   402
  > pretxnclose.03-abort = false
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   403
  > EOF
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   404
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   405
  $ (
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   406
  >   $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/hook-tr-ready;\
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   407
  >   hg cat -r 'max(all())' file | f --size;\
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   408
  >   touch $TESTTMP/hook-done
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   409
  > ) >stdout 2>stderr &
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   410
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   411
  $ hg pull ../troffset-computation
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   412
  pulling from ../troffset-computation
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   413
  searching for changes
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   414
  adding changesets
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   415
  adding manifests
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   416
  adding file changes
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   417
  size=131072
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   418
  transaction abort!
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   419
  rollback completed
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   420
  abort: pretxnclose.03-abort hook exited with status 1
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   421
  [40]
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   422
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   423
  $ cat stdout
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   424
  size=1024
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   425
  $ cat stderr
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   426
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   427
6487737e0f00 revlog: test that pending hooks properly see the repository on split
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50313
diff changeset
   428
  $ cd ..