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