annotate tests/test-586.t @ 26623:5a95fe44121d

clonebundles: support for seeding clones from pre-generated bundles Cloning can be an expensive operation for servers because the server generates a bundle from existing repository data at request time. For a large repository like mozilla-central, this consumes 4+ minutes of CPU time on the server. It also results in significant network utilization. Multiplied by hundreds or even thousands of clients and the ensuing load can result in difficulties scaling the Mercurial server. Despite generation of bundles being deterministic until the next changeset is added, the generation of bundles to service a clone request is not cached. Each clone thus performs redundant work. This is wasteful. This patch introduces the "clonebundles" extension and related client-side functionality to help alleviate this deficiency. The client-side feature is behind an experimental flag and is not enabled by default. It works as follows: 1) Server operator generates a bundle and makes it available on a server (likely HTTP). 2) Server operator defines the URL of a bundle file in a .hg/clonebundles.manifest file. 3) Client `hg clone`ing sees the server is advertising bundle URLs. 4) Client fetches and applies the advertised bundle. 5) Client performs equivalent of `hg pull` to fetch changes made since the bundle was created. Essentially, the server performs the expensive work of generating a bundle once and all subsequent clones fetch a static file from somewhere. Scaling static file serving is a much more manageable problem than scaling a Python application like Mercurial. Assuming your repository grows less than 1% per day, the end result is 99+% of CPU and network load from clones is eliminated, allowing Mercurial servers to scale more easily. Serving static files also means data can be transferred to clients as fast as they can consume it, rather than as fast as servers can generate it. This makes clones faster. Mozilla has implemented similar functionality of this patch on hg.mozilla.org using a custom extension. We are hosting bundle files in Amazon S3 and CloudFront (a CDN) and have successfully offloaded >1 TB/day in data transfer from hg.mozilla.org, freeing up significant bandwidth and CPU resources. The positive impact has been stellar and I believe it has proved its value to be included in Mercurial core. I feel it is important for the client-side support to be enabled in core by default because it means that clients will get faster, more reliable clones and will enable server operators to reduce load without requiring any client-side configuration changes (assuming clients are up to date, of course). The scope of this feature is narrowly and specifically tailored to cloning, despite "serve pulls from pre-generated bundles" being a valid and useful feature. I would eventually like for Mercurial servers to support transferring *all* repository data via statically hosted files. You could imagine a server that siphons all pushed data to bundle files and instructs clients to apply a stream of bundles to reconstruct all repository data. This feature, while useful and powerful, is significantly more work to implement because it requires the server component have awareness of discovery and a mapping of which changesets are in which files. Full, clone bundles, by contrast, are much simpler. The wire protocol command is named "clonebundles" instead of something more generic like "staticbundles" to leave the door open for a new, more powerful and more generic server-side component with minimal backwards compatibility implications. The name "bundleclone" is used by Mozilla's extension and would cause problems since there are subtle differences in Mozilla's extension. Mozilla's experience with this idea has taught us that some form of "content negotiation" is required. Not all clients will support all bundle formats or even URLs (advanced TLS requirements, etc). To ensure the highest uptake possible, a server needs to advertise multiple versions of bundles and clients need to be able to choose the most appropriate from that list one. The "attributes" in each server-advertised entry facilitate this filtering and sorting. Their use will become apparent in subsequent patches. Initial inspiration and credit for the idea of cloning from static files belongs to Augie Fackler and his "lookaside clone" extension proof of concept.
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 09 Oct 2015 11:22:01 -0700
parents f2719b387380
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 11846
diff changeset
1 Issue586: removing remote files after merge appears to corrupt the
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 11846
diff changeset
2 dirstate
4535
720ae5085ee3 commit: fix bug where dirstate for removed file is confused
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
3
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
4 $ hg init a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
5 $ cd a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
6 $ echo a > a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
7 $ hg ci -Ama
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
8 adding a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
9
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
10 $ hg init ../b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
11 $ cd ../b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
12 $ echo b > b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
13 $ hg ci -Amb
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
14 adding b
4535
720ae5085ee3 commit: fix bug where dirstate for removed file is confused
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
15
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
16 $ hg pull -f ../a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
17 pulling from ../a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
18 searching for changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
19 warning: repository is unrelated
13742
7abab875e647 discovery: avoid discovery when local graph is a subset of remote
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 12399
diff changeset
20 requesting all changes
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
21 adding changesets
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
22 adding manifests
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
23 adding file changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
24 added 1 changesets with 1 changes to 1 files (+1 heads)
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
25 (run 'hg heads' to see heads, 'hg merge' to merge)
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
26 $ hg merge
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
28 (branch merge, don't forget to commit)
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
29 $ hg rm -f a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
30 $ hg ci -Amc
4535
720ae5085ee3 commit: fix bug where dirstate for removed file is confused
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
31
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
32 $ hg st -A
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
33 C b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
34 $ cd ..
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
35
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 11846
diff changeset
36 Issue1433: Traceback after two unrelated pull, two move, a merge and
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 11846
diff changeset
37 a commit (related to issue586)
4535
720ae5085ee3 commit: fix bug where dirstate for removed file is confused
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
38
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
39 create test repos
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
40
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
41 $ hg init repoa
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
42 $ touch repoa/a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
43 $ hg -R repoa ci -Am adda
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
44 adding a
7564
f1af59451c0c localrepo: fix bad manifest delta generation (issue1433)
Patrick Mezard <pmezard@gmail.com>
parents: 4535
diff changeset
45
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
46 $ hg init repob
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
47 $ touch repob/b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
48 $ hg -R repob ci -Am addb
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
49 adding b
7564
f1af59451c0c localrepo: fix bad manifest delta generation (issue1433)
Patrick Mezard <pmezard@gmail.com>
parents: 4535
diff changeset
50
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
51 $ hg init repoc
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
52 $ cd repoc
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
53 $ hg pull ../repoa
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
54 pulling from ../repoa
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
55 requesting all changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
56 adding changesets
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
57 adding manifests
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
58 adding file changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
59 added 1 changesets with 1 changes to 1 files
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
60 (run 'hg update' to get a working copy)
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
61 $ hg update
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
63 $ mkdir tst
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
64 $ hg mv * tst
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
65 $ hg ci -m "import a in tst"
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
66 $ hg pull -f ../repob
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
67 pulling from ../repob
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
68 searching for changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
69 warning: repository is unrelated
13742
7abab875e647 discovery: avoid discovery when local graph is a subset of remote
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 12399
diff changeset
70 requesting all changes
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
71 adding changesets
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
72 adding manifests
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
73 adding file changes
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
74 added 1 changesets with 1 changes to 1 files (+1 heads)
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
75 (run 'hg heads' to see heads, 'hg merge' to merge)
7564
f1af59451c0c localrepo: fix bad manifest delta generation (issue1433)
Patrick Mezard <pmezard@gmail.com>
parents: 4535
diff changeset
76
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
77 merge both repos
7564
f1af59451c0c localrepo: fix bad manifest delta generation (issue1433)
Patrick Mezard <pmezard@gmail.com>
parents: 4535
diff changeset
78
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
79 $ hg merge
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
80 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
81 (branch merge, don't forget to commit)
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
82 $ mkdir src
7564
f1af59451c0c localrepo: fix bad manifest delta generation (issue1433)
Patrick Mezard <pmezard@gmail.com>
parents: 4535
diff changeset
83
11846
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
84 move b content
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
85
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
86 $ hg mv b src
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
87 $ hg ci -m "import b in src"
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
88 $ hg manifest
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
89 src/b
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
90 tst/a
650402ea4a4f tests: unify test-586
Martin Geisler <mg@lazybytes.net>
parents: 7564
diff changeset
91
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 13742
diff changeset
92 $ cd ..