comparison tests/test-transaction-rollback-on-revlog-split.t @ 47286:18415fc918a1

recover: only apply last journal record per file (issue6423) This got broken in 2019 when the size check was introduced. It is most noticable when dealing with transactions that involve an inline to non-inline revlog storage transaction. It wasn't seen as much at the time because the in-memory journal actually de-duplicated the entry implicity, but since 63edc384d3b7 the on-disk journal is used for rollback as well as recover. Differential Revision: https://phab.mercurial-scm.org/D10726
author Joerg Sonnenberger <joerg@bec.de>
date Wed, 19 May 2021 13:45:34 +0200
parents 46b828b85eb7
children 93fc0a13b7e8
comparison
equal deleted inserted replaced
47285:46b828b85eb7 47286:18415fc918a1
68 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file 68 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
69 data/file.i 1174 69 data/file.i 1174
70 data/file.d 0 70 data/file.d 0
71 data/file.d 1046 71 data/file.d 1046
72 data/file.i 128 72 data/file.i 128
73 $ hg recover
74 rolling back interrupted transaction
75 (verify step skipped, run `hg verify` to check your repository content)
76 $ f -s .hg/store/data/file*
77 .hg/store/data/file.d: size=1046
78 .hg/store/data/file.i: size=128
79 $ hg tip
80 changeset: 1:3ce491143aec
81 tag: tip
82 user: test
83 date: Thu Jan 01 00:00:00 1970 +0000
84 summary: _
85
86 $ hg verify
87 checking changesets
88 checking manifests
89 crosschecking files in changesets and manifests
90 checking files
91 warning: revlog 'data/file.d' not in fncache!
92 checked 2 changesets with 2 changes to 1 files
93 1 warnings encountered!
94 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
73 $ cd .. 95 $ cd ..
74 96
75 Now retry the same but intercept the rename of the index and check that 97
98 Now retry the procedure but intercept the rename of the index and check that
76 the journal does not contain the new index size. This demonstrates the edge case 99 the journal does not contain the new index size. This demonstrates the edge case
77 where the data file is left as garbage. 100 where the data file is left as garbage.
78 101
79 $ hg clone -r 1 troffset-computation troffset-computation-copy2 --config format.revlog-compression=none -q 102 $ hg clone -r 1 troffset-computation troffset-computation-copy2 --config format.revlog-compression=none -q
80 $ cd troffset-computation-copy2 103 $ cd troffset-computation-copy2
95 #endif 118 #endif
96 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file 119 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
97 data/file.i 1174 120 data/file.i 1174
98 data/file.d 0 121 data/file.d 0
99 data/file.d 1046 122 data/file.d 1046
123
124 $ hg recover
125 rolling back interrupted transaction
126 (verify step skipped, run `hg verify` to check your repository content)
127 $ f -s .hg/store/data/file*
128 .hg/store/data/file.d: size=1046
129 .hg/store/data/file.i: size=1174
130 $ hg tip
131 changeset: 1:3ce491143aec
132 tag: tip
133 user: test
134 date: Thu Jan 01 00:00:00 1970 +0000
135 summary: _
136
137 $ hg verify
138 checking changesets
139 checking manifests
140 crosschecking files in changesets and manifests
141 checking files
142 checked 2 changesets with 2 changes to 1 files
100 $ cd .. 143 $ cd ..
144
145
146 Repeat the original test but let hg rollback the transaction.
147
148 $ hg clone -r 1 troffset-computation troffset-computation-copy-rb --config format.revlog-compression=none -q
149 $ cd troffset-computation-copy-rb
150 $ cat > .hg/hgrc <<EOF
151 > [hooks]
152 > pretxnchangegroup = false
153 > EOF
154 $ hg pull ../troffset-computation
155 pulling from ../troffset-computation
156 searching for changes
157 adding changesets
158 adding manifests
159 adding file changes
160 transaction abort!
161 rollback completed
162 abort: pretxnchangegroup hook exited with status 1
163 [40]
164 $ f -s .hg/store/data/file*
165 .hg/store/data/file.d: size=1046
166 .hg/store/data/file.i: size=128
167 $ hg tip
168 changeset: 1:3ce491143aec
169 tag: tip
170 user: test
171 date: Thu Jan 01 00:00:00 1970 +0000
172 summary: _
173
174 $ hg verify
175 checking changesets
176 checking manifests
177 crosschecking files in changesets and manifests
178 checking files
179 warning: revlog 'data/file.d' not in fncache!
180 checked 2 changesets with 2 changes to 1 files
181 1 warnings encountered!
182 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
183 $ cd ..
184