##// END OF EJS Templates
compat: normalise path before comparison in revlog splitting test...
Raphaël Gomès -
r48361:8e929591 default
parent child Browse files
Show More
@@ -1,184 +1,183 b''
1 Test correctness of revlog inline -> non-inline transition
1 Test correctness of revlog inline -> non-inline transition
2 ----------------------------------------------------------
2 ----------------------------------------------------------
3
3
4 Helper extension to intercept renames.
4 Helper extension to intercept renames.
5
5
6 $ cat > $TESTTMP/intercept_rename.py << EOF
6 $ cat > $TESTTMP/intercept_rename.py << EOF
7 > import os
7 > import os
8 > import sys
8 > import sys
9 > from mercurial import extensions, util
9 > from mercurial import extensions, util
10 >
10 >
11 > def extsetup(ui):
11 > def extsetup(ui):
12 > def close(orig, *args, **kwargs):
12 > def close(orig, *args, **kwargs):
13 > path = args[0]._atomictempfile__name
13 > path = util.normpath(args[0]._atomictempfile__name)
14 > if path.endswith(b'/.hg/store/data/file.i'):
14 > if path.endswith(b'/.hg/store/data/file.i'):
15 > os._exit(80)
15 > os._exit(80)
16 > return orig(*args, **kwargs)
16 > return orig(*args, **kwargs)
17 > extensions.wrapfunction(util.atomictempfile, 'close', close)
17 > extensions.wrapfunction(util.atomictempfile, 'close', close)
18 > EOF
18 > EOF
19
19
20
21 Test offset computation to correctly factor in the index entries themselve.
20 Test offset computation to correctly factor in the index entries themselve.
22 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
23 after the index has been replaced.
22 after the index has been replaced.
24
23
25 Test repo has one small, one moderate and one big change. The clone has
24 Test repo has one small, one moderate and one big change. The clone has
26 the small and moderate change and will transition to non-inline storage when
25 the small and moderate change and will transition to non-inline storage when
27 adding the big change.
26 adding the big change.
28
27
29 $ hg init troffset-computation --config format.revlog-compression=none
28 $ hg init troffset-computation --config format.revlog-compression=none
30 $ cd troffset-computation
29 $ cd troffset-computation
31 $ printf '%20d' '1' > file
30 $ printf '%20d' '1' > file
32 $ hg commit -Aqm_
31 $ hg commit -Aqm_
33 $ printf '%1024d' '1' > file
32 $ printf '%1024d' '1' > file
34 $ hg commit -Aqm_
33 $ hg commit -Aqm_
35 $ dd if=/dev/zero of=file bs=1k count=128 > /dev/null 2>&1
34 $ dd if=/dev/zero of=file bs=1k count=128 > /dev/null 2>&1
36 $ hg commit -Aqm_
35 $ hg commit -Aqm_
37 $ cd ..
36 $ cd ..
38
37
39 $ hg clone -r 1 troffset-computation troffset-computation-copy --config format.revlog-compression=none -q
38 $ hg clone -r 1 troffset-computation troffset-computation-copy --config format.revlog-compression=none -q
40 $ cd troffset-computation-copy
39 $ cd troffset-computation-copy
41
40
42 Reference size:
41 Reference size:
43
42
44 $ f -s .hg/store/data/file*
43 $ f -s .hg/store/data/file*
45 .hg/store/data/file.i: size=1174
44 .hg/store/data/file.i: size=1174
46
45
47 $ cat > .hg/hgrc <<EOF
46 $ cat > .hg/hgrc <<EOF
48 > [hooks]
47 > [hooks]
49 > pretxnchangegroup = python:$TESTDIR/helper-killhook.py:killme
48 > pretxnchangegroup = python:$TESTDIR/helper-killhook.py:killme
50 > EOF
49 > EOF
51 #if chg
50 #if chg
52 $ hg pull ../troffset-computation
51 $ hg pull ../troffset-computation
53 pulling from ../troffset-computation
52 pulling from ../troffset-computation
54 [255]
53 [255]
55 #else
54 #else
56 $ hg pull ../troffset-computation
55 $ hg pull ../troffset-computation
57 pulling from ../troffset-computation
56 pulling from ../troffset-computation
58 [80]
57 [80]
59 #endif
58 #endif
60 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file | tail -1
59 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file | tail -1
61 data/file.i 128
60 data/file.i 128
62
61
63 The first file.i entry should match the size above.
62 The first file.i entry should match the size above.
64 The first file.d entry is the temporary record during the split,
63 The first file.d entry is the temporary record during the split,
65 the second entry after the split happened. The sum of the second file.d
64 the second entry after the split happened. The sum of the second file.d
66 and the second file.i entry should match the first file.i entry.
65 and the second file.i entry should match the first file.i entry.
67
66
68 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
67 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
69 data/file.i 1174
68 data/file.i 1174
70 data/file.d 0
69 data/file.d 0
71 data/file.d 1046
70 data/file.d 1046
72 data/file.i 128
71 data/file.i 128
73 $ hg recover
72 $ hg recover
74 rolling back interrupted transaction
73 rolling back interrupted transaction
75 (verify step skipped, run `hg verify` to check your repository content)
74 (verify step skipped, run `hg verify` to check your repository content)
76 $ f -s .hg/store/data/file*
75 $ f -s .hg/store/data/file*
77 .hg/store/data/file.d: size=1046
76 .hg/store/data/file.d: size=1046
78 .hg/store/data/file.i: size=128
77 .hg/store/data/file.i: size=128
79 $ hg tip
78 $ hg tip
80 changeset: 1:3ce491143aec
79 changeset: 1:3ce491143aec
81 tag: tip
80 tag: tip
82 user: test
81 user: test
83 date: Thu Jan 01 00:00:00 1970 +0000
82 date: Thu Jan 01 00:00:00 1970 +0000
84 summary: _
83 summary: _
85
84
86 $ hg verify
85 $ hg verify
87 checking changesets
86 checking changesets
88 checking manifests
87 checking manifests
89 crosschecking files in changesets and manifests
88 crosschecking files in changesets and manifests
90 checking files
89 checking files
91 warning: revlog 'data/file.d' not in fncache!
90 warning: revlog 'data/file.d' not in fncache!
92 checked 2 changesets with 2 changes to 1 files
91 checked 2 changesets with 2 changes to 1 files
93 1 warnings encountered!
92 1 warnings encountered!
94 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
93 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
95 $ cd ..
94 $ cd ..
96
95
97
96
98 Now retry the procedure but intercept the rename of the index and check that
97 Now retry the procedure but intercept the rename of the index and check that
99 the journal does not contain the new index size. This demonstrates the edge case
98 the journal does not contain the new index size. This demonstrates the edge case
100 where the data file is left as garbage.
99 where the data file is left as garbage.
101
100
102 $ hg clone -r 1 troffset-computation troffset-computation-copy2 --config format.revlog-compression=none -q
101 $ hg clone -r 1 troffset-computation troffset-computation-copy2 --config format.revlog-compression=none -q
103 $ cd troffset-computation-copy2
102 $ cd troffset-computation-copy2
104 $ cat > .hg/hgrc <<EOF
103 $ cat > .hg/hgrc <<EOF
105 > [extensions]
104 > [extensions]
106 > intercept_rename = $TESTTMP/intercept_rename.py
105 > intercept_rename = $TESTTMP/intercept_rename.py
107 > [hooks]
106 > [hooks]
108 > pretxnchangegroup = python:$TESTDIR/helper-killhook.py:killme
107 > pretxnchangegroup = python:$TESTDIR/helper-killhook.py:killme
109 > EOF
108 > EOF
110 #if chg
109 #if chg
111 $ hg pull ../troffset-computation
110 $ hg pull ../troffset-computation
112 pulling from ../troffset-computation
111 pulling from ../troffset-computation
113 [255]
112 [255]
114 #else
113 #else
115 $ hg pull ../troffset-computation
114 $ hg pull ../troffset-computation
116 pulling from ../troffset-computation
115 pulling from ../troffset-computation
117 [80]
116 [80]
118 #endif
117 #endif
119 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
118 $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
120 data/file.i 1174
119 data/file.i 1174
121 data/file.d 0
120 data/file.d 0
122 data/file.d 1046
121 data/file.d 1046
123
122
124 $ hg recover
123 $ hg recover
125 rolling back interrupted transaction
124 rolling back interrupted transaction
126 (verify step skipped, run `hg verify` to check your repository content)
125 (verify step skipped, run `hg verify` to check your repository content)
127 $ f -s .hg/store/data/file*
126 $ f -s .hg/store/data/file*
128 .hg/store/data/file.d: size=1046
127 .hg/store/data/file.d: size=1046
129 .hg/store/data/file.i: size=1174
128 .hg/store/data/file.i: size=1174
130 $ hg tip
129 $ hg tip
131 changeset: 1:3ce491143aec
130 changeset: 1:3ce491143aec
132 tag: tip
131 tag: tip
133 user: test
132 user: test
134 date: Thu Jan 01 00:00:00 1970 +0000
133 date: Thu Jan 01 00:00:00 1970 +0000
135 summary: _
134 summary: _
136
135
137 $ hg verify
136 $ hg verify
138 checking changesets
137 checking changesets
139 checking manifests
138 checking manifests
140 crosschecking files in changesets and manifests
139 crosschecking files in changesets and manifests
141 checking files
140 checking files
142 checked 2 changesets with 2 changes to 1 files
141 checked 2 changesets with 2 changes to 1 files
143 $ cd ..
142 $ cd ..
144
143
145
144
146 Repeat the original test but let hg rollback the transaction.
145 Repeat the original test but let hg rollback the transaction.
147
146
148 $ hg clone -r 1 troffset-computation troffset-computation-copy-rb --config format.revlog-compression=none -q
147 $ hg clone -r 1 troffset-computation troffset-computation-copy-rb --config format.revlog-compression=none -q
149 $ cd troffset-computation-copy-rb
148 $ cd troffset-computation-copy-rb
150 $ cat > .hg/hgrc <<EOF
149 $ cat > .hg/hgrc <<EOF
151 > [hooks]
150 > [hooks]
152 > pretxnchangegroup = false
151 > pretxnchangegroup = false
153 > EOF
152 > EOF
154 $ hg pull ../troffset-computation
153 $ hg pull ../troffset-computation
155 pulling from ../troffset-computation
154 pulling from ../troffset-computation
156 searching for changes
155 searching for changes
157 adding changesets
156 adding changesets
158 adding manifests
157 adding manifests
159 adding file changes
158 adding file changes
160 transaction abort!
159 transaction abort!
161 rollback completed
160 rollback completed
162 abort: pretxnchangegroup hook exited with status 1
161 abort: pretxnchangegroup hook exited with status 1
163 [40]
162 [40]
164 $ f -s .hg/store/data/file*
163 $ f -s .hg/store/data/file*
165 .hg/store/data/file.d: size=1046
164 .hg/store/data/file.d: size=1046
166 .hg/store/data/file.i: size=128
165 .hg/store/data/file.i: size=128
167 $ hg tip
166 $ hg tip
168 changeset: 1:3ce491143aec
167 changeset: 1:3ce491143aec
169 tag: tip
168 tag: tip
170 user: test
169 user: test
171 date: Thu Jan 01 00:00:00 1970 +0000
170 date: Thu Jan 01 00:00:00 1970 +0000
172 summary: _
171 summary: _
173
172
174 $ hg verify
173 $ hg verify
175 checking changesets
174 checking changesets
176 checking manifests
175 checking manifests
177 crosschecking files in changesets and manifests
176 crosschecking files in changesets and manifests
178 checking files
177 checking files
179 warning: revlog 'data/file.d' not in fncache!
178 warning: revlog 'data/file.d' not in fncache!
180 checked 2 changesets with 2 changes to 1 files
179 checked 2 changesets with 2 changes to 1 files
181 1 warnings encountered!
180 1 warnings encountered!
182 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
181 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
183 $ cd ..
182 $ cd ..
184
183
General Comments 0
You need to be logged in to leave comments. Login now