Mercurial > hg
comparison tests/test-clonebundles.t @ 27738:a0e783d26e81
exchange: make clone bundles non-experimental and enabled by default
The clone bundles feature was introduced in Mercurial 3.6 behind an
experimental and disabled by default flag. The feature has been enabled
on hg.mozilla.org for a few months and has served many terabytes of
clones. Users have been encouraged to use the feature and reception
has been very positive (mainly due to faster clones as a result of
connecting to a CDN). I have heard no feedback about changing the
feature other than inquiries about when it will be enabled by default.
So, I think the feature is ready to be enabled by default.
This patch renames experimental.clonebundles to ui.clonebundles,
documents the option, and enables it by default. References to the
experimental state of clone bundles have been removed. The remaining
config option docs in clonebundles.py have been removed because they
are redudant with `hg help config`.
There are some oddities with behavior of clone bundles. Because clones
with clone bundles are effectively 2 `hg pull` operations, there may be
2 transactions. This could result in hooks running twice. If the
subsequent pull is aborted, it could result in partial rollback and an
incomplete clone. This behavior is a bit wonky and should probably
be documented. If this patch is accepted, I'll send a follow-up to
document it. I don't think this behavior should prevent the feature
being enabled by default. Reworking the clone mechanism to support
interrupted or multi-part clones feels like a major new feature and
something that when implemented can change the hook and rollback
semantics of clone bundles. Besides, partial clone is better than
full rollback and hooks running on initial clone are likely rare, so I
think the impact is minimal.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 08 Jan 2016 10:58:04 -0800 |
parents | 482eb357fe98 |
children | 29cfc474c5fd |
comparison
equal
deleted
inserted
replaced
27737:482eb357fe98 | 27738:a0e783d26e81 |
---|---|
18 | 18 |
19 $ hg serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log | 19 $ hg serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log |
20 $ cat hg.pid >> $DAEMON_PIDS | 20 $ cat hg.pid >> $DAEMON_PIDS |
21 $ cd .. | 21 $ cd .. |
22 | 22 |
23 Feature disabled by default | 23 Missing manifest should not result in server lookup |
24 (client should not request manifest) | 24 |
25 | 25 $ hg --verbose clone -U http://localhost:$HGPORT no-manifest |
26 $ hg clone -U http://localhost:$HGPORT feature-disabled | |
27 requesting all changes | 26 requesting all changes |
28 adding changesets | 27 adding changesets |
29 adding manifests | 28 adding manifests |
30 adding file changes | 29 adding file changes |
31 added 2 changesets with 2 changes to 2 files | 30 added 2 changesets with 2 changes to 2 files |
34 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | 33 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) |
35 * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) | 34 * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) |
36 * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=phase%2Cbookmarks (glob) | 35 * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=phase%2Cbookmarks (glob) |
37 * - - [*] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases (glob) | 36 * - - [*] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases (glob) |
38 | 37 |
39 $ cat >> $HGRCPATH << EOF | |
40 > [experimental] | |
41 > clonebundles = true | |
42 > EOF | |
43 | |
44 Missing manifest should not result in server lookup | |
45 | |
46 $ hg --verbose clone -U http://localhost:$HGPORT no-manifest | |
47 requesting all changes | |
48 adding changesets | |
49 adding manifests | |
50 adding file changes | |
51 added 2 changesets with 2 changes to 2 files | |
52 | |
53 $ tail -4 server/access.log | |
54 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |
55 * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob) | |
56 * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=phase%2Cbookmarks (glob) | |
57 * - - [*] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases (glob) | |
58 | |
59 Empty manifest file results in retrieval | 38 Empty manifest file results in retrieval |
60 (the extension only checks if the manifest file exists) | 39 (the extension only checks if the manifest file exists) |
61 | 40 |
62 $ touch server/.hg/clonebundles.manifest | 41 $ touch server/.hg/clonebundles.manifest |
63 $ hg --verbose clone -U http://localhost:$HGPORT empty-manifest | 42 $ hg --verbose clone -U http://localhost:$HGPORT empty-manifest |
73 $ echo 'http://does.not.exist/bundle.hg' > server/.hg/clonebundles.manifest | 52 $ echo 'http://does.not.exist/bundle.hg' > server/.hg/clonebundles.manifest |
74 $ hg clone http://localhost:$HGPORT 404-url | 53 $ hg clone http://localhost:$HGPORT 404-url |
75 applying clone bundle from http://does.not.exist/bundle.hg | 54 applying clone bundle from http://does.not.exist/bundle.hg |
76 error fetching bundle: (.* not known|getaddrinfo failed) (re) | 55 error fetching bundle: (.* not known|getaddrinfo failed) (re) |
77 abort: error applying bundle | 56 abort: error applying bundle |
78 (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false") | 57 (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false") |
79 [255] | 58 [255] |
80 | 59 |
81 Server is not running aborts | 60 Server is not running aborts |
82 | 61 |
83 $ echo "http://localhost:$HGPORT1/bundle.hg" > server/.hg/clonebundles.manifest | 62 $ echo "http://localhost:$HGPORT1/bundle.hg" > server/.hg/clonebundles.manifest |
84 $ hg clone http://localhost:$HGPORT server-not-runner | 63 $ hg clone http://localhost:$HGPORT server-not-runner |
85 applying clone bundle from http://localhost:$HGPORT1/bundle.hg | 64 applying clone bundle from http://localhost:$HGPORT1/bundle.hg |
86 error fetching bundle: * refused* (glob) | 65 error fetching bundle: * refused* (glob) |
87 abort: error applying bundle | 66 abort: error applying bundle |
88 (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false") | 67 (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false") |
89 [255] | 68 [255] |
90 | 69 |
91 Server returns 404 | 70 Server returns 404 |
92 | 71 |
93 $ python $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid | 72 $ python $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid |
94 $ cat http.pid >> $DAEMON_PIDS | 73 $ cat http.pid >> $DAEMON_PIDS |
95 $ hg clone http://localhost:$HGPORT running-404 | 74 $ hg clone http://localhost:$HGPORT running-404 |
96 applying clone bundle from http://localhost:$HGPORT1/bundle.hg | 75 applying clone bundle from http://localhost:$HGPORT1/bundle.hg |
97 HTTP error fetching bundle: HTTP Error 404: File not found | 76 HTTP error fetching bundle: HTTP Error 404: File not found |
98 abort: error applying bundle | 77 abort: error applying bundle |
99 (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false") | 78 (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false") |
100 [255] | 79 [255] |
101 | 80 |
102 We can override failure to fall back to regular clone | 81 We can override failure to fall back to regular clone |
103 | 82 |
104 $ hg --config ui.clonebundlefallback=true clone -U http://localhost:$HGPORT 404-fallback | 83 $ hg --config ui.clonebundlefallback=true clone -U http://localhost:$HGPORT 404-fallback |