##// END OF EJS Templates
test-transaction-safety: glog out irrelevant flag...
marmoute -
r52073:2e0b2a38 default
parent child Browse files
Show More
@@ -1,287 +1,287 b''
1 1 Test transaction safety
2 2 =======================
3 3
4 4 #testcases revlogv1 revlogv2 changelogv2
5 5
6 6 #if revlogv1
7 7
8 8 $ cat << EOF >> $HGRCPATH
9 9 > [experimental]
10 10 > revlogv2=no
11 11 > EOF
12 12
13 13 #endif
14 14
15 15 #if revlogv2
16 16
17 17 $ cat << EOF >> $HGRCPATH
18 18 > [experimental]
19 19 > revlogv2=enable-unstable-format-and-corrupt-my-data
20 20 > EOF
21 21
22 22 #endif
23 23
24 24 #if changelogv2
25 25
26 26 $ cat << EOF >> $HGRCPATH
27 27 > [format]
28 28 > exp-use-changelog-v2=enable-unstable-format-and-corrupt-my-data
29 29 > EOF
30 30
31 31 #endif
32 32
33 33 This test basic case to make sure external process do not see transaction
34 34 content until it is committed.
35 35
36 36 # TODO: also add an external reader accessing revlog files while they are written
37 37 # (instead of during transaction finalisation)
38 38
39 39 # TODO: also add stream clone and hardlink clone happening during these transaction.
40 40
41 41 setup
42 42 -----
43 43
44 44 synchronisation+output script using the following schedule:
45 45
46 46 [A1] "external" is started
47 47 [A2] "external" waits on EXT_UNLOCK
48 48 [A2] "external" + creates EXT_WAITING unlocks [C1]
49 49 [B1] "hg commit/pull" is started
50 50 [B2] "hg commit/pull" is ready to be committed
51 51 [B3] "hg commit/pull" spawn "internal" using a pretxnclose hook (need [C4])
52 52 [C1] "internal" waits on EXT_WAITING (need [A2])
53 53 [C2] "internal" creates EXT_UNLOCK unlocks [A2]
54 54 [C3] "internal" show the tipmost revision (inside of the transaction)
55 55 [C4] "internal" waits on EXT_DONE (need [A4])
56 56 [A3] "external" show the tipmost revision (outside of the transaction)
57 57 [A4] "external" creates EXT_DONE unlocks [C4]
58 58 [C5] "internal" end of execution -> unlock [B3]
59 59 [B4] "hg commit/pull" transaction is committed on disk
60 60
61 61
62 62 $ mkdir sync
63 63 $ mkdir output
64 64 $ mkdir script
65 65 $ HG_TEST_FILE_EXT_WAITING=$TESTTMP/sync/ext_waiting
66 66 $ export HG_TEST_FILE_EXT_WAITING
67 67 $ HG_TEST_FILE_EXT_UNLOCK=$TESTTMP/sync/ext_unlock
68 68 $ export HG_TEST_FILE_EXT_UNLOCK
69 69 $ HG_TEST_FILE_EXT_DONE=$TESTTMP/sync/ext_done
70 70 $ export HG_TEST_FILE_EXT_DONE
71 71 $ cat << EOF > script/external.sh
72 72 > #!/bin/sh
73 73 > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_UNLOCK" "$HG_TEST_FILE_EXT_WAITING"
74 74 > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > "$TESTTMP/output/external.out"
75 75 > touch "$HG_TEST_FILE_EXT_DONE"
76 76 > EOF
77 77 $ cat << EOF > script/internal.sh
78 78 > #!/bin/sh
79 79 > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_WAITING"
80 80 > touch "$HG_TEST_FILE_EXT_UNLOCK"
81 81 > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > "$TESTTMP/output/internal.out"
82 82 > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_DONE"
83 83 > EOF
84 84
85 85
86 86 Automated commands:
87 87
88 88 $ make_one_commit() {
89 89 > rm -f $TESTTMP/sync/*
90 90 > rm -f $TESTTMP/output/*
91 91 > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n'
92 92 > echo x >> of
93 93 > sh $TESTTMP/script/external.sh & hg commit -m "$1"
94 94 > cat $TESTTMP/output/external.out
95 95 > cat $TESTTMP/output/internal.out
96 96 > hg log --rev 'tip' -T 'post-tr: {rev} {desc}\n'
97 97 > }
98 98
99 99
100 100 $ make_one_pull() {
101 101 > rm -f $TESTTMP/sync/*
102 102 > rm -f $TESTTMP/output/*
103 103 > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n'
104 104 > echo x >> of
105 105 > sh $TESTTMP/script/external.sh & hg pull ../other-repo/ --rev "$1" --force --quiet
106 106 > cat $TESTTMP/output/external.out
107 107 > cat $TESTTMP/output/internal.out
108 108 > hg log --rev 'tip' -T 'post-tr: {rev} {desc}\n'
109 109 > }
110 110
111 111 prepare a large source to which to pull from:
112 112
113 113 The source is large to unsure we don't use inline more after the pull
114 114
115 115 $ hg init other-repo
116 116 $ hg -R other-repo debugbuilddag .+500 --overwritten-file
117 117
118 118
119 119 prepare an empty repository where to make test:
120 120
121 121 $ hg init repo
122 122 $ cd repo
123 123 $ touch of
124 124 $ hg add of
125 125
126 126 prepare a small extension to controll inline size
127 127
128 128 $ mkdir $TESTTMP/ext
129 129 $ cat << EOF > $TESTTMP/ext/small_inline.py
130 130 > from mercurial import revlog
131 131 > revlog._maxinline = 3 * 100
132 132 > EOF
133 133
134 134
135 135
136 136
137 137 $ cat << EOF >> $HGRCPATH
138 138 > [extensions]
139 139 > small_inline=$TESTTMP/ext/small_inline.py
140 140 > [hooks]
141 141 > pretxnclose = sh $TESTTMP/script/internal.sh
142 142 > EOF
143 143
144 144 check this is true for the initial commit (inline → inline)
145 145 -----------------------------------------------------------
146 146
147 147 the repository should still be inline (for relevant format)
148 148
149 149 $ make_one_commit first
150 150 pre-commit: -1
151 151 external: -1
152 152 internal: 0 first
153 153 post-tr: 0 first
154 154
155 155 #if revlogv1
156 156
157 157 $ hg debugrevlog of | grep inline
158 flags : inline, generaldelta
158 flags : inline, * (glob)
159 159
160 160 #endif
161 161
162 162 check this is true for extra commit (inline → inline)
163 163 -----------------------------------------------------
164 164
165 165 the repository should still be inline (for relevant format)
166 166
167 167 #if revlogv1
168 168
169 169 $ hg debugrevlog of | grep inline
170 flags : inline, generaldelta
170 flags : inline, * (glob)
171 171
172 172 #endif
173 173
174 174 $ make_one_commit second
175 175 pre-commit: 0 first
176 176 external: 0 first
177 177 internal: 1 second
178 178 post-tr: 1 second
179 179
180 180 #if revlogv1
181 181
182 182 $ hg debugrevlog of | grep inline
183 flags : inline, generaldelta
183 flags : inline, * (glob)
184 184
185 185 #endif
186 186
187 187 check this is true for a small pull (inline → inline)
188 188 -----------------------------------------------------
189 189
190 190 the repository should still be inline (for relevant format)
191 191
192 192 #if revlogv1
193 193
194 194 $ hg debugrevlog of | grep inline
195 flags : inline, generaldelta
195 flags : inline, * (glob)
196 196
197 197 #endif
198 198
199 199 $ make_one_pull 3
200 200 pre-commit: 1 second
201 201 warning: repository is unrelated
202 202 external: 1 second
203 203 internal: 5 r3
204 204 post-tr: 5 r3
205 205
206 206 #if revlogv1
207 207
208 208 $ hg debugrevlog of | grep inline
209 flags : inline, generaldelta
209 flags : inline, * (glob)
210 210
211 211 #endif
212 212
213 213 Make a large pull (inline → no-inline)
214 214 ---------------------------------------
215 215
216 216 the repository should no longer be inline (for relevant format)
217 217
218 218 #if revlogv1
219 219
220 220 $ hg debugrevlog of | grep inline
221 flags : inline, generaldelta
221 flags : inline, * (glob)
222 222
223 223 #endif
224 224
225 225 $ make_one_pull 400
226 226 pre-commit: 5 r3
227 227 external: 5 r3
228 228 internal: 402 r400
229 229 post-tr: 402 r400
230 230
231 231 #if revlogv1
232 232
233 233 $ hg debugrevlog of | grep inline
234 234 [1]
235 235
236 236 #endif
237 237
238 238 check this is true for extra commit (no-inline → no-inline)
239 239 -----------------------------------------------------------
240 240
241 241 the repository should no longer be inline (for relevant format)
242 242
243 243 #if revlogv1
244 244
245 245 $ hg debugrevlog of | grep inline
246 246 [1]
247 247
248 248 #endif
249 249
250 250 $ make_one_commit third
251 251 pre-commit: 402 r400
252 252 external: 402 r400
253 253 internal: 403 third
254 254 post-tr: 403 third
255 255
256 256 #if revlogv1
257 257
258 258 $ hg debugrevlog of | grep inline
259 259 [1]
260 260
261 261 #endif
262 262
263 263
264 264 Make a pull (not-inline → no-inline)
265 265 -------------------------------------
266 266
267 267 the repository should no longer be inline (for relevant format)
268 268
269 269 #if revlogv1
270 270
271 271 $ hg debugrevlog of | grep inline
272 272 [1]
273 273
274 274 #endif
275 275
276 276 $ make_one_pull tip
277 277 pre-commit: 403 third
278 278 external: 403 third
279 279 internal: 503 r500
280 280 post-tr: 503 r500
281 281
282 282 #if revlogv1
283 283
284 284 $ hg debugrevlog of | grep inline
285 285 [1]
286 286
287 287 #endif
General Comments 0
You need to be logged in to leave comments. Login now