##// END OF EJS Templates
revlog: demonstrate a bug where transaction can be aborted partially...
Arseniy Alekseyev -
r49422:f38ae2d7 stable
parent child Browse files
Show More
@@ -17,22 +17,28 b' Helper extension to intercept renames.'
17 > extensions.wrapfunction(util.atomictempfile, 'close', close)
17 > extensions.wrapfunction(util.atomictempfile, 'close', close)
18 > EOF
18 > EOF
19
19
20 Test offset computation to correctly factor in the index entries themselve.
20 Test offset computation to correctly factor in the index entries themselves.
21 Also test that the new data size has the correct size if the transaction is aborted
21 Also test that the new data size has the correct size if the transaction is aborted
22 after the index has been replaced.
22 after the index has been replaced.
23
23
24 Test repo has one small, one moderate and one big change. The clone has
24 Test repo has commits a, b, c, D, where D is large (grows the revlog enough that it
25 the small and moderate change and will transition to non-inline storage when
25 transitions to non-inline storage). The clone initially has changes a, b
26 adding the big change.
26 and will transition to non-inline storage when adding c, D.
27
28 If the transaction adding c, D is rolled back, then we don't undo the revlog split,
29 but truncate the index and the data to remove both c and D.
27
30
28 $ hg init troffset-computation --config format.revlog-compression=none
31 $ hg init troffset-computation --config format.revlog-compression=none
29 $ cd troffset-computation
32 $ cd troffset-computation
30 $ printf '%20d' '1' > file
33 $ printf '%20d' '1' > file
31 $ hg commit -Aqm_
34 $ hg commit -Aqma
32 $ printf '%1024d' '1' > file
35 $ printf '%1024d' '1' > file
33 $ hg commit -Aqm_
36 $ hg commit -Aqmb
37 $ printf '%20d' '1' > file
38 $ hg commit -Aqmc
34 $ dd if=/dev/zero of=file bs=1k count=128 > /dev/null 2>&1
39 $ dd if=/dev/zero of=file bs=1k count=128 > /dev/null 2>&1
35 $ hg commit -Aqm_
40 $ hg commit -AqmD
41
36 $ cd ..
42 $ cd ..
37
43
38 $ hg clone -r 1 troffset-computation troffset-computation-copy --config format.revlog-compression=none -q
44 $ hg clone -r 1 troffset-computation troffset-computation-copy --config format.revlog-compression=none -q
@@ -57,9 +63,9 b' Reference size:'
57 [80]
63 [80]
58 #endif
64 #endif
59 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file | tail -1
65 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file | tail -1
60 data/file.i 128
66 data/file.i 192
61
67
62 The first file.i entry should match the size above.
68 The first file.i entry should match the "Reference size" above.
63 The first file.d entry is the temporary record during the split,
69 The first file.d entry is the temporary record during the split,
64 the second entry after the split happened. The sum of the second file.d
70 the second entry after the split happened. The sum of the second file.d
65 and the second file.i entry should match the first file.i entry.
71 and the second file.i entry should match the first file.i entry.
@@ -67,29 +73,40 b' and the second file.i entry should match'
67 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
73 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
68 data/file.i 1174
74 data/file.i 1174
69 data/file.d 0
75 data/file.d 0
70 data/file.d 1046
76 data/file.d 1067
71 data/file.i 128
77 data/file.i 192
72 $ hg recover
78 $ hg recover
73 rolling back interrupted transaction
79 rolling back interrupted transaction
74 (verify step skipped, run `hg verify` to check your repository content)
80 (verify step skipped, run `hg verify` to check your repository content)
75 $ f -s .hg/store/data/file*
81 $ f -s .hg/store/data/file*
76 .hg/store/data/file.d: size=1046
82 .hg/store/data/file.d: size=1067
77 .hg/store/data/file.i: size=128
83 .hg/store/data/file.i: size=192
78 $ hg tip
84 $ hg tip
79 changeset: 1:3ce491143aec
85 changeset: 1:cfa8d6e60429
80 tag: tip
86 tag: tip
81 user: test
87 user: test
82 date: Thu Jan 01 00:00:00 1970 +0000
88 date: Thu Jan 01 00:00:00 1970 +0000
83 summary: _
89 summary: b
84
90
85 $ hg verify -q
91 $ hg verify -q
86 warning: revlog 'data/file.d' not in fncache!
92 warning: revlog 'data/file.d' not in fncache!
87 1 warnings encountered!
93 file@?: rev 2 points to nonexistent changeset 2
94 (expected )
95 file@?: fa1120531cc1 not in manifests
96 2 warnings encountered!
88 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
97 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
98 2 integrity errors encountered!
99 [1]
89 $ hg debugrebuildfncache --only-data
100 $ hg debugrebuildfncache --only-data
90 adding data/file.d
101 adding data/file.d
91 1 items added, 0 removed from fncache
102 1 items added, 0 removed from fncache
92 $ hg verify -q
103 $ hg verify -q
104 file@?: rev 2 points to nonexistent changeset 2
105 (expected )
106 file@?: fa1120531cc1 not in manifests
107 1 warnings encountered!
108 2 integrity errors encountered!
109 [1]
93 $ cd ..
110 $ cd ..
94
111
95
112
@@ -117,20 +134,20 b' where the data file is left as garbage.'
117 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
134 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
118 data/file.i 1174
135 data/file.i 1174
119 data/file.d 0
136 data/file.d 0
120 data/file.d 1046
137 data/file.d 1067
121
138
122 $ hg recover
139 $ hg recover
123 rolling back interrupted transaction
140 rolling back interrupted transaction
124 (verify step skipped, run `hg verify` to check your repository content)
141 (verify step skipped, run `hg verify` to check your repository content)
125 $ f -s .hg/store/data/file*
142 $ f -s .hg/store/data/file*
126 .hg/store/data/file.d: size=1046
143 .hg/store/data/file.d: size=1067
127 .hg/store/data/file.i: size=1174
144 .hg/store/data/file.i: size=1174
128 $ hg tip
145 $ hg tip
129 changeset: 1:3ce491143aec
146 changeset: 1:cfa8d6e60429
130 tag: tip
147 tag: tip
131 user: test
148 user: test
132 date: Thu Jan 01 00:00:00 1970 +0000
149 date: Thu Jan 01 00:00:00 1970 +0000
133 summary: _
150 summary: b
134
151
135 $ hg verify -q
152 $ hg verify -q
136 $ cd ..
153 $ cd ..
@@ -155,18 +172,23 b' Repeat the original test but let hg roll'
155 abort: pretxnchangegroup hook exited with status 1
172 abort: pretxnchangegroup hook exited with status 1
156 [40]
173 [40]
157 $ f -s .hg/store/data/file*
174 $ f -s .hg/store/data/file*
158 .hg/store/data/file.d: size=1046
175 .hg/store/data/file.d: size=1067
159 .hg/store/data/file.i: size=128
176 .hg/store/data/file.i: size=192
160 $ hg tip
177 $ hg tip
161 changeset: 1:3ce491143aec
178 changeset: 1:cfa8d6e60429
162 tag: tip
179 tag: tip
163 user: test
180 user: test
164 date: Thu Jan 01 00:00:00 1970 +0000
181 date: Thu Jan 01 00:00:00 1970 +0000
165 summary: _
182 summary: b
166
183
167 $ hg verify -q
184 $ hg verify -q
168 warning: revlog 'data/file.d' not in fncache!
185 warning: revlog 'data/file.d' not in fncache!
169 1 warnings encountered!
186 file@?: rev 2 points to nonexistent changeset 2
187 (expected )
188 file@?: fa1120531cc1 not in manifests
189 2 warnings encountered!
170 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
190 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
191 2 integrity errors encountered!
192 [1]
171 $ cd ..
193 $ cd ..
172
194
General Comments 0
You need to be logged in to leave comments. Login now