comparison tests/test-setdiscovery.t @ 14164:cb98fed52495

discovery: add new set-based discovery Adds a new discovery method based on repeatedly sampling the still undecided subset of the local node graph to determine the set of nodes common to both the client and the server. For small differences between client and server, it uses about the same or slightly fewer roundtrips than the old tree-based discovery. For larger differences, it typically reduces the number of roundtrips drastically (from 150 to 4, for instance). The old discovery code now lives in treediscovery.py, the new code is in setdiscovery.py. Still missing is a hook for extensions to contribute nodes to the initial sample. For instance, Augie's remotebranches could contribute the last known state of the server's heads. Credits for the actual sampler and computing common heads instead of bases go to Benoit Boissinot.
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Mon, 02 May 2011 19:21:30 +0200
parents
children f03c82d1f50a
comparison
equal deleted inserted replaced
14163:38184a72d793 14164:cb98fed52495
1
2 Function to test discovery between two repos in both directions, using both the local shortcut
3 (which is currently not activated by default) and the full remotable protocol:
4
5 $ testdesc() { # revs_a, revs_b, dagdesc
6 > if [ -e foo ]; then rm -rf foo; fi
7 > hg init foo
8 > cd foo
9 > hg debugbuilddag "$3"
10 > hg clone . a $1 --quiet
11 > hg clone . b $2 --quiet
12 > echo
13 > echo "% -- a -> b tree"
14 > hg -R a debugdiscovery b --verbose --old
15 > echo
16 > echo "% -- a -> b set"
17 > hg -R a debugdiscovery b --verbose --debug
18 > echo
19 > echo "% -- b -> a tree"
20 > hg -R b debugdiscovery a --verbose --old
21 > echo
22 > echo "% -- b -> a set"
23 > hg -R b debugdiscovery a --verbose --debug
24 > cd ..
25 > }
26
27
28 Small superset:
29
30 $ testdesc '-ra1 -ra2' '-rb1 -rb2 -rb3' '
31 > +2:f +1:a1:b1
32 > <f +4 :a2
33 > +5 :b2
34 > <f +3 :b3'
35
36 % -- a -> b tree
37 comparing with b
38 searching for changes
39 unpruned common: b5714e113bc0 66f7d451a68b 01241442b3c2
40 common heads: b5714e113bc0 01241442b3c2
41 local is subset
42
43 % -- a -> b set
44 comparing with b
45 query 1; heads
46 searching for changes
47 taking initial sample
48 searching: 2 queries
49 query 2; still undecided: 4, sample size is: 4
50 2 total queries
51 common heads: b5714e113bc0 01241442b3c2
52 local is subset
53
54 % -- b -> a tree
55 comparing with a
56 searching for changes
57 unpruned common: b5714e113bc0 01241442b3c2
58 common heads: b5714e113bc0 01241442b3c2
59 remote is subset
60
61 % -- b -> a set
62 comparing with a
63 query 1; heads
64 searching for changes
65 all remote heads known locally
66 common heads: b5714e113bc0 01241442b3c2
67 remote is subset
68
69
70 Many new:
71
72 $ testdesc '-ra1 -ra2' '-rb' '
73 > +2:f +3:a1 +3:b
74 > <f +30 :a2'
75
76 % -- a -> b tree
77 comparing with b
78 searching for changes
79 unpruned common: bebd167eb94d
80 common heads: bebd167eb94d
81
82 % -- a -> b set
83 comparing with b
84 query 1; heads
85 searching for changes
86 taking quick initial sample
87 searching: 2 queries
88 query 2; still undecided: 35, sample size is: 35
89 2 total queries
90 common heads: bebd167eb94d
91
92 % -- b -> a tree
93 comparing with a
94 searching for changes
95 unpruned common: bebd167eb94d 66f7d451a68b
96 common heads: bebd167eb94d
97
98 % -- b -> a set
99 comparing with a
100 query 1; heads
101 searching for changes
102 taking initial sample
103 searching: 2 queries
104 query 2; still undecided: 3, sample size is: 3
105 2 total queries
106 common heads: bebd167eb94d
107
108
109 Both sides many new with stub:
110
111 $ testdesc '-ra1 -ra2' '-rb' '
112 > +2:f +2:a1 +30 :b
113 > <f +30 :a2'
114
115 % -- a -> b tree
116 comparing with b
117 searching for changes
118 unpruned common: 2dc09a01254d
119 common heads: 2dc09a01254d
120
121 % -- a -> b set
122 comparing with b
123 query 1; heads
124 searching for changes
125 taking quick initial sample
126 searching: 2 queries
127 query 2; still undecided: 34, sample size is: 34
128 2 total queries
129 common heads: 2dc09a01254d
130
131 % -- b -> a tree
132 comparing with a
133 searching for changes
134 unpruned common: 66f7d451a68b 2dc09a01254d
135 common heads: 2dc09a01254d
136
137 % -- b -> a set
138 comparing with a
139 query 1; heads
140 searching for changes
141 taking initial sample
142 searching: 2 queries
143 query 2; still undecided: 30, sample size is: 30
144 2 total queries
145 common heads: 2dc09a01254d
146
147
148 Both many new:
149
150 $ testdesc '-ra' '-rb' '
151 > +2:f +30 :b
152 > <f +30 :a'
153
154 % -- a -> b tree
155 comparing with b
156 searching for changes
157 unpruned common: 66f7d451a68b
158 common heads: 66f7d451a68b
159
160 % -- a -> b set
161 comparing with b
162 query 1; heads
163 searching for changes
164 taking quick initial sample
165 searching: 2 queries
166 query 2; still undecided: 32, sample size is: 32
167 2 total queries
168 common heads: 66f7d451a68b
169
170 % -- b -> a tree
171 comparing with a
172 searching for changes
173 unpruned common: 66f7d451a68b
174 common heads: 66f7d451a68b
175
176 % -- b -> a set
177 comparing with a
178 query 1; heads
179 searching for changes
180 taking quick initial sample
181 searching: 2 queries
182 query 2; still undecided: 32, sample size is: 32
183 2 total queries
184 common heads: 66f7d451a68b
185
186
187 Both many new skewed:
188
189 $ testdesc '-ra' '-rb' '
190 > +2:f +30 :b
191 > <f +50 :a'
192
193 % -- a -> b tree
194 comparing with b
195 searching for changes
196 unpruned common: 66f7d451a68b
197 common heads: 66f7d451a68b
198
199 % -- a -> b set
200 comparing with b
201 query 1; heads
202 searching for changes
203 taking quick initial sample
204 searching: 2 queries
205 query 2; still undecided: 52, sample size is: 52
206 2 total queries
207 common heads: 66f7d451a68b
208
209 % -- b -> a tree
210 comparing with a
211 searching for changes
212 unpruned common: 66f7d451a68b
213 common heads: 66f7d451a68b
214
215 % -- b -> a set
216 comparing with a
217 query 1; heads
218 searching for changes
219 taking quick initial sample
220 searching: 2 queries
221 query 2; still undecided: 32, sample size is: 32
222 2 total queries
223 common heads: 66f7d451a68b
224
225
226 Both many new on top of long history:
227
228 $ testdesc '-ra' '-rb' '
229 > +1000:f +30 :b
230 > <f +50 :a'
231
232 % -- a -> b tree
233 comparing with b
234 searching for changes
235 unpruned common: 7ead0cba2838
236 common heads: 7ead0cba2838
237
238 % -- a -> b set
239 comparing with b
240 query 1; heads
241 searching for changes
242 taking quick initial sample
243 searching: 2 queries
244 query 2; still undecided: 1050, sample size is: 11
245 sampling from both directions
246 searching: 3 queries
247 query 3; still undecided: 31, sample size is: 31
248 3 total queries
249 common heads: 7ead0cba2838
250
251 % -- b -> a tree
252 comparing with a
253 searching for changes
254 unpruned common: 7ead0cba2838
255 common heads: 7ead0cba2838
256
257 % -- b -> a set
258 comparing with a
259 query 1; heads
260 searching for changes
261 taking quick initial sample
262 searching: 2 queries
263 query 2; still undecided: 1030, sample size is: 11
264 sampling from both directions
265 searching: 3 queries
266 query 3; still undecided: 16, sample size is: 16
267 3 total queries
268 common heads: 7ead0cba2838
269
270
271