##// END OF EJS Templates
revlog: show that temporary split file use broken name scheme...
marmoute -
r51706:4ee64ff1 stable
parent child Browse files
Show More
@@ -1,515 +1,519 b''
1 Test correctness of revlog inline -> non-inline transition
1 Test correctness of revlog inline -> non-inline transition
2 ----------------------------------------------------------
2 ----------------------------------------------------------
3
3
4 We test various file length and naming pattern as this created issue in the
4 We test various file length and naming pattern as this created issue in the
5 past.
5 past.
6
6
7 Helper extension to intercept renames and kill process
7 Helper extension to intercept renames and kill process
8
8
9 $ cat > $TESTTMP/intercept_before_rename.py << EOF
9 $ cat > $TESTTMP/intercept_before_rename.py << EOF
10 > import os
10 > import os
11 > import signal
11 > import signal
12 > from mercurial import extensions, util
12 > from mercurial import extensions, util
13 >
13 >
14 > def extsetup(ui):
14 > def extsetup(ui):
15 > def rename(orig, src, dest, *args, **kwargs):
15 > def rename(orig, src, dest, *args, **kwargs):
16 > path = util.normpath(dest)
16 > path = util.normpath(dest)
17 > if path.endswith(b'data/file.i'):
17 > if path.endswith(b'data/file.i'):
18 > os.kill(os.getpid(), signal.SIGKILL)
18 > os.kill(os.getpid(), signal.SIGKILL)
19 > return orig(src, dest, *args, **kwargs)
19 > return orig(src, dest, *args, **kwargs)
20 > extensions.wrapfunction(util, 'rename', rename)
20 > extensions.wrapfunction(util, 'rename', rename)
21 > EOF
21 > EOF
22
22
23 $ cat > $TESTTMP/intercept_after_rename.py << EOF
23 $ cat > $TESTTMP/intercept_after_rename.py << EOF
24 > import os
24 > import os
25 > import signal
25 > import signal
26 > from mercurial import extensions, util
26 > from mercurial import extensions, util
27 >
27 >
28 > def extsetup(ui):
28 > def extsetup(ui):
29 > def close(orig, *args, **kwargs):
29 > def close(orig, *args, **kwargs):
30 > path = util.normpath(args[0]._atomictempfile__name)
30 > path = util.normpath(args[0]._atomictempfile__name)
31 > r = orig(*args, **kwargs)
31 > r = orig(*args, **kwargs)
32 > if path.endswith(b'/.hg/store/data/file.i'):
32 > if path.endswith(b'/.hg/store/data/file.i'):
33 > os.kill(os.getpid(), signal.SIGKILL)
33 > os.kill(os.getpid(), signal.SIGKILL)
34 > return r
34 > return r
35 > extensions.wrapfunction(util.atomictempfile, 'close', close)
35 > extensions.wrapfunction(util.atomictempfile, 'close', close)
36 > def extsetup(ui):
36 > def extsetup(ui):
37 > def rename(orig, src, dest, *args, **kwargs):
37 > def rename(orig, src, dest, *args, **kwargs):
38 > path = util.normpath(dest)
38 > path = util.normpath(dest)
39 > r = orig(src, dest, *args, **kwargs)
39 > r = orig(src, dest, *args, **kwargs)
40 > if path.endswith(b'data/file.i'):
40 > if path.endswith(b'data/file.i'):
41 > os.kill(os.getpid(), signal.SIGKILL)
41 > os.kill(os.getpid(), signal.SIGKILL)
42 > return r
42 > return r
43 > extensions.wrapfunction(util, 'rename', rename)
43 > extensions.wrapfunction(util, 'rename', rename)
44 > EOF
44 > EOF
45
45
46 $ cat > $TESTTMP/killme.py << EOF
46 $ cat > $TESTTMP/killme.py << EOF
47 > import os
47 > import os
48 > import signal
48 > import signal
49 >
49 >
50 > def killme(ui, repo, hooktype, **kwargs):
50 > def killme(ui, repo, hooktype, **kwargs):
51 > os.kill(os.getpid(), signal.SIGKILL)
51 > os.kill(os.getpid(), signal.SIGKILL)
52 > EOF
52 > EOF
53
53
54 $ cat > $TESTTMP/reader_wait_split.py << EOF
54 $ cat > $TESTTMP/reader_wait_split.py << EOF
55 > import os
55 > import os
56 > import signal
56 > import signal
57 > from mercurial import extensions, revlog, testing
57 > from mercurial import extensions, revlog, testing
58 > def _wait_post_load(orig, self, *args, **kwargs):
58 > def _wait_post_load(orig, self, *args, **kwargs):
59 > wait = b'data/file' in self.radix
59 > wait = b'data/file' in self.radix
60 > if wait:
60 > if wait:
61 > testing.wait_file(b"$TESTTMP/writer-revlog-split")
61 > testing.wait_file(b"$TESTTMP/writer-revlog-split")
62 > r = orig(self, *args, **kwargs)
62 > r = orig(self, *args, **kwargs)
63 > if wait:
63 > if wait:
64 > testing.write_file(b"$TESTTMP/reader-index-read")
64 > testing.write_file(b"$TESTTMP/reader-index-read")
65 > testing.wait_file(b"$TESTTMP/writer-revlog-unsplit")
65 > testing.wait_file(b"$TESTTMP/writer-revlog-unsplit")
66 > return r
66 > return r
67 >
67 >
68 > def extsetup(ui):
68 > def extsetup(ui):
69 > extensions.wrapfunction(revlog.revlog, '_loadindex', _wait_post_load)
69 > extensions.wrapfunction(revlog.revlog, '_loadindex', _wait_post_load)
70 > EOF
70 > EOF
71
71
72 setup a repository for tests
72 setup a repository for tests
73 ----------------------------
73 ----------------------------
74
74
75 $ cat >> $HGRCPATH << EOF
75 $ cat >> $HGRCPATH << EOF
76 > [format]
76 > [format]
77 > revlog-compression=none
77 > revlog-compression=none
78 > EOF
78 > EOF
79
79
80 $ hg init troffset-computation
80 $ hg init troffset-computation
81 $ cd troffset-computation
81 $ cd troffset-computation
82 $ files="
82 $ files="
83 > file
83 > file
84 > Directory_With,Special%Char/Complex_File.babar
84 > Directory_With,Special%Char/Complex_File.babar
85 > foo/bar/babar_celeste/foo
85 > foo/bar/babar_celeste/foo
86 > 1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/f
86 > 1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/f
87 > some_dir/sub_dir/foo_bar
87 > some_dir/sub_dir/foo_bar
88 > some_dir/sub_dir/foo_bar.i.s/tutu
88 > some_dir/sub_dir/foo_bar.i.s/tutu
89 > "
89 > "
90 $ for f in $files; do
90 $ for f in $files; do
91 > mkdir -p `dirname $f`
91 > mkdir -p `dirname $f`
92 > done
92 > done
93 $ for f in $files; do
93 $ for f in $files; do
94 > printf '%20d' '1' > $f
94 > printf '%20d' '1' > $f
95 > done
95 > done
96 $ hg commit -Aqma
96 $ hg commit -Aqma
97 $ for f in $files; do
97 $ for f in $files; do
98 > printf '%1024d' '1' > $f
98 > printf '%1024d' '1' > $f
99 > done
99 > done
100 $ hg commit -Aqmb
100 $ hg commit -Aqmb
101 $ for f in $files; do
101 $ for f in $files; do
102 > printf '%20d' '1' > $f
102 > printf '%20d' '1' > $f
103 > done
103 > done
104 $ hg commit -Aqmc
104 $ hg commit -Aqmc
105 $ for f in $files; do
105 $ for f in $files; do
106 > dd if=/dev/zero of=$f bs=1k count=128 > /dev/null 2>&1
106 > dd if=/dev/zero of=$f bs=1k count=128 > /dev/null 2>&1
107 > done
107 > done
108 $ hg commit -AqmD --traceback
108 $ hg commit -AqmD --traceback
109 $ for f in $files; do
109 $ for f in $files; do
110 > dd if=/dev/zero of=$f bs=1k count=132 > /dev/null 2>&1
110 > dd if=/dev/zero of=$f bs=1k count=132 > /dev/null 2>&1
111 > done
111 > done
112 $ hg commit -AqmD --traceback
112 $ hg commit -AqmD --traceback
113
113
114 Reference size:
114 Reference size:
115 $ f -s file
115 $ f -s file
116 file: size=135168
116 file: size=135168
117 $ f -s .hg/store/data*/file*
117 $ f -s .hg/store/data*/file*
118 .hg/store/data/file.d: size=267307
118 .hg/store/data/file.d: size=267307
119 .hg/store/data/file.i: size=320
119 .hg/store/data/file.i: size=320
120
120
121 $ cd ..
121 $ cd ..
122
122
123 Test a succesful pull
123 Test a succesful pull
124 =====================
124 =====================
125
125
126 Make sure everything goes though as expect if we don't do any crash
126 Make sure everything goes though as expect if we don't do any crash
127
127
128 $ hg clone --quiet --rev 1 troffset-computation troffset-success
128 $ hg clone --quiet --rev 1 troffset-computation troffset-success
129 $ cd troffset-success
129 $ cd troffset-success
130
130
131 Reference size:
131 Reference size:
132 $ f -s file
132 $ f -s file
133 file: size=1024
133 file: size=1024
134 $ f -s .hg/store/data/file*
134 $ f -s .hg/store/data/file*
135 .hg/store/data/file.i: size=1174
135 .hg/store/data/file.i: size=1174
136
136
137 $ hg pull ../troffset-computation
137 $ hg pull ../troffset-computation
138 pulling from ../troffset-computation
138 pulling from ../troffset-computation
139 searching for changes
139 searching for changes
140 adding changesets
140 adding changesets
141 adding manifests
141 adding manifests
142 adding file changes
142 adding file changes
143 added 3 changesets with 18 changes to 6 files
143 added 3 changesets with 18 changes to 6 files
144 new changesets c99a94cae9b1:64874a3b0160
144 new changesets c99a94cae9b1:64874a3b0160
145 (run 'hg update' to get a working copy)
145 (run 'hg update' to get a working copy)
146
146
147
147
148 The inline revlog has been replaced
148 The inline revlog has been replaced
149
149
150 $ f -s .hg/store/data/file*
150 $ f -s .hg/store/data/file*
151 .hg/store/data/file.d: size=267307
151 .hg/store/data/file.d: size=267307
152 .hg/store/data/file.i: size=320
152 .hg/store/data/file.i: size=320
153
153
154
154
155 $ hg verify -q
155 $ hg verify -q
156 $ cd ..
156 $ cd ..
157
157
158
158
159 Test a hard crash after the file was split but before the transaction was committed
159 Test a hard crash after the file was split but before the transaction was committed
160 ===================================================================================
160 ===================================================================================
161
161
162 Test offset computation to correctly factor in the index entries themselves.
162 Test offset computation to correctly factor in the index entries themselves.
163 Also test that the new data size has the correct size if the transaction is aborted
163 Also test that the new data size has the correct size if the transaction is aborted
164 after the index has been replaced.
164 after the index has been replaced.
165
165
166 Test repo has commits a, b, c, D, where D is large (grows the revlog enough that it
166 Test repo has commits a, b, c, D, where D is large (grows the revlog enough that it
167 transitions to non-inline storage). The clone initially has changes a, b
167 transitions to non-inline storage). The clone initially has changes a, b
168 and will transition to non-inline storage when adding c, D.
168 and will transition to non-inline storage when adding c, D.
169
169
170 If the transaction adding c, D is rolled back, then we don't undo the revlog split,
170 If the transaction adding c, D is rolled back, then we don't undo the revlog split,
171 but truncate the index and the data to remove both c and D.
171 but truncate the index and the data to remove both c and D.
172
172
173
173
174 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy
174 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy
175 $ cd troffset-computation-copy
175 $ cd troffset-computation-copy
176
176
177 Reference size:
177 Reference size:
178 $ f -s file
178 $ f -s file
179 file: size=1024
179 file: size=1024
180 $ f -s .hg/store/data*/file*
180 $ f -s .hg/store/data*/file*
181 .hg/store/data/file.i: size=1174
181 .hg/store/data/file.i: size=1174
182
182
183 $ cat > .hg/hgrc <<EOF
183 $ cat > .hg/hgrc <<EOF
184 > [hooks]
184 > [hooks]
185 > pretxnchangegroup = python:$TESTTMP/killme.py:killme
185 > pretxnchangegroup = python:$TESTTMP/killme.py:killme
186 > EOF
186 > EOF
187 #if chg
187 #if chg
188 $ hg pull ../troffset-computation
188 $ hg pull ../troffset-computation
189 pulling from ../troffset-computation
189 pulling from ../troffset-computation
190 [255]
190 [255]
191 #else
191 #else
192 $ hg pull ../troffset-computation
192 $ hg pull ../troffset-computation
193 pulling from ../troffset-computation
193 pulling from ../troffset-computation
194 *Killed* (glob)
194 *Killed* (glob)
195 [137]
195 [137]
196 #endif
196 #endif
197
197
198
198
199 The inline revlog still exist, but a split version exist next to it
199 The inline revlog still exist, but a split version exist next to it
200
200
201 $ cat .hg/store/journal | tr '\0' ' ' | grep '\.s'
201 $ cat .hg/store/journal | tr '\0' ' ' | grep '\.s'
202 data/some_dir/sub_dir/foo_bar.i.s/tutu.i 1174
202 data/some_dir/sub_dir/foo_bar.i.s/tutu.i 1174
203 data/some_dir/sub_dir/foo_bar.i.s/tutu.d 0
203 data/some_dir/sub_dir/foo_bar.i.s/tutu.d 0
204 $ f -s .hg/store/data*/file*
204 $ f -s .hg/store/data*/file*
205 .hg/store/data-s/file: size=320
205 .hg/store/data-s/file: size=320
206 .hg/store/data/file.d: size=267307
206 .hg/store/data/file.d: size=267307
207 .hg/store/data/file.i: size=132395
207 .hg/store/data/file.i: size=132395
208 $ f -s .hg/store/data*/foo*/bar*/babar__celeste*/foo*
209 .hg/store/data/foo/bar/babar__celeste-s/foo: size=320
210 .hg/store/data/foo/bar/babar__celeste/foo.d: size=267307
211 .hg/store/data/foo/bar/babar__celeste/foo.i: size=132395
208
212
209
213
210 The first file.i entry should match the "Reference size" above.
214 The first file.i entry should match the "Reference size" above.
211 The first file.d entry is the temporary record during the split,
215 The first file.d entry is the temporary record during the split,
212
216
213 A "temporary file" entry exist for the split index.
217 A "temporary file" entry exist for the split index.
214
218
215 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
219 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
216 data/file.i 1174
220 data/file.i 1174
217 data/file.d 0
221 data/file.d 0
218 $ cat .hg/store/journal.backupfiles | tr -s '\000' ' ' | tr -s '\00' ' '| grep 'data.*/file'
222 $ cat .hg/store/journal.backupfiles | tr -s '\000' ' ' | tr -s '\00' ' '| grep 'data.*/file'
219 data/file.i data/journal.backup.file.i.bck 0
223 data/file.i data/journal.backup.file.i.bck 0
220 data-s/file 0
224 data-s/file 0
221
225
222 recover is rolling the split back, the fncache is still valid
226 recover is rolling the split back, the fncache is still valid
223
227
224 $ hg recover
228 $ hg recover
225 rolling back interrupted transaction
229 rolling back interrupted transaction
226 (verify step skipped, run `hg verify` to check your repository content)
230 (verify step skipped, run `hg verify` to check your repository content)
227 $ f -s .hg/store/data*/file*
231 $ f -s .hg/store/data*/file*
228 .hg/store/data/file.i: size=1174
232 .hg/store/data/file.i: size=1174
229 $ hg tip
233 $ hg tip
230 changeset: 1:64b04c8dc267
234 changeset: 1:64b04c8dc267
231 tag: tip
235 tag: tip
232 user: test
236 user: test
233 date: Thu Jan 01 00:00:00 1970 +0000
237 date: Thu Jan 01 00:00:00 1970 +0000
234 summary: b
238 summary: b
235
239
236 $ hg verify -q
240 $ hg verify -q
237 $ hg debugrebuildfncache --only-data
241 $ hg debugrebuildfncache --only-data
238 fncache already up to date
242 fncache already up to date
239 $ hg verify -q
243 $ hg verify -q
240 $ cd ..
244 $ cd ..
241
245
242 Test a hard crash right before the index is move into place
246 Test a hard crash right before the index is move into place
243 ===========================================================
247 ===========================================================
244
248
245 Now retry the procedure but intercept the rename of the index and check that
249 Now retry the procedure but intercept the rename of the index and check that
246 the journal does not contain the new index size. This demonstrates the edge case
250 the journal does not contain the new index size. This demonstrates the edge case
247 where the data file is left as garbage.
251 where the data file is left as garbage.
248
252
249 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy2
253 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy2
250 $ cd troffset-computation-copy2
254 $ cd troffset-computation-copy2
251
255
252 Reference size:
256 Reference size:
253 $ f -s file
257 $ f -s file
254 file: size=1024
258 file: size=1024
255 $ f -s .hg/store/data*/file*
259 $ f -s .hg/store/data*/file*
256 .hg/store/data/file.i: size=1174
260 .hg/store/data/file.i: size=1174
257
261
258 $ cat > .hg/hgrc <<EOF
262 $ cat > .hg/hgrc <<EOF
259 > [extensions]
263 > [extensions]
260 > intercept_rename = $TESTTMP/intercept_before_rename.py
264 > intercept_rename = $TESTTMP/intercept_before_rename.py
261 > EOF
265 > EOF
262 #if chg
266 #if chg
263 $ hg pull ../troffset-computation
267 $ hg pull ../troffset-computation
264 pulling from ../troffset-computation
268 pulling from ../troffset-computation
265 searching for changes
269 searching for changes
266 adding changesets
270 adding changesets
267 adding manifests
271 adding manifests
268 adding file changes
272 adding file changes
269 [255]
273 [255]
270 #else
274 #else
271 $ hg pull ../troffset-computation
275 $ hg pull ../troffset-computation
272 pulling from ../troffset-computation
276 pulling from ../troffset-computation
273 searching for changes
277 searching for changes
274 adding changesets
278 adding changesets
275 adding manifests
279 adding manifests
276 adding file changes
280 adding file changes
277 *Killed* (glob)
281 *Killed* (glob)
278 [137]
282 [137]
279 #endif
283 #endif
280
284
281 The inline revlog still exist, but a split version exist next to it
285 The inline revlog still exist, but a split version exist next to it
282
286
283 $ f -s .hg/store/data*/file*
287 $ f -s .hg/store/data*/file*
284 .hg/store/data-s/file: size=320
288 .hg/store/data-s/file: size=320
285 .hg/store/data/file.d: size=267307
289 .hg/store/data/file.d: size=267307
286 .hg/store/data/file.i: size=132395
290 .hg/store/data/file.i: size=132395
287
291
288 $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file'
292 $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file'
289 data/file.i 1174
293 data/file.i 1174
290 data/file.d 0
294 data/file.d 0
291
295
292 recover is rolling the split back, the fncache is still valid
296 recover is rolling the split back, the fncache is still valid
293
297
294 $ hg recover
298 $ hg recover
295 rolling back interrupted transaction
299 rolling back interrupted transaction
296 (verify step skipped, run `hg verify` to check your repository content)
300 (verify step skipped, run `hg verify` to check your repository content)
297 $ f -s .hg/store/data*/file*
301 $ f -s .hg/store/data*/file*
298 .hg/store/data/file.i: size=1174
302 .hg/store/data/file.i: size=1174
299 $ hg tip
303 $ hg tip
300 changeset: 1:64b04c8dc267
304 changeset: 1:64b04c8dc267
301 tag: tip
305 tag: tip
302 user: test
306 user: test
303 date: Thu Jan 01 00:00:00 1970 +0000
307 date: Thu Jan 01 00:00:00 1970 +0000
304 summary: b
308 summary: b
305
309
306 $ hg verify -q
310 $ hg verify -q
307 $ cd ..
311 $ cd ..
308
312
309 Test a hard crash right after the index is move into place
313 Test a hard crash right after the index is move into place
310 ===========================================================
314 ===========================================================
311
315
312 Now retry the procedure but intercept the rename of the index.
316 Now retry the procedure but intercept the rename of the index.
313
317
314 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-crash-after-rename
318 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-crash-after-rename
315 $ cd troffset-computation-crash-after-rename
319 $ cd troffset-computation-crash-after-rename
316
320
317 Reference size:
321 Reference size:
318 $ f -s file
322 $ f -s file
319 file: size=1024
323 file: size=1024
320 $ f -s .hg/store/data*/file*
324 $ f -s .hg/store/data*/file*
321 .hg/store/data/file.i: size=1174
325 .hg/store/data/file.i: size=1174
322
326
323 $ cat > .hg/hgrc <<EOF
327 $ cat > .hg/hgrc <<EOF
324 > [extensions]
328 > [extensions]
325 > intercept_rename = $TESTTMP/intercept_after_rename.py
329 > intercept_rename = $TESTTMP/intercept_after_rename.py
326 > EOF
330 > EOF
327 #if chg
331 #if chg
328 $ hg pull ../troffset-computation
332 $ hg pull ../troffset-computation
329 pulling from ../troffset-computation
333 pulling from ../troffset-computation
330 searching for changes
334 searching for changes
331 adding changesets
335 adding changesets
332 adding manifests
336 adding manifests
333 adding file changes
337 adding file changes
334 [255]
338 [255]
335 #else
339 #else
336 $ hg pull ../troffset-computation
340 $ hg pull ../troffset-computation
337 pulling from ../troffset-computation
341 pulling from ../troffset-computation
338 searching for changes
342 searching for changes
339 adding changesets
343 adding changesets
340 adding manifests
344 adding manifests
341 adding file changes
345 adding file changes
342 *Killed* (glob)
346 *Killed* (glob)
343 [137]
347 [137]
344 #endif
348 #endif
345
349
346 The inline revlog was over written on disk
350 The inline revlog was over written on disk
347
351
348 $ f -s .hg/store/data*/file*
352 $ f -s .hg/store/data*/file*
349 .hg/store/data/file.d: size=267307
353 .hg/store/data/file.d: size=267307
350 .hg/store/data/file.i: size=320
354 .hg/store/data/file.i: size=320
351
355
352 $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file'
356 $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file'
353 data/file.i 1174
357 data/file.i 1174
354 data/file.d 0
358 data/file.d 0
355
359
356 recover is rolling the split back, the fncache is still valid
360 recover is rolling the split back, the fncache is still valid
357
361
358 $ hg recover
362 $ hg recover
359 rolling back interrupted transaction
363 rolling back interrupted transaction
360 (verify step skipped, run `hg verify` to check your repository content)
364 (verify step skipped, run `hg verify` to check your repository content)
361 $ f -s .hg/store/data*/file*
365 $ f -s .hg/store/data*/file*
362 .hg/store/data/file.i: size=1174
366 .hg/store/data/file.i: size=1174
363 $ hg tip
367 $ hg tip
364 changeset: 1:64b04c8dc267
368 changeset: 1:64b04c8dc267
365 tag: tip
369 tag: tip
366 user: test
370 user: test
367 date: Thu Jan 01 00:00:00 1970 +0000
371 date: Thu Jan 01 00:00:00 1970 +0000
368 summary: b
372 summary: b
369
373
370 $ hg verify -q
374 $ hg verify -q
371 $ cd ..
375 $ cd ..
372
376
373 Have the transaction rollback itself without any hard crash
377 Have the transaction rollback itself without any hard crash
374 ===========================================================
378 ===========================================================
375
379
376
380
377 Repeat the original test but let hg rollback the transaction.
381 Repeat the original test but let hg rollback the transaction.
378
382
379 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy-rb
383 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy-rb
380 $ cd troffset-computation-copy-rb
384 $ cd troffset-computation-copy-rb
381 $ cat > .hg/hgrc <<EOF
385 $ cat > .hg/hgrc <<EOF
382 > [hooks]
386 > [hooks]
383 > pretxnchangegroup = false
387 > pretxnchangegroup = false
384 > EOF
388 > EOF
385 $ hg pull ../troffset-computation
389 $ hg pull ../troffset-computation
386 pulling from ../troffset-computation
390 pulling from ../troffset-computation
387 searching for changes
391 searching for changes
388 adding changesets
392 adding changesets
389 adding manifests
393 adding manifests
390 adding file changes
394 adding file changes
391 transaction abort!
395 transaction abort!
392 rollback completed
396 rollback completed
393 abort: pretxnchangegroup hook exited with status 1
397 abort: pretxnchangegroup hook exited with status 1
394 [40]
398 [40]
395
399
396 The split was rollback
400 The split was rollback
397
401
398 $ f -s .hg/store/data*/file*
402 $ f -s .hg/store/data*/file*
399 .hg/store/data/file.d: size=0
403 .hg/store/data/file.d: size=0
400 .hg/store/data/file.i: size=1174
404 .hg/store/data/file.i: size=1174
401
405
402 $ hg tip
406 $ hg tip
403 changeset: 1:64b04c8dc267
407 changeset: 1:64b04c8dc267
404 tag: tip
408 tag: tip
405 user: test
409 user: test
406 date: Thu Jan 01 00:00:00 1970 +0000
410 date: Thu Jan 01 00:00:00 1970 +0000
407 summary: b
411 summary: b
408
412
409 $ hg verify -q
413 $ hg verify -q
410
414
411 $ cat > .hg/hgrc <<EOF
415 $ cat > .hg/hgrc <<EOF
412 > [hooks]
416 > [hooks]
413 > EOF
417 > EOF
414 $ hg pull ../troffset-computation
418 $ hg pull ../troffset-computation
415 pulling from ../troffset-computation
419 pulling from ../troffset-computation
416 searching for changes
420 searching for changes
417 adding changesets
421 adding changesets
418 adding manifests
422 adding manifests
419 adding file changes
423 adding file changes
420 added 3 changesets with 18 changes to 6 files
424 added 3 changesets with 18 changes to 6 files
421 new changesets c99a94cae9b1:64874a3b0160
425 new changesets c99a94cae9b1:64874a3b0160
422 (run 'hg update' to get a working copy)
426 (run 'hg update' to get a working copy)
423
427
424 $ f -s .hg/store/data*/file*
428 $ f -s .hg/store/data*/file*
425 .hg/store/data/file.d: size=267307
429 .hg/store/data/file.d: size=267307
426 .hg/store/data/file.i: size=320
430 .hg/store/data/file.i: size=320
427 $ hg verify -q
431 $ hg verify -q
428
432
429 $ cd ..
433 $ cd ..
430
434
431 Read race
435 Read race
432 =========
436 =========
433
437
434 We check that a client that started reading a revlog (its index) after the
438 We check that a client that started reading a revlog (its index) after the
435 split and end reading (the data) after the rollback should be fine
439 split and end reading (the data) after the rollback should be fine
436
440
437 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-race
441 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-race
438 $ cd troffset-computation-race
442 $ cd troffset-computation-race
439 $ cat > .hg/hgrc <<EOF
443 $ cat > .hg/hgrc <<EOF
440 > [hooks]
444 > [hooks]
441 > pretxnchangegroup=$RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/reader-index-read $TESTTMP/writer-revlog-split
445 > pretxnchangegroup=$RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/reader-index-read $TESTTMP/writer-revlog-split
442 > pretxnclose = false
446 > pretxnclose = false
443 > EOF
447 > EOF
444
448
445 start a reader
449 start a reader
446
450
447 $ hg cat --rev 0 file \
451 $ hg cat --rev 0 file \
448 > --config "extensions.wait_read=$TESTTMP/reader_wait_split.py" \
452 > --config "extensions.wait_read=$TESTTMP/reader_wait_split.py" \
449 > 2> $TESTTMP/reader.stderr \
453 > 2> $TESTTMP/reader.stderr \
450 > > $TESTTMP/reader.stdout &
454 > > $TESTTMP/reader.stdout &
451
455
452 Do a failed pull in //
456 Do a failed pull in //
453
457
454 $ hg pull ../troffset-computation
458 $ hg pull ../troffset-computation
455 pulling from ../troffset-computation
459 pulling from ../troffset-computation
456 searching for changes
460 searching for changes
457 adding changesets
461 adding changesets
458 adding manifests
462 adding manifests
459 adding file changes
463 adding file changes
460 transaction abort!
464 transaction abort!
461 rollback completed
465 rollback completed
462 abort: pretxnclose hook exited with status 1
466 abort: pretxnclose hook exited with status 1
463 [40]
467 [40]
464 $ touch $TESTTMP/writer-revlog-unsplit
468 $ touch $TESTTMP/writer-revlog-unsplit
465 $ wait
469 $ wait
466
470
467 The reader should be fine
471 The reader should be fine
468 $ cat $TESTTMP/reader.stderr
472 $ cat $TESTTMP/reader.stderr
469 $ cat $TESTTMP/reader.stdout
473 $ cat $TESTTMP/reader.stdout
470 1 (no-eol)
474 1 (no-eol)
471
475
472 $ hg verify -q
476 $ hg verify -q
473
477
474 $ cd ..
478 $ cd ..
475
479
476 pending hooks
480 pending hooks
477 =============
481 =============
478
482
479 We checks that hooks properly see the inside of the transaction, while other process don't.
483 We checks that hooks properly see the inside of the transaction, while other process don't.
480
484
481 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-hooks
485 $ hg clone --quiet --rev 1 troffset-computation troffset-computation-hooks
482 $ cd troffset-computation-hooks
486 $ cd troffset-computation-hooks
483 $ cat > .hg/hgrc <<EOF
487 $ cat > .hg/hgrc <<EOF
484 > [hooks]
488 > [hooks]
485 > pretxnclose.01-echo = hg cat -r 'max(all())' file | f --size
489 > pretxnclose.01-echo = hg cat -r 'max(all())' file | f --size
486 > pretxnclose.02-echo = $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/hook-done $TESTTMP/hook-tr-ready
490 > pretxnclose.02-echo = $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/hook-done $TESTTMP/hook-tr-ready
487 > pretxnclose.03-abort = false
491 > pretxnclose.03-abort = false
488 > EOF
492 > EOF
489
493
490 $ (
494 $ (
491 > $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/hook-tr-ready;\
495 > $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/hook-tr-ready;\
492 > hg cat -r 'max(all())' file | f --size;\
496 > hg cat -r 'max(all())' file | f --size;\
493 > touch $TESTTMP/hook-done
497 > touch $TESTTMP/hook-done
494 > ) >stdout 2>stderr &
498 > ) >stdout 2>stderr &
495
499
496 $ hg pull ../troffset-computation
500 $ hg pull ../troffset-computation
497 pulling from ../troffset-computation
501 pulling from ../troffset-computation
498 searching for changes
502 searching for changes
499 adding changesets
503 adding changesets
500 adding manifests
504 adding manifests
501 adding file changes
505 adding file changes
502 size=135168
506 size=135168
503 transaction abort!
507 transaction abort!
504 rollback completed
508 rollback completed
505 abort: pretxnclose.03-abort hook exited with status 1
509 abort: pretxnclose.03-abort hook exited with status 1
506 [40]
510 [40]
507
511
508 $ cat stdout
512 $ cat stdout
509 size=1024
513 size=1024
510 $ cat stderr
514 $ cat stderr
511
515
512 $ hg verify -q
516 $ hg verify -q
513
517
514
518
515 $ cd ..
519 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now