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