##// 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 17 > extensions.wrapfunction(util.atomictempfile, 'close', close)
18 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 21 Also test that the new data size has the correct size if the transaction is aborted
22 22 after the index has been replaced.
23 23
24 Test repo has one small, one moderate and one big change. The clone has
25 the small and moderate change and will transition to non-inline storage when
26 adding the big change.
24 Test repo has commits a, b, c, D, where D is large (grows the revlog enough that it
25 transitions to non-inline storage). The clone initially has changes a, b
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 31 $ hg init troffset-computation --config format.revlog-compression=none
29 32 $ cd troffset-computation
30 33 $ printf '%20d' '1' > file
31 $ hg commit -Aqm_
34 $ hg commit -Aqma
32 35 $ printf '%1024d' '1' > file
33 $ hg commit -Aqm_
36 $ hg commit -Aqmb
37 $ printf '%20d' '1' > file
38 $ hg commit -Aqmc
34 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 42 $ cd ..
37 43
38 44 $ hg clone -r 1 troffset-computation troffset-computation-copy --config format.revlog-compression=none -q
@@ -57,9 +63,9 b' Reference size:'
57 63 [80]
58 64 #endif
59 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 69 The first file.d entry is the temporary record during the split,
64 70 the second entry after the split happened. The sum of the second file.d
65 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 73 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
68 74 data/file.i 1174
69 75 data/file.d 0
70 data/file.d 1046
71 data/file.i 128
76 data/file.d 1067
77 data/file.i 192
72 78 $ hg recover
73 79 rolling back interrupted transaction
74 80 (verify step skipped, run `hg verify` to check your repository content)
75 81 $ f -s .hg/store/data/file*
76 .hg/store/data/file.d: size=1046
77 .hg/store/data/file.i: size=128
82 .hg/store/data/file.d: size=1067
83 .hg/store/data/file.i: size=192
78 84 $ hg tip
79 changeset: 1:3ce491143aec
85 changeset: 1:cfa8d6e60429
80 86 tag: tip
81 87 user: test
82 88 date: Thu Jan 01 00:00:00 1970 +0000
83 summary: _
89 summary: b
84 90
85 91 $ hg verify -q
86 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 97 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
98 2 integrity errors encountered!
99 [1]
89 100 $ hg debugrebuildfncache --only-data
90 101 adding data/file.d
91 102 1 items added, 0 removed from fncache
92 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 110 $ cd ..
94 111
95 112
@@ -117,20 +134,20 b' where the data file is left as garbage.'
117 134 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
118 135 data/file.i 1174
119 136 data/file.d 0
120 data/file.d 1046
137 data/file.d 1067
121 138
122 139 $ hg recover
123 140 rolling back interrupted transaction
124 141 (verify step skipped, run `hg verify` to check your repository content)
125 142 $ f -s .hg/store/data/file*
126 .hg/store/data/file.d: size=1046
143 .hg/store/data/file.d: size=1067
127 144 .hg/store/data/file.i: size=1174
128 145 $ hg tip
129 changeset: 1:3ce491143aec
146 changeset: 1:cfa8d6e60429
130 147 tag: tip
131 148 user: test
132 149 date: Thu Jan 01 00:00:00 1970 +0000
133 summary: _
150 summary: b
134 151
135 152 $ hg verify -q
136 153 $ cd ..
@@ -155,18 +172,23 b' Repeat the original test but let hg roll'
155 172 abort: pretxnchangegroup hook exited with status 1
156 173 [40]
157 174 $ f -s .hg/store/data/file*
158 .hg/store/data/file.d: size=1046
159 .hg/store/data/file.i: size=128
175 .hg/store/data/file.d: size=1067
176 .hg/store/data/file.i: size=192
160 177 $ hg tip
161 changeset: 1:3ce491143aec
178 changeset: 1:cfa8d6e60429
162 179 tag: tip
163 180 user: test
164 181 date: Thu Jan 01 00:00:00 1970 +0000
165 summary: _
182 summary: b
166 183
167 184 $ hg verify -q
168 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 190 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
191 2 integrity errors encountered!
192 [1]
171 193 $ cd ..
172 194
General Comments 0
You need to be logged in to leave comments. Login now