##// END OF EJS Templates
revlog: avoid possible collision between directory and temporary index...
marmoute -
r51555:12f13b13 stable
parent child Browse files
Show More
@@ -2026,7 +2026,15 b' class revlog:'
2026
2026
2027 The file will only exist if a splitting operation is in progress, but
2027 The file will only exist if a splitting operation is in progress, but
2028 it is always expected at the same location."""
2028 it is always expected at the same location."""
2029 return self.radix + b'.i.s'
2029 parts = os.path.split(self.radix)
2030 if len(parts) > 1:
2031 # adds a '-s' prefix to the ``data/` or `meta/` base
2032 head = parts[0] + b'-s'
2033 return os.path.join(head, *parts[1:])
2034 else:
2035 # the revlog is stored at the root of the store (changelog or
2036 # manifest), no risk of collision.
2037 return self.radix + b'.i.s'
2030
2038
2031 def _enforceinlinesize(self, tr, side_write=True):
2039 def _enforceinlinesize(self, tr, side_write=True):
2032 """Check if the revlog is too big for inline and convert if so.
2040 """Check if the revlog is too big for inline and convert if so.
@@ -84,6 +84,8 b' setup a repository for tests'
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
88 > some_dir/sub_dir/foo_bar.i.s/tutu
87 > "
89 > "
88 $ for f in $files; do
90 $ for f in $files; do
89 > mkdir -p `dirname $f`
91 > mkdir -p `dirname $f`
@@ -112,7 +114,7 b' setup a repository for tests'
112 Reference size:
114 Reference size:
113 $ f -s file
115 $ f -s file
114 file: size=135168
116 file: size=135168
115 $ f -s .hg/store/data/file*
117 $ f -s .hg/store/data*/file*
116 .hg/store/data/file.d: size=267307
118 .hg/store/data/file.d: size=267307
117 .hg/store/data/file.i: size=320
119 .hg/store/data/file.i: size=320
118
120
@@ -140,7 +142,7 b' but truncate the index and the data to r'
140 Reference size:
142 Reference size:
141 $ f -s file
143 $ f -s file
142 file: size=1024
144 file: size=1024
143 $ f -s .hg/store/data/file*
145 $ f -s .hg/store/data*/file*
144 .hg/store/data/file.i: size=1174
146 .hg/store/data/file.i: size=1174
145
147
146 $ cat > .hg/hgrc <<EOF
148 $ cat > .hg/hgrc <<EOF
@@ -162,11 +164,12 b' Reference size:'
162 The inline revlog still exist, but a split version exist next to it
164 The inline revlog still exist, but a split version exist next to it
163
165
164 $ cat .hg/store/journal | tr '\0' ' ' | grep '\.s'
166 $ cat .hg/store/journal | tr '\0' ' ' | grep '\.s'
165 [1]
167 data/some_dir/sub_dir/foo_bar.i.s/tutu.i 1174
166 $ f -s .hg/store/data/file*
168 data/some_dir/sub_dir/foo_bar.i.s/tutu.d 0
169 $ f -s .hg/store/data*/file*
170 .hg/store/data-s/file: size=320
167 .hg/store/data/file.d: size=267307
171 .hg/store/data/file.d: size=267307
168 .hg/store/data/file.i: size=132395
172 .hg/store/data/file.i: size=132395
169 .hg/store/data/file.i.s: size=320
170
173
171
174
172 The first file.i entry should match the "Reference size" above.
175 The first file.i entry should match the "Reference size" above.
@@ -177,19 +180,19 b' A "temporary file" entry exist for the s'
177 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
180 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
178 data/file.i 1174
181 data/file.i 1174
179 data/file.d 0
182 data/file.d 0
180 $ cat .hg/store/journal.backupfiles | tr -s '\000' ' ' | tr -s '\00' ' '| grep data/file
183 $ cat .hg/store/journal.backupfiles | tr -s '\000' ' ' | tr -s '\00' ' '| grep 'data.*/file'
181 data/file.i data/journal.backup.file.i 0
184 data/file.i data/journal.backup.file.i 0
182 data/file.i.s 0
185 data-s/file 0
183
186
184 recover is rolling the split back, the fncache is still valid
187 recover is rolling the split back, the fncache is still valid
185
188
186 $ hg recover
189 $ hg recover
187 rolling back interrupted transaction
190 rolling back interrupted transaction
188 (verify step skipped, run `hg verify` to check your repository content)
191 (verify step skipped, run `hg verify` to check your repository content)
189 $ f -s .hg/store/data/file*
192 $ f -s .hg/store/data*/file*
190 .hg/store/data/file.i: size=1174
193 .hg/store/data/file.i: size=1174
191 $ hg tip
194 $ hg tip
192 changeset: 1:cc8dfb126534
195 changeset: 1:64b04c8dc267
193 tag: tip
196 tag: tip
194 user: test
197 user: test
195 date: Thu Jan 01 00:00:00 1970 +0000
198 date: Thu Jan 01 00:00:00 1970 +0000
@@ -214,7 +217,7 b' where the data file is left as garbage.'
214 Reference size:
217 Reference size:
215 $ f -s file
218 $ f -s file
216 file: size=1024
219 file: size=1024
217 $ f -s .hg/store/data/file*
220 $ f -s .hg/store/data*/file*
218 .hg/store/data/file.i: size=1174
221 .hg/store/data/file.i: size=1174
219
222
220 $ cat > .hg/hgrc <<EOF
223 $ cat > .hg/hgrc <<EOF
@@ -242,12 +245,12 b' Reference size:'
242
245
243 The inline revlog still exist, but a split version exist next to it
246 The inline revlog still exist, but a split version exist next to it
244
247
245 $ f -s .hg/store/data/file*
248 $ f -s .hg/store/data*/file*
249 .hg/store/data-s/file: size=320
246 .hg/store/data/file.d: size=267307
250 .hg/store/data/file.d: size=267307
247 .hg/store/data/file.i: size=132395
251 .hg/store/data/file.i: size=132395
248 .hg/store/data/file.i.s: size=320
249
252
250 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
253 $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file'
251 data/file.i 1174
254 data/file.i 1174
252 data/file.d 0
255 data/file.d 0
253
256
@@ -256,10 +259,10 b' recover is rolling the split back, the f'
256 $ hg recover
259 $ hg recover
257 rolling back interrupted transaction
260 rolling back interrupted transaction
258 (verify step skipped, run `hg verify` to check your repository content)
261 (verify step skipped, run `hg verify` to check your repository content)
259 $ f -s .hg/store/data/file*
262 $ f -s .hg/store/data*/file*
260 .hg/store/data/file.i: size=1174
263 .hg/store/data/file.i: size=1174
261 $ hg tip
264 $ hg tip
262 changeset: 1:cc8dfb126534
265 changeset: 1:64b04c8dc267
263 tag: tip
266 tag: tip
264 user: test
267 user: test
265 date: Thu Jan 01 00:00:00 1970 +0000
268 date: Thu Jan 01 00:00:00 1970 +0000
@@ -279,7 +282,7 b' Now retry the procedure but intercept th'
279 Reference size:
282 Reference size:
280 $ f -s file
283 $ f -s file
281 file: size=1024
284 file: size=1024
282 $ f -s .hg/store/data/file*
285 $ f -s .hg/store/data*/file*
283 .hg/store/data/file.i: size=1174
286 .hg/store/data/file.i: size=1174
284
287
285 $ cat > .hg/hgrc <<EOF
288 $ cat > .hg/hgrc <<EOF
@@ -307,11 +310,11 b' Reference size:'
307
310
308 The inline revlog was over written on disk
311 The inline revlog was over written on disk
309
312
310 $ f -s .hg/store/data/file*
313 $ f -s .hg/store/data*/file*
311 .hg/store/data/file.d: size=267307
314 .hg/store/data/file.d: size=267307
312 .hg/store/data/file.i: size=320
315 .hg/store/data/file.i: size=320
313
316
314 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
317 $ cat .hg/store/journal | tr -s '\000' ' ' | grep 'data.*/file'
315 data/file.i 1174
318 data/file.i 1174
316 data/file.d 0
319 data/file.d 0
317
320
@@ -320,10 +323,10 b' recover is rolling the split back, the f'
320 $ hg recover
323 $ hg recover
321 rolling back interrupted transaction
324 rolling back interrupted transaction
322 (verify step skipped, run `hg verify` to check your repository content)
325 (verify step skipped, run `hg verify` to check your repository content)
323 $ f -s .hg/store/data/file*
326 $ f -s .hg/store/data*/file*
324 .hg/store/data/file.i: size=1174
327 .hg/store/data/file.i: size=1174
325 $ hg tip
328 $ hg tip
326 changeset: 1:cc8dfb126534
329 changeset: 1:64b04c8dc267
327 tag: tip
330 tag: tip
328 user: test
331 user: test
329 date: Thu Jan 01 00:00:00 1970 +0000
332 date: Thu Jan 01 00:00:00 1970 +0000
@@ -357,13 +360,13 b' Repeat the original test but let hg roll'
357
360
358 The split was rollback
361 The split was rollback
359
362
360 $ f -s .hg/store/data/file*
363 $ f -s .hg/store/data*/file*
361 .hg/store/data/file.d: size=0
364 .hg/store/data/file.d: size=0
362 .hg/store/data/file.i: size=1174
365 .hg/store/data/file.i: size=1174
363
366
364
367
365 $ hg tip
368 $ hg tip
366 changeset: 1:cc8dfb126534
369 changeset: 1:64b04c8dc267
367 tag: tip
370 tag: tip
368 user: test
371 user: test
369 date: Thu Jan 01 00:00:00 1970 +0000
372 date: Thu Jan 01 00:00:00 1970 +0000
@@ -839,6 +839,7 b' store directory has files we expect'
839 00changelog.i
839 00changelog.i
840 00manifest.i
840 00manifest.i
841 data
841 data
842 data-s
842 fncache
843 fncache
843 phaseroots
844 phaseroots
844 requires
845 requires
@@ -862,6 +863,7 b' old store should be backed up'
862 00changelog.i
863 00changelog.i
863 00manifest.i
864 00manifest.i
864 data
865 data
866 data-s
865 fncache
867 fncache
866 phaseroots
868 phaseroots
867 requires
869 requires
General Comments 0
You need to be logged in to leave comments. Login now