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