2f98b5143437bd319eadcef427caf1c73afd2e91: progress: avoid ui.configbool() lookup when progress bar is active draft default tip
Gregory Szorc <gregory.szorc@gmail.com> - Tue, 11 Dec 2018 20:31:36 -0800 - rev 53702
Push 1083 by gszorc@mozilla.com at Wed, 12 Dec 2018 04:35:34 +0000
progress: avoid ui.configbool() lookup when progress bar is active Profiling revealed that the ui.configbool('progress', 'debug') during progress bar updates was consuming a significant amount of overhead. This commit adds an attribute on progress bar instances that caches this config option. The impact on `hg perfprogress` with default options is significant: before: ! wall 4.641942 comb 4.580000 user 4.210000 sys 0.370000 (best of 3) after: ! wall 1.948626 comb 1.950000 user 1.950000 sys 0.000000 (best of 5) After this change, profiling reveals that progress.progbar.progress() is now consuming ~73% of time. This change does not improve the execution time if the progress bar is disabled. We may want a more comprehensive solution for that case, as the progress bar won't be enabled in a number of scenarios (e.g. servers and processes not attached to an interactive TTY). I also think that overhead of ~2.0s for 1M updates is a bit high. I suspect further refactoring of the progress bar can significantly reduce overhead. I don't have plans to do this, however. Differential Revision: https://phab.mercurial-scm.org/D5408
c5e2395f0a2a766126f8726ccd928a2a73ec82e2: sqlitestore: create new connections on new PIDs draft
Gregory Szorc <gregory.szorc@gmail.com> - Tue, 11 Dec 2018 15:46:46 -0800 - rev 53701
Push 1082 by gszorc@mozilla.com at Wed, 12 Dec 2018 00:02:30 +0000
sqlitestore: create new connections on new PIDs If the Mercurial process fork()s, the Python thread ID remains unchanged. The previous code for returning a SQLite connection would recycle the existing connection among all children. Mercurial can fork() when performing working directory updates. For reasons I don't fully understand, the recycling of even a read-only SQLite connection was resulting in Python raising a "DatabaseError: database disk image is malformed" exception. This message comes from the bowels of SQLite. I suspect there is some internal client state in the SQLite database somewhere and having multiple clients race to update it results in badness. Who knows. This commit teaches the "get a SQLite connection" logic to also verify the PID matches before returning an existing connection. Differential Revision: https://phab.mercurial-scm.org/D5411
76d8b20139a3b8b5835c7262216b97275845b582: rust: remove comment about error handling of AncestorsIterator draft
Yuya Nishihara <yuya@tcha.org> - Tue, 11 Dec 2018 22:23:39 +0900 - rev 53700
Push 1082 by gszorc@mozilla.com at Wed, 12 Dec 2018 00:02:30 +0000
rust: remove comment about error handling of AncestorsIterator To be align with 443eb4bc41af "rust: propagate error of index_get_parents() properly." Spotted by Georges Racinet.
4e17679c336bc38709c32d9b8972f0e402e0057a: remotefilelog: accepting a None node to cmp draft
rdamazio@google.com - Mon, 10 Dec 2018 17:49:51 -0800 - rev 53699
Push 1082 by gszorc@mozilla.com at Wed, 12 Dec 2018 00:02:30 +0000
remotefilelog: accepting a None node to cmp In context.py, basefilectx.cmp explicitly calls it with None, so it has to be supported. Specifically, this breaks "hg absorb -i" currently. Differential Revision: https://phab.mercurial-scm.org/D5409
008f3491dc5377e9e6f210e0a3f161323049db5d: perf: add perfprogress command
Gregory Szorc <gregory.szorc@gmail.com> - Mon, 10 Dec 2018 20:01:07 +0000 - rev 53697
Push 1081 by gszorc@mozilla.com at Mon, 10 Dec 2018 21:46:46 +0000
perf: add perfprogress command I've noticed that progress bars can add significant overhead to tight loops. Let's add a perf command that attempts to isolate that overhead. With a default hgrc, iteration over 1M items appears to take ~3.75s on my machine. Profiling reveals ~28% of time is spent in ui.configbool() resolving the value of the progress.debug config option. Even if I set progress.disable=true, execution still takes ~2.60s, with ~59% of the time spent in ui.configbool(). Differential Revision: https://phab.mercurial-scm.org/D5407
08cfa77d7288f1d31e25238fd1645b7153607e47: wireprotov2: unify file revision collection and linknode derivation
Gregory Szorc <gregory.szorc@gmail.com> - Mon, 10 Dec 2018 18:55:08 +0000 - rev 53696
Push 1081 by gszorc@mozilla.com at Mon, 10 Dec 2018 21:46:46 +0000
wireprotov2: unify file revision collection and linknode derivation The old mechanism for choosing which file revisions to send in the haveparents=True case was buggy in multiple ways - the most severe of which being that file revisions were excluded when they shouldn't have been. This commit unifies the logic for deriving the filenodes that will be sent by the "filesdata" command. We now consistently read files data from manifests. The "haveparents" argument now controls whether we iterate ctx.files() or use the full manifest to derive relevant files. The logic here is still woefully lacking to fully support shallow clones. It will require an API break to fully address. This commit should at least make the server APIs emit proper data, which is strictly better than before. Differential Revision: https://phab.mercurial-scm.org/D5406
3ed77780f4a6f229a5c09266132a7a05e1c0629f: wireprotov2: send linknodes to emitfilerevisions()
Gregory Szorc <gregory.szorc@gmail.com> - Mon, 10 Dec 2018 18:04:12 +0000 - rev 53695
Push 1081 by gszorc@mozilla.com at Mon, 10 Dec 2018 21:46:46 +0000
wireprotov2: send linknodes to emitfilerevisions() Previously, linknodes were calculated within emitfilerevisions() by using filectx.introrev(), which would always use the linkrev/linknode as recorded by storage. This is wrong for cases where the receiver doesn't have the changeset the linknode refers to. This commit changes the logic for linknode emission so the mapping of filenode to linknode is computed by the caller and passed into emitfilerevisions(). As part of the change, linknodes for "filesdata" in the haveparents=False case are now correct: the existing code performed a manifest walk and it was trivial to plug in the correct linknode. However, behavior for the haveparents=True case is still wrong because it relies on filtering linkrevs against the outgoing set in order to determine what to send. This will be fixed in a subsequent commit. The change test test-wireproto-exchangev2-shallow.t is a bit wonky. The test repo has 6 revisions. The changed test is performing a shallow clone with depth=1. So, only file data for revision 5 is present locally. So, the new behavior of associating the linknode with revision 5 for every file revision seems correct. Of course, when backfilling old revisions, we'll want to update the linknode. But this problem requires wire protocol support and we'll cross that bridge later. Differential Revision: https://phab.mercurial-scm.org/D5405
ca6372b7e5660f2670cface7ce85222dad0e0d8d: tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com> - Mon, 10 Dec 2018 17:26:12 +0000 - rev 53694
Push 1081 by gszorc@mozilla.com at Mon, 10 Dec 2018 21:46:46 +0000
tests: add tests for server-side linknode adjustment with wireprotov2 The current implementation of linknode serving in wireprotov2 simply serves up the linkrev/linknode as stored: it doesn't attempt to adjust the linknode to what the receiver is aware of. This can result in the client seeing a linknode referencing a changeset that is unknown to it. This commit adds test coverage of that scenario. The tests in test-wireproto-command-filesdata.t demonstrate two failures. First, the linknode refers to a changeset not in the available set. Second, the server doesn't send a file revision that it should have (because of linkrev filtering). The test in test-wireproto-exchange.t demonstrates that the lack of a file revision results in a corrupted repository on the client. Differential Revision: https://phab.mercurial-scm.org/D5404
afdbc9c6a333d01f86bfee31bae183dec80a5062: tests: fix empty commit in test
Gregory Szorc <gregory.szorc@gmail.com> - Mon, 10 Dec 2018 16:53:09 +0000 - rev 53693
Push 1081 by gszorc@mozilla.com at Mon, 10 Dec 2018 21:46:46 +0000
tests: fix empty commit in test This was almost certainly a bug. Differential Revision: https://phab.mercurial-scm.org/D5403
5014e93a569609cec4b373b27f2a6b56699d9894: tests: add sparserevlog requirement to test-sqlitestore.t
Gregory Szorc <gregory.szorc@gmail.com> - Mon, 10 Dec 2018 19:41:43 +0000 - rev 53686
Push 1079 by gszorc@mozilla.com at Mon, 10 Dec 2018 19:44:59 +0000
tests: add sparserevlog requirement to test-sqlitestore.t Looks like this test was missed when enabling sparse revlogs by default. Differential Revision: https://phab.mercurial-scm.org/D5402
a0886a4d6dce8a680b2013f49a859811b5b6da9f: tests: remove all transitional configuration
Boris Feld <boris.feld@octobus.net> - Mon, 12 Nov 2018 02:21:52 +0100 - rev 53685
Push 1079 by gszorc@mozilla.com at Mon, 10 Dec 2018 19:44:59 +0000
tests: remove all transitional configuration Now that sparse-revlog is enabled by default, we no longer needs it. Differential Revision: https://phab.mercurial-scm.org/D5346
3764330f76a6731c511fc47f5c347d85dca156de: sparse-revlog: enabled by default
Boris Feld <boris.feld@octobus.net> - Mon, 12 Nov 2018 01:22:38 +0100 - rev 53684
Push 1079 by gszorc@mozilla.com at Mon, 10 Dec 2018 19:44:59 +0000
sparse-revlog: enabled by default The feature provides large benefits. It now seems mature enough to be enabled by default. * It solves catastrophic issues regarding delta storage in revlog, * It allows for shorter delta chain in all repositories, improving performances. Running benchmark of a wide range of operation did not reveal problematic impact. Performance gains are observed where expected. The format is supported by Mercurial version 4.7. So it seems safe to enable it by default now. Here is a reminder of key numbers regarding this delta strategy effect on repository size and performance. Effect on Size: =============== For repositories with a lot of branches, sparse-revlog significantly improve size, fixing limitation associated with the span of a delta chain. In addition, sparse-revlog, deal well with limitations of the delta chain length. For large repositories, this allows for a stiff reduction of the delta chain without a problematic impact on the repository size. This delta chain length improvement helps all repositories, not just the ones with many branches. As a reminder, here are the default chain limits for each "format": * no-sparse: none * sparse: 1000 Mercurial --------- Manifest Size: limit | none | 1000 ------------|-------------|------------ no-sparse | 6 143 044 | 6 269 496 sparse | 5 798 796 | 5 827 025 Manifest Chain length data limit || none || 1000 value || average | max || average | max ------------||---------|---------||---------|--------- no-sparse || 429 | 1 397 || 397 | 1 000 sparse || 326 | 1 290 || 313 | 1 000 Full Store Size limit | none | 1000 ------------|-------------|------------ no-sparse | 46 944 775 | 47 166 129 sparse | 46 622 445 | 46 723 774 pypy ---- Manifest Size: limit | none | 1000 ------------|-------------|------------ no-sparse | 52 941 760 | 56 200 970 sparse | 26 348 229 | 27 384 133 Manifest Chain length data limit || none || 1000 value || average | max || average | max ------------||---------|---------||---------|--------- no-sparse || 769 | 3 889 || 390 | 1 000 sparse || 1 223 | 3 846 || 495 | 1 000 Full Store Size limit | none | 1000 ------------|-------------|------------ no-sparse | 336 050 203 | 339 309 413 sparse | 338 673 985 | 339 709 889 Mozilla ------- Manifest Size: limit | none | 1000 ------------|----------------|--------------- no-sparse | 215 096 339 | 1 708 853 525 sparse | 188 947 271 | 278 894 170 Manifest Chain length data limit || none || 1000 value || average | max || average | max ------------||---------|---------||---------|-------- no-sparse || 20 454 | 59 562 || 491 | 1 000 sparse || 23 509 | 69 891 || 489 | 1 000 Full Store Size limit | none | 1000 ------------|----------------|--------------- no-sparse | 2 377 578 715 | 3 876 258 798 sparse | 2 441 677 137 | 2 535 997 381 Netbeans -------- Manifest Size: limit | none | 1000 ------------|----------------|--------------- no-sparse | 130 088 982 | 741 590 565 sparse | 118 836 887 | 159 161 207 Manifest Chain length data limit || none || 1000 value || average | max || average | max ------------||---------|---------||---------|--------- no-sparse || 19 321 | 61 397 || 510 | 1 000 sparse || 21 240 | 61 583 || 503 | 1 000 Full Store Size limit | none | 1000 ------------|----------------|--------------- no-sparse | 1 160 013 008 | 1 771 514 591 sparse | 1 164 959 988 | 1 205 284 308 Private repo #1 --------------- Manifest Size: limit | none | 1000 ------------|-----------------|--------------- no-sparse | 33 725 285 081 | 33 724 834 190 sparse | 350 542 420 | 423 470 579 Manifest Chain length data limit || none || 1000 value || average | max || average | max ------------||---------|---------||---------|--------- no-sparse || 282 | 8 885 || 113 | 1 000 snapshot || 3 655 | 8 951 || 530 | 1 000 Full Store Size limit | none | 1000 ------------|----------------|--------------- no-sparse | 41 544 149 652 | 41 543 698 761 sparse | 8 448 037 300 | 8 520 965 459 Effect on speed: ================ Performances are strongly impacted by the delta chain length. Longer chain results in slower revision restoration. For this reason, the 1000 chain limit introduced by sparse-revlog helps repository with previously large chains a lot. In our corpus, this means `netbeans` and `mozilla-central` who suffered from unreasonable manifest delta chain length. Another way sparse revlog helps, is by producing better delta's. For repositories with many branches, the pathological patterns that resulted in many sub-optimal deltas are gone. Smaller delta help with operations where deltas are directly relevant, like bundle. However, the sparse-revlog logic introduces some extra processing and a more throughout testing of possible delta candidates. Adding an extra cost in some cases. This cost is usually counterbalanced by the other performance gain. However, for smaller repositories not affected by delta chain length issues or branching related issues, this might make things a bit slower. However, these are also repository where revlog performance is dwarfed by other costs. Below are the summary of some timing from the performance test suite running at `http://perf.octobus.net/` for a handful of key commands and operation. It is important to keep in mind that most of this command works on the tip part of the repository. The non-sparse and sparse version produce different delta chains and the tip revision can end up at an arbitrary point of these chains. This will impact some performance number listed in this summary. For the record: here is the delta chain length for the tip revision of manifest log in the benchmarked repository: | no-sparse | sparse | mercurial | 94 | 904 | pypy | 23 | 673 | netbeans | 4158 | 258 | mozilla | 63263 | 781 | As you can see, the chain length for mercurial and pypy turn out to be significantly longer. The netbeans and mozilla one get shorter because these repositories benefit from the maximum chain length. Timing for `hg commit`: ----------------------- The time taken by `hg commit` does not varies significantly, no drawback for using sparse here. | no-sparse | sparse | mercurial | 68.1ms | 66.7ms | pypy | 95.0ms | 94.1ms | netbeans | 614.0ms | 611.0ms | mozilla | 1340.0ms | 1.320.0ms | Check the final section for statistics on a wider array of write. Timing for bundling 10 000 changesets ------------------------------------- The repository that benefits from better delta see a good performance boost. The other ones are not significantly affected. | no-sparse | sparse | mercurial | 3.1s | 3.0s | pypy | 25.1s | 7.5s | netbeans | 24.2s | 17.0s | mozilla | 23.7s | 25.0s | Timing for unbundling 1 000 changesets -------------------------------------- Mercurial and mozilla are unaffected. The pypy repository benefit well from the better delta. However, the netbeans repository takes a visible hit. Digging that difference reveals that it comes from the sparse-revlog bundle having to deal with a snapshot that was re-encoded in the bundle. The slow path for adding new a revision had to be triggered for it, slowing things down. The Sparse versions do not have such snapshot to handle similar cases in the tested configuration. | no-sparse | sparse | mercurial | 519ms | 502ms | pypy | 1.270ms | 886ms | netbeans | 1.370ms | 2.250ms | mozilla | 3.230ms | 3.210ms | Netbeans benefits from the better deltas in other dimensions too. For example, the produced bundle is significantly smaller: * netbeans-no-sparse.hg: 2.3MB * netbeans-sparse.hg: 1.9MB Timing to restore the tip most manifest entry: ---------------------------------------------- Nothing surprising here. The timing for mercurial and pypy are within a small range where they won't affect performance much. In our tested case, they are slower as they use a longer chain. Timing for netbeans and mozilla improves a lot. Removing a significant amount of time. | no-sparse | sparse | mercurial | 1.09ms | 3.15ms | pypy | 4.11ms | 10.70ms | netbeans | 239.00ms | 112.00ms | mozilla | 688.00ms | 198.00ms | Reading 100 revision in descending order: ----------------------------------------- We see the same kind of effect when reading the last 100 revisions. Large boost for netbeans and mozilla, as they use much smaller delta chain. Mercurial and pypy longer chain means slower reads, but nothing gets out of control. | no-sparse | sparse | mercurial | 0.089s | 0.268s | pypy | 0.259s | 0.698s | netbeans | 125.000s | 20.600s | mozilla | 23.000s | 11.400s | Writing from full text: statistic for the last 30K revisions ------------------------------------------------------------ This benchmark adds revisions to revlog from their full text. This is similar to the work done during a commit, but for a large amount of revisions so that we get a more relevant view. We see better overall performances with sparse-revlog. The very worst case is usually slower with sparse-revlog, but does not gets out of control. For the vast majorities of the other writes, sparse-revlog is significantly faster for larger repositories. This is reflected in the accumulated rewrite time for netbeans and mozilla. The notable exception is the pypy repository where things get slower. The extra processing is not balanced by shorter delta chain. However, this is to be seen as a blocking issue. First, the overall time spend dealing with revlog for the repository pypy size is small compared to the other costs, so we get slower on operations that matter less than for other larger repository. Second, we still get nice size benefit from using sparse-revlog, smaller repo size brings other usability and speed benefit (eg: bundle size). max time | no-sparse | sparse | mercurial | 0.010143s | 0.045280s | pypy | 0.034924s | 0.243288s | netbeans | 0.605371s | 2.130876s | mozilla | 1.478342s | 3.424541s | 99% time | no-sparse | sparse | mercurial | 0.003774s | 0.003758s | pypy | 0.017387s | 0.025310s | netbeans | 0.576913s | 0.271195s | mozilla | 1.478342s | 0.449661s | 95% time | no-sparse | sparse | mercurial | 0.002069s | 0.002120s | pypy | 0.010141s | 0.014797s | netbeans | 0.540202s | 0.258644s | mozilla | 0.654830s | 0.243440s | full time | no-sparse | sparse | mercurial | 14.15s | 14.87s | pypy | 90.50s | 137.12s | netbeans | 6401.06s | 3411.14s | mozilla | 3086.89s | 1991.97s | Differential Revision: https://phab.mercurial-scm.org/D5345
e8cd688b2eb1be5695194fa936e830e7dc0fcef4: test: preemptively disable sparse-revlog for some of test-upgrade-repo
Boris Feld <boris.feld@octobus.net> - Mon, 12 Nov 2018 01:22:30 +0100 - rev 53683
Push 1079 by gszorc@mozilla.com at Mon, 10 Dec 2018 19:44:59 +0000
test: preemptively disable sparse-revlog for some of test-upgrade-repo Some part of this test assumes sparse-revlog is off. We enforce it explicitly. Differential Revision: https://phab.mercurial-scm.org/D5344
aeac89e78defa617bdf8c634ddadbe2e7f038c20: test: enable sparse-revlog for test-wireproto-content-redirects.t
Boris Feld <boris.feld@octobus.net> - Mon, 12 Nov 2018 01:19:48 +0100 - rev 53682
Push 1079 by gszorc@mozilla.com at Mon, 10 Dec 2018 19:44:59 +0000
test: enable sparse-revlog for test-wireproto-content-redirects.t We are about to enable sparse-revlog globally. To help with reviewing the tests change, we isolate them in individual changesets. Differential Revision: https://phab.mercurial-scm.org/D5343
e64a28e2a1f231897b328bc9a5e7cf37a1b83a38: test: enable sparse-revlog for test-wireproto-command-capabilities.t
Boris Feld <boris.feld@octobus.net> - Mon, 12 Nov 2018 01:18:58 +0100 - rev 53681
Push 1079 by gszorc@mozilla.com at Mon, 10 Dec 2018 19:44:59 +0000
test: enable sparse-revlog for test-wireproto-command-capabilities.t We are about to enable sparse-revlog globally. To help with reviewing the tests change, we isolate them in individual changesets. Differential Revision: https://phab.mercurial-scm.org/D5342
cebaaa38f8fd9986b2896ba55ef8ce1fec70b4db: test: enable sparse-revlog for test-wireproto-caching.t
Boris Feld <boris.feld@octobus.net> - Mon, 12 Nov 2018 01:18:45 +0100 - rev 53680
Push 1079 by gszorc@mozilla.com at Mon, 10 Dec 2018 19:44:59 +0000
test: enable sparse-revlog for test-wireproto-caching.t We are about to enable sparse-revlog globally. To help with reviewing the tests change, we isolate them in individual changesets. Differential Revision: https://phab.mercurial-scm.org/D5341
37cc627c59596e2af74be5bddafe28c8cae18044: test: enable sparse-revlog for test-treemanifest.t
Boris Feld <boris.feld@octobus.net> - Mon, 12 Nov 2018 01:18:33 +0100 - rev 53679
Push 1079 by gszorc@mozilla.com at Mon, 10 Dec 2018 19:44:59 +0000
test: enable sparse-revlog for test-treemanifest.t We are about to enable sparse-revlog globally. To help with reviewing the tests change, we isolate them in individual changesets. Differential Revision: https://phab.mercurial-scm.org/D5340
6679ce31dfcb0457da1d1bc17fa7bc201ee43cdb: test: enable sparse-revlog for test-stream-bundle-v2.t
Boris Feld <boris.feld@octobus.net> - Mon, 12 Nov 2018 01:18:16 +0100 - rev 53678
Push 1079 by gszorc@mozilla.com at Mon, 10 Dec 2018 19:44:59 +0000
test: enable sparse-revlog for test-stream-bundle-v2.t We are about to enable sparse-revlog globally. To help with reviewing the tests change, we isolate them in individual changesets. Differential Revision: https://phab.mercurial-scm.org/D5339
8fcda0780136bc7b27beae1189c334f97c1bdcd3: test: enable sparse-revlog for test-ssh.t
Boris Feld <boris.feld@octobus.net> - Mon, 12 Nov 2018 01:18:03 +0100 - rev 53677
Push 1079 by gszorc@mozilla.com at Mon, 10 Dec 2018 19:44:59 +0000
test: enable sparse-revlog for test-ssh.t We are about to enable sparse-revlog globally. To help with reviewing the tests change, we isolate them in individual changesets. Differential Revision: https://phab.mercurial-scm.org/D5338
4bb6195755b17797bac68524e10191cba46b7e60: test: enable sparse-revlog for test-ssh-proto-unbundle.t
Boris Feld <boris.feld@octobus.net> - Mon, 12 Nov 2018 01:17:05 +0100 - rev 53676
Push 1079 by gszorc@mozilla.com at Mon, 10 Dec 2018 19:44:59 +0000
test: enable sparse-revlog for test-ssh-proto-unbundle.t We are about to enable sparse-revlog globally. To help with reviewing the tests change, we isolate them in individual changesets. Differential Revision: https://phab.mercurial-scm.org/D5337
(0) -30000 -300 -100 -50 -20 tip