Show More
@@ -1,518 +1,518 | |||||
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 | > from mercurial import extensions, util |
|
11 | > from mercurial import extensions, util | |
12 | > from mercurial.testing import ps_util |
|
12 | > from mercurial.testing import ps_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 | > ps_util.kill(os.getpid()) |
|
18 | > ps_util.kill(os.getpid()) | |
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 | > from mercurial import extensions, util |
|
25 | > from mercurial import extensions, util | |
26 | > from mercurial.testing import ps_util |
|
26 | > from mercurial.testing import ps_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 | > ps_util.kill(os.getpid()) |
|
33 | > ps_util.kill(os.getpid()) | |
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 | > ps_util.kill(os.getpid()) |
|
41 | > ps_util.kill(os.getpid()) | |
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 | > from mercurial.testing import ps_util |
|
48 | > from mercurial.testing import ps_util | |
49 | > |
|
49 | > | |
50 | > def killme(ui, repo, hooktype, **kwargs): |
|
50 | > def killme(ui, repo, hooktype, **kwargs): | |
51 | > ps_util.kill(os.getpid()) |
|
51 | > ps_util.kill(os.getpid()) | |
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_FORWARD_SLASH/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_FORWARD_SLASH/reader-index-read") | |
65 | > testing.wait_file(b"$TESTTMP/writer-revlog-unsplit") |
|
65 | > testing.wait_file(b"$TESTTMP_FORWARD_SLASH/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.i: size=320 |
|
205 | .hg/store/data-s/file.i: 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* |
|
208 | $ f -s .hg/store/data*/foo*/bar*/babar__celeste*/foo* | |
209 | .hg/store/data-s/foo/bar/babar__celeste/foo.i: size=320 |
|
209 | .hg/store/data-s/foo/bar/babar__celeste/foo.i: size=320 | |
210 | .hg/store/data/foo/bar/babar__celeste/foo.d: size=267307 |
|
210 | .hg/store/data/foo/bar/babar__celeste/foo.d: size=267307 | |
211 | .hg/store/data/foo/bar/babar__celeste/foo.i: size=132395 |
|
211 | .hg/store/data/foo/bar/babar__celeste/foo.i: size=132395 | |
212 |
|
212 | |||
213 |
|
213 | |||
214 | The first file.i entry should match the "Reference size" above. |
|
214 | The first file.i entry should match the "Reference size" above. | |
215 | 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, | |
216 |
|
216 | |||
217 | A "temporary file" entry exist for the split index. |
|
217 | A "temporary file" entry exist for the split index. | |
218 |
|
218 | |||
219 | $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file |
|
219 | $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file | |
220 | data/file.i 1174 |
|
220 | data/file.i 1174 | |
221 | data/file.d 0 |
|
221 | data/file.d 0 | |
222 | $ 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' | |
223 | data/file.i data/journal.backup.file.i.bck 0 |
|
223 | data/file.i data/journal.backup.file.i.bck 0 | |
224 | data-s/file.i 0 |
|
224 | data-s/file.i 0 | |
225 |
|
225 | |||
226 | recover is rolling the split back, the fncache is still valid |
|
226 | recover is rolling the split back, the fncache is still valid | |
227 |
|
227 | |||
228 | $ hg recover |
|
228 | $ hg recover | |
229 | rolling back interrupted transaction |
|
229 | rolling back interrupted transaction | |
230 | (verify step skipped, run `hg verify` to check your repository content) |
|
230 | (verify step skipped, run `hg verify` to check your repository content) | |
231 | $ f -s .hg/store/data*/file* |
|
231 | $ f -s .hg/store/data*/file* | |
232 | .hg/store/data/file.i: size=1174 |
|
232 | .hg/store/data/file.i: size=1174 | |
233 | $ hg tip |
|
233 | $ hg tip | |
234 | changeset: 1:64b04c8dc267 |
|
234 | changeset: 1:64b04c8dc267 | |
235 | tag: tip |
|
235 | tag: tip | |
236 | user: test |
|
236 | user: test | |
237 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
237 | date: Thu Jan 01 00:00:00 1970 +0000 | |
238 | summary: b |
|
238 | summary: b | |
239 |
|
239 | |||
240 | $ hg verify -q |
|
240 | $ hg verify -q | |
241 | $ hg debugrebuildfncache --only-data |
|
241 | $ hg debugrebuildfncache --only-data | |
242 | fncache already up to date |
|
242 | fncache already up to date | |
243 | $ hg verify -q |
|
243 | $ hg verify -q | |
244 | $ cd .. |
|
244 | $ cd .. | |
245 |
|
245 | |||
246 | 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 | |
247 | =========================================================== |
|
247 | =========================================================== | |
248 |
|
248 | |||
249 | 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 | |
250 | 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 | |
251 | where the data file is left as garbage. |
|
251 | where the data file is left as garbage. | |
252 |
|
252 | |||
253 | $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy2 |
|
253 | $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy2 | |
254 | $ cd troffset-computation-copy2 |
|
254 | $ cd troffset-computation-copy2 | |
255 |
|
255 | |||
256 | Reference size: |
|
256 | Reference size: | |
257 | $ f -s file |
|
257 | $ f -s file | |
258 | file: size=1024 |
|
258 | file: size=1024 | |
259 | $ f -s .hg/store/data*/file* |
|
259 | $ f -s .hg/store/data*/file* | |
260 | .hg/store/data/file.i: size=1174 |
|
260 | .hg/store/data/file.i: size=1174 | |
261 |
|
261 | |||
262 | $ cat > .hg/hgrc <<EOF |
|
262 | $ cat > .hg/hgrc <<EOF | |
263 | > [extensions] |
|
263 | > [extensions] | |
264 | > intercept_rename = $TESTTMP/intercept_before_rename.py |
|
264 | > intercept_rename = $TESTTMP/intercept_before_rename.py | |
265 | > EOF |
|
265 | > EOF | |
266 | #if chg |
|
266 | #if chg | |
267 | $ hg pull ../troffset-computation |
|
267 | $ hg pull ../troffset-computation | |
268 | pulling from ../troffset-computation |
|
268 | pulling from ../troffset-computation | |
269 | searching for changes |
|
269 | searching for changes | |
270 | adding changesets |
|
270 | adding changesets | |
271 | adding manifests |
|
271 | adding manifests | |
272 | adding file changes |
|
272 | adding file changes | |
273 | [255] |
|
273 | [255] | |
274 | #else |
|
274 | #else | |
275 | $ hg pull ../troffset-computation |
|
275 | $ hg pull ../troffset-computation | |
276 | pulling from ../troffset-computation |
|
276 | pulling from ../troffset-computation | |
277 | searching for changes |
|
277 | searching for changes | |
278 | adding changesets |
|
278 | adding changesets | |
279 | adding manifests |
|
279 | adding manifests | |
280 | adding file changes |
|
280 | adding file changes | |
281 | *Killed* (glob) |
|
281 | *Killed* (glob) | |
282 | [137] |
|
282 | [137] | |
283 | #endif |
|
283 | #endif | |
284 |
|
284 | |||
285 | 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 | |
286 |
|
286 | |||
287 | $ f -s .hg/store/data*/file* |
|
287 | $ f -s .hg/store/data*/file* | |
288 | .hg/store/data-s/file.i: size=320 |
|
288 | .hg/store/data-s/file.i: size=320 | |
289 | .hg/store/data/file.d: size=267307 |
|
289 | .hg/store/data/file.d: size=267307 | |
290 | .hg/store/data/file.i: size=132395 |
|
290 | .hg/store/data/file.i: size=132395 | |
291 |
|
291 | |||
292 | $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file' |
|
292 | $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file' | |
293 | data/file.i 1174 |
|
293 | data/file.i 1174 | |
294 | data/file.d 0 |
|
294 | data/file.d 0 | |
295 |
|
295 | |||
296 | recover is rolling the split back, the fncache is still valid |
|
296 | recover is rolling the split back, the fncache is still valid | |
297 |
|
297 | |||
298 | $ hg recover |
|
298 | $ hg recover | |
299 | rolling back interrupted transaction |
|
299 | rolling back interrupted transaction | |
300 | (verify step skipped, run `hg verify` to check your repository content) |
|
300 | (verify step skipped, run `hg verify` to check your repository content) | |
301 | $ f -s .hg/store/data*/file* |
|
301 | $ f -s .hg/store/data*/file* | |
302 | .hg/store/data/file.i: size=1174 |
|
302 | .hg/store/data/file.i: size=1174 | |
303 | $ hg tip |
|
303 | $ hg tip | |
304 | changeset: 1:64b04c8dc267 |
|
304 | changeset: 1:64b04c8dc267 | |
305 | tag: tip |
|
305 | tag: tip | |
306 | user: test |
|
306 | user: test | |
307 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
307 | date: Thu Jan 01 00:00:00 1970 +0000 | |
308 | summary: b |
|
308 | summary: b | |
309 |
|
309 | |||
310 | $ hg verify -q |
|
310 | $ hg verify -q | |
311 | $ cd .. |
|
311 | $ cd .. | |
312 |
|
312 | |||
313 | 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 | |
314 | =========================================================== |
|
314 | =========================================================== | |
315 |
|
315 | |||
316 | Now retry the procedure but intercept the rename of the index. |
|
316 | Now retry the procedure but intercept the rename of the index. | |
317 |
|
317 | |||
318 | $ 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 | |
319 | $ cd troffset-computation-crash-after-rename |
|
319 | $ cd troffset-computation-crash-after-rename | |
320 |
|
320 | |||
321 | Reference size: |
|
321 | Reference size: | |
322 | $ f -s file |
|
322 | $ f -s file | |
323 | file: size=1024 |
|
323 | file: size=1024 | |
324 | $ f -s .hg/store/data*/file* |
|
324 | $ f -s .hg/store/data*/file* | |
325 | .hg/store/data/file.i: size=1174 |
|
325 | .hg/store/data/file.i: size=1174 | |
326 |
|
326 | |||
327 | $ cat > .hg/hgrc <<EOF |
|
327 | $ cat > .hg/hgrc <<EOF | |
328 | > [extensions] |
|
328 | > [extensions] | |
329 | > intercept_rename = $TESTTMP/intercept_after_rename.py |
|
329 | > intercept_rename = $TESTTMP/intercept_after_rename.py | |
330 | > EOF |
|
330 | > EOF | |
331 | #if chg |
|
331 | #if chg | |
332 | $ hg pull ../troffset-computation |
|
332 | $ hg pull ../troffset-computation | |
333 | pulling from ../troffset-computation |
|
333 | pulling from ../troffset-computation | |
334 | searching for changes |
|
334 | searching for changes | |
335 | adding changesets |
|
335 | adding changesets | |
336 | adding manifests |
|
336 | adding manifests | |
337 | adding file changes |
|
337 | adding file changes | |
338 | [255] |
|
338 | [255] | |
339 | #else |
|
339 | #else | |
340 | $ hg pull ../troffset-computation |
|
340 | $ hg pull ../troffset-computation | |
341 | pulling from ../troffset-computation |
|
341 | pulling from ../troffset-computation | |
342 | searching for changes |
|
342 | searching for changes | |
343 | adding changesets |
|
343 | adding changesets | |
344 | adding manifests |
|
344 | adding manifests | |
345 | adding file changes |
|
345 | adding file changes | |
346 | *Killed* (glob) |
|
346 | *Killed* (glob) | |
347 | [137] |
|
347 | [137] | |
348 | #endif |
|
348 | #endif | |
349 |
|
349 | |||
350 | The inline revlog was over written on disk |
|
350 | The inline revlog was over written on disk | |
351 |
|
351 | |||
352 | $ f -s .hg/store/data*/file* |
|
352 | $ f -s .hg/store/data*/file* | |
353 | .hg/store/data/file.d: size=267307 |
|
353 | .hg/store/data/file.d: size=267307 | |
354 | .hg/store/data/file.i: size=320 |
|
354 | .hg/store/data/file.i: size=320 | |
355 |
|
355 | |||
356 | $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file' |
|
356 | $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file' | |
357 | data/file.i 1174 |
|
357 | data/file.i 1174 | |
358 | data/file.d 0 |
|
358 | data/file.d 0 | |
359 |
|
359 | |||
360 | recover is rolling the split back, the fncache is still valid |
|
360 | recover is rolling the split back, the fncache is still valid | |
361 |
|
361 | |||
362 | $ hg recover |
|
362 | $ hg recover | |
363 | rolling back interrupted transaction |
|
363 | rolling back interrupted transaction | |
364 | (verify step skipped, run `hg verify` to check your repository content) |
|
364 | (verify step skipped, run `hg verify` to check your repository content) | |
365 | $ f -s .hg/store/data*/file* |
|
365 | $ f -s .hg/store/data*/file* | |
366 | .hg/store/data/file.i: size=1174 |
|
366 | .hg/store/data/file.i: size=1174 | |
367 | $ hg tip |
|
367 | $ hg tip | |
368 | changeset: 1:64b04c8dc267 |
|
368 | changeset: 1:64b04c8dc267 | |
369 | tag: tip |
|
369 | tag: tip | |
370 | user: test |
|
370 | user: test | |
371 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
371 | date: Thu Jan 01 00:00:00 1970 +0000 | |
372 | summary: b |
|
372 | summary: b | |
373 |
|
373 | |||
374 | $ hg verify -q |
|
374 | $ hg verify -q | |
375 | $ cd .. |
|
375 | $ cd .. | |
376 |
|
376 | |||
377 | Have the transaction rollback itself without any hard crash |
|
377 | Have the transaction rollback itself without any hard crash | |
378 | =========================================================== |
|
378 | =========================================================== | |
379 |
|
379 | |||
380 |
|
380 | |||
381 | Repeat the original test but let hg rollback the transaction. |
|
381 | Repeat the original test but let hg rollback the transaction. | |
382 |
|
382 | |||
383 | $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy-rb |
|
383 | $ hg clone --quiet --rev 1 troffset-computation troffset-computation-copy-rb | |
384 | $ cd troffset-computation-copy-rb |
|
384 | $ cd troffset-computation-copy-rb | |
385 | $ cat > .hg/hgrc <<EOF |
|
385 | $ cat > .hg/hgrc <<EOF | |
386 | > [hooks] |
|
386 | > [hooks] | |
387 | > pretxnchangegroup = false |
|
387 | > pretxnchangegroup = false | |
388 | > EOF |
|
388 | > EOF | |
389 | $ hg pull ../troffset-computation |
|
389 | $ hg pull ../troffset-computation | |
390 | pulling from ../troffset-computation |
|
390 | pulling from ../troffset-computation | |
391 | searching for changes |
|
391 | searching for changes | |
392 | adding changesets |
|
392 | adding changesets | |
393 | adding manifests |
|
393 | adding manifests | |
394 | adding file changes |
|
394 | adding file changes | |
395 | transaction abort! |
|
395 | transaction abort! | |
396 | rollback completed |
|
396 | rollback completed | |
397 | abort: pretxnchangegroup hook exited with status 1 |
|
397 | abort: pretxnchangegroup hook exited with status 1 | |
398 | [40] |
|
398 | [40] | |
399 |
|
399 | |||
400 | The split was rollback |
|
400 | The split was rollback | |
401 |
|
401 | |||
402 | $ f -s .hg/store/data*/file* |
|
402 | $ f -s .hg/store/data*/file* | |
403 | .hg/store/data/file.i: size=1174 |
|
403 | .hg/store/data/file.i: size=1174 | |
404 |
|
404 | |||
405 | $ hg tip |
|
405 | $ hg tip | |
406 | changeset: 1:64b04c8dc267 |
|
406 | changeset: 1:64b04c8dc267 | |
407 | tag: tip |
|
407 | tag: tip | |
408 | user: test |
|
408 | user: test | |
409 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
409 | date: Thu Jan 01 00:00:00 1970 +0000 | |
410 | summary: b |
|
410 | summary: b | |
411 |
|
411 | |||
412 | $ hg verify -q |
|
412 | $ hg verify -q | |
413 |
|
413 | |||
414 | $ cat > .hg/hgrc <<EOF |
|
414 | $ cat > .hg/hgrc <<EOF | |
415 | > [hooks] |
|
415 | > [hooks] | |
416 | > EOF |
|
416 | > EOF | |
417 | $ hg pull ../troffset-computation |
|
417 | $ hg pull ../troffset-computation | |
418 | pulling from ../troffset-computation |
|
418 | pulling from ../troffset-computation | |
419 | searching for changes |
|
419 | searching for changes | |
420 | adding changesets |
|
420 | adding changesets | |
421 | adding manifests |
|
421 | adding manifests | |
422 | adding file changes |
|
422 | adding file changes | |
423 | added 3 changesets with 18 changes to 6 files |
|
423 | added 3 changesets with 18 changes to 6 files | |
424 | new changesets c99a94cae9b1:64874a3b0160 |
|
424 | new changesets c99a94cae9b1:64874a3b0160 | |
425 | (run 'hg update' to get a working copy) |
|
425 | (run 'hg update' to get a working copy) | |
426 |
|
426 | |||
427 | $ f -s .hg/store/data*/file* |
|
427 | $ f -s .hg/store/data*/file* | |
428 | .hg/store/data/file.d: size=267307 |
|
428 | .hg/store/data/file.d: size=267307 | |
429 | .hg/store/data/file.i: size=320 |
|
429 | .hg/store/data/file.i: size=320 | |
430 | $ hg verify -q |
|
430 | $ hg verify -q | |
431 |
|
431 | |||
432 | $ cd .. |
|
432 | $ cd .. | |
433 |
|
433 | |||
434 | Read race |
|
434 | Read race | |
435 | ========= |
|
435 | ========= | |
436 |
|
436 | |||
437 | We check that a client that started reading a revlog (its index) after the |
|
437 | We check that a client that started reading a revlog (its index) after the | |
438 | split and end reading (the data) after the rollback should be fine |
|
438 | split and end reading (the data) after the rollback should be fine | |
439 |
|
439 | |||
440 | $ hg clone --quiet --rev 1 troffset-computation troffset-computation-race |
|
440 | $ hg clone --quiet --rev 1 troffset-computation troffset-computation-race | |
441 | $ cd troffset-computation-race |
|
441 | $ cd troffset-computation-race | |
442 | $ cat > .hg/hgrc <<EOF |
|
442 | $ cat > .hg/hgrc <<EOF | |
443 | > [hooks] |
|
443 | > [hooks] | |
444 |
> pretxnchangegroup= |
|
444 | > pretxnchangegroup=sh "$RUNTESTDIR/testlib/wait-on-file" 5 $TESTTMP/reader-index-read $TESTTMP/writer-revlog-split | |
445 | > pretxnclose = false |
|
445 | > pretxnclose = false | |
446 | > EOF |
|
446 | > EOF | |
447 |
|
447 | |||
448 | start a reader |
|
448 | start a reader | |
449 |
|
449 | |||
450 | $ hg cat --rev 0 file \ |
|
450 | $ hg cat --rev 0 file \ | |
451 | > --config "extensions.wait_read=$TESTTMP/reader_wait_split.py" \ |
|
451 | > --config "extensions.wait_read=$TESTTMP/reader_wait_split.py" \ | |
452 | > 2> $TESTTMP/reader.stderr \ |
|
452 | > 2> $TESTTMP/reader.stderr \ | |
453 | > > $TESTTMP/reader.stdout & |
|
453 | > > $TESTTMP/reader.stdout & | |
454 |
|
454 | |||
455 | Do a failed pull in // |
|
455 | Do a failed pull in // | |
456 |
|
456 | |||
457 | $ hg pull ../troffset-computation |
|
457 | $ hg pull ../troffset-computation | |
458 | pulling from ../troffset-computation |
|
458 | pulling from ../troffset-computation | |
459 | searching for changes |
|
459 | searching for changes | |
460 | adding changesets |
|
460 | adding changesets | |
461 | adding manifests |
|
461 | adding manifests | |
462 | adding file changes |
|
462 | adding file changes | |
463 | transaction abort! |
|
463 | transaction abort! | |
464 | rollback completed |
|
464 | rollback completed | |
465 | abort: pretxnclose hook exited with status 1 |
|
465 | abort: pretxnclose hook exited with status 1 | |
466 | [40] |
|
466 | [40] | |
467 | $ touch $TESTTMP/writer-revlog-unsplit |
|
467 | $ touch $TESTTMP/writer-revlog-unsplit | |
468 | $ wait |
|
468 | $ wait | |
469 |
|
469 | |||
470 | The reader should be fine |
|
470 | The reader should be fine | |
471 | $ cat $TESTTMP/reader.stderr |
|
471 | $ cat $TESTTMP/reader.stderr | |
472 | $ cat $TESTTMP/reader.stdout |
|
472 | $ cat $TESTTMP/reader.stdout | |
473 | 1 (no-eol) |
|
473 | 1 (no-eol) | |
474 |
|
474 | |||
475 | $ hg verify -q |
|
475 | $ hg verify -q | |
476 |
|
476 | |||
477 | $ cd .. |
|
477 | $ cd .. | |
478 |
|
478 | |||
479 | pending hooks |
|
479 | pending hooks | |
480 | ============= |
|
480 | ============= | |
481 |
|
481 | |||
482 | We checks that hooks properly see the inside of the transaction, while other process don't. |
|
482 | We checks that hooks properly see the inside of the transaction, while other process don't. | |
483 |
|
483 | |||
484 | $ hg clone --quiet --rev 1 troffset-computation troffset-computation-hooks |
|
484 | $ hg clone --quiet --rev 1 troffset-computation troffset-computation-hooks | |
485 | $ cd troffset-computation-hooks |
|
485 | $ cd troffset-computation-hooks | |
486 | $ cat > .hg/hgrc <<EOF |
|
486 | $ cat > .hg/hgrc <<EOF | |
487 | > [hooks] |
|
487 | > [hooks] | |
488 |
> pretxnclose.01-echo = hg cat -r |
|
488 | > pretxnclose.01-echo = hg cat -r "max(all())" file | "$PYTHON" "$RUNTESTDIR/f" --size | |
489 |
> pretxnclose.02-echo = |
|
489 | > pretxnclose.02-echo = sh "$RUNTESTDIR/testlib/wait-on-file" 5 $TESTTMP/hook-done $TESTTMP/hook-tr-ready | |
490 | > pretxnclose.03-abort = false |
|
490 | > pretxnclose.03-abort = false | |
491 | > EOF |
|
491 | > EOF | |
492 |
|
492 | |||
493 | $ ( |
|
493 | $ ( | |
494 | > $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/hook-tr-ready;\ |
|
494 | > $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/hook-tr-ready;\ | |
495 | > hg cat -r 'max(all())' file | f --size;\ |
|
495 | > hg cat -r 'max(all())' file | f --size;\ | |
496 | > touch $TESTTMP/hook-done |
|
496 | > touch $TESTTMP/hook-done | |
497 | > ) >stdout 2>stderr & |
|
497 | > ) >stdout 2>stderr & | |
498 |
|
498 | |||
499 | $ hg pull ../troffset-computation |
|
499 | $ hg pull ../troffset-computation | |
500 | pulling from ../troffset-computation |
|
500 | pulling from ../troffset-computation | |
501 | searching for changes |
|
501 | searching for changes | |
502 | adding changesets |
|
502 | adding changesets | |
503 | adding manifests |
|
503 | adding manifests | |
504 | adding file changes |
|
504 | adding file changes | |
505 | size=135168 |
|
505 | size=135168 | |
506 | transaction abort! |
|
506 | transaction abort! | |
507 | rollback completed |
|
507 | rollback completed | |
508 | abort: pretxnclose.03-abort hook exited with status 1 |
|
508 | abort: pretxnclose.03-abort hook exited with status 1 | |
509 | [40] |
|
509 | [40] | |
510 |
|
510 | |||
511 | $ cat stdout |
|
511 | $ cat stdout | |
512 | size=1024 |
|
512 | size=1024 | |
513 | $ cat stderr |
|
513 | $ cat stderr | |
514 |
|
514 | |||
515 | $ hg verify -q |
|
515 | $ hg verify -q | |
516 |
|
516 | |||
517 |
|
517 | |||
518 | $ cd .. |
|
518 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now