tests/test-transaction-rollback-on-revlog-split.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Wed, 31 Aug 2022 06:37:42 +0200
branchstable
changeset 49467 0705afae6253
parent 48571 ccd9cb73125c
child 50311 e2ba2234bf1c
permissions -rw-r--r--
dirstate-v2: backup the data file during the transaction (issue6730) If we backup of the docket, without doing a backup of the data file, we highly risk restoring a docket pointing to a missing file in the future. So we now backup the data-file alongside the docket.
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
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
     4
Helper extension to intercept renames.
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
     5
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
     6
  $ cat > $TESTTMP/intercept_rename.py << EOF
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
     7
  > import os
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
     8
  > import sys
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):
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    12
  >     def close(orig, *args, **kwargs):
47561
8e9295912573 compat: normalise path before comparison in revlog splitting test
Raphaël Gomès <rgomes@octobus.net>
parents: 47314
diff changeset
    13
  >         path = util.normpath(args[0]._atomictempfile__name)
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    14
  >         if path.endswith(b'/.hg/store/data/file.i'):
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    15
  >             os._exit(80)
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    16
  >         return orig(*args, **kwargs)
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    17
  >     extensions.wrapfunction(util.atomictempfile, 'close', close)
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
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
    20
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
    21
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
    22
after the index has been replaced.
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    23
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
    24
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
    25
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
    26
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
    27
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
    28
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
    29
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
    30
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    31
  $ hg init troffset-computation --config format.revlog-compression=none
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    32
  $ cd troffset-computation
47314
93fc0a13b7e8 tests: partially fix test-transaction-rollback-on-revlog-split.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 47286
diff changeset
    33
  $ printf '%20d' '1' > file
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
    34
  $ hg commit -Aqma
47314
93fc0a13b7e8 tests: partially fix test-transaction-rollback-on-revlog-split.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 47286
diff changeset
    35
  $ printf '%1024d' '1' > file
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
    36
  $ hg commit -Aqmb
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
    37
  $ printf '%20d' '1' > file
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
    38
  $ hg commit -Aqmc
47284
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    39
  $ dd if=/dev/zero of=file bs=1k count=128 > /dev/null 2>&1
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
    40
  $ hg commit -AqmD
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
    41
47284
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    42
  $ cd ..
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    43
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    44
  $ hg clone -r 1 troffset-computation troffset-computation-copy --config format.revlog-compression=none -q
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    45
  $ cd troffset-computation-copy
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    46
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    47
Reference size:
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    48
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    49
  $ f -s .hg/store/data/file*
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    50
  .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
    51
47284
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    52
  $ cat > .hg/hgrc <<EOF
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    53
  > [hooks]
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    54
  > pretxnchangegroup = python:$TESTDIR/helper-killhook.py:killme
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    55
  > EOF
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    56
#if chg
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    57
  $ hg pull ../troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    58
  pulling from ../troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    59
  [255]
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    60
#else
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    61
  $ hg pull ../troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    62
  pulling from ../troffset-computation
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    63
  [80]
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    64
#endif
21ed126bab53 revlog: fix index computation during inline->non-inline transition
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    65
  $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file | tail -1
48571
ccd9cb73125c revlog: fix a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48570
diff changeset
    66
  data/file.i 128
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    67
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
    68
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
    69
The first file.d entry is the temporary record during the split,
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    70
the second entry after the split happened. The sum of the second file.d
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    71
and the second file.i entry should match the first file.i entry.
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    72
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    73
  $ 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
    74
  data/file.i 1174
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    75
  data/file.d 0
48571
ccd9cb73125c revlog: fix a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48570
diff changeset
    76
  data/file.d 1046
ccd9cb73125c revlog: fix a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48570
diff changeset
    77
  data/file.i 128
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
    78
  $ hg recover
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
    79
  rolling back interrupted transaction
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
    80
  (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
    81
  $ f -s .hg/store/data/file*
48571
ccd9cb73125c revlog: fix a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48570
diff changeset
    82
  .hg/store/data/file.d: size=1046
ccd9cb73125c revlog: fix a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48570
diff changeset
    83
  .hg/store/data/file.i: size=128
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
    84
  $ hg tip
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
    85
  changeset:   1:cfa8d6e60429
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
    86
  tag:         tip
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
    87
  user:        test
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
    88
  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
    89
  summary:     b
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
    90
  
47874
308e843f24b1 test: reduce noise, so the important bits stand out
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47561
diff changeset
    91
  $ hg verify -q
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
    92
   warning: revlog 'data/file.d' not in fncache!
48571
ccd9cb73125c revlog: fix a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48570
diff changeset
    93
  1 warnings encountered!
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
    94
  hint: run "hg debugrebuildfncache" to recover from corrupt fncache
47875
0fb328bb2459 debugrebuildfncache: add a cheaper option to rebuild the fncache
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47874
diff changeset
    95
  $ hg debugrebuildfncache --only-data
0fb328bb2459 debugrebuildfncache: add a cheaper option to rebuild the fncache
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47874
diff changeset
    96
  adding data/file.d
0fb328bb2459 debugrebuildfncache: add a cheaper option to rebuild the fncache
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47874
diff changeset
    97
  1 items added, 0 removed from fncache
0fb328bb2459 debugrebuildfncache: add a cheaper option to rebuild the fncache
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47874
diff changeset
    98
  $ hg verify -q
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
    99
  $ cd ..
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   100
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   101
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   102
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
   103
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
   104
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
   105
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   106
  $ hg clone -r 1 troffset-computation troffset-computation-copy2 --config format.revlog-compression=none -q
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   107
  $ cd troffset-computation-copy2
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   108
  $ cat > .hg/hgrc <<EOF
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   109
  > [extensions]
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   110
  > intercept_rename = $TESTTMP/intercept_rename.py
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   111
  > [hooks]
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   112
  > pretxnchangegroup = python:$TESTDIR/helper-killhook.py:killme
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   113
  > EOF
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   114
#if chg
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   115
  $ hg pull ../troffset-computation
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   116
  pulling from ../troffset-computation
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   117
  [255]
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   118
#else
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   119
  $ hg pull ../troffset-computation
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   120
  pulling from ../troffset-computation
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   121
  [80]
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   122
#endif
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   123
  $ 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
   124
  data/file.i 1174
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   125
  data/file.d 0
48571
ccd9cb73125c revlog: fix a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48570
diff changeset
   126
  data/file.d 1046
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   127
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   128
  $ hg recover
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   129
  rolling back interrupted transaction
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   130
  (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
   131
  $ f -s .hg/store/data/file*
48571
ccd9cb73125c revlog: fix a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48570
diff changeset
   132
  .hg/store/data/file.d: size=1046
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   133
  .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
   134
  $ hg tip
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   135
  changeset:   1:cfa8d6e60429
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   136
  tag:         tip
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   137
  user:        test
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   138
  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
   139
  summary:     b
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   140
  
47874
308e843f24b1 test: reduce noise, so the important bits stand out
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47561
diff changeset
   141
  $ hg verify -q
47285
46b828b85eb7 revlog: update data file record before index rename
Joerg Sonnenberger <joerg@bec.de>
parents: 47284
diff changeset
   142
  $ cd ..
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   143
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   144
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   145
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
   146
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   147
  $ hg clone -r 1 troffset-computation troffset-computation-copy-rb --config format.revlog-compression=none -q
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   148
  $ cd troffset-computation-copy-rb
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   149
  $ cat > .hg/hgrc <<EOF
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   150
  > [hooks]
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   151
  > pretxnchangegroup = false
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   152
  > EOF
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   153
  $ hg pull ../troffset-computation
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   154
  pulling from ../troffset-computation
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   155
  searching for changes
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   156
  adding changesets
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   157
  adding manifests
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   158
  adding file changes
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   159
  transaction abort!
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   160
  rollback completed
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   161
  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
   162
  [40]
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*
48571
ccd9cb73125c revlog: fix a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48570
diff changeset
   164
  .hg/store/data/file.d: size=1046
ccd9cb73125c revlog: fix a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48570
diff changeset
   165
  .hg/store/data/file.i: size=128
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   166
  $ hg tip
48570
f38ae2d7390e revlog: demonstrate a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 47875
diff changeset
   167
  changeset:   1:cfa8d6e60429
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   168
  tag:         tip
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   169
  user:        test
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   170
  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
   171
  summary:     b
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   172
  
47874
308e843f24b1 test: reduce noise, so the important bits stand out
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 47561
diff changeset
   173
  $ hg verify -q
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   174
   warning: revlog 'data/file.d' not in fncache!
48571
ccd9cb73125c revlog: fix a bug where transaction can be aborted partially
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents: 48570
diff changeset
   175
  1 warnings encountered!
47286
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   176
  hint: run "hg debugrebuildfncache" to recover from corrupt fncache
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   177
  $ cd ..
18415fc918a1 recover: only apply last journal record per file (issue6423)
Joerg Sonnenberger <joerg@bec.de>
parents: 47285
diff changeset
   178