Commit Graph

288 Commits

Author SHA1 Message Date
Augie Fackler
4451faca7e test-http: save access log and make sure we actually use request batching 2015-08-21 12:51:40 -04:00
Augie Fackler
226a6f1027 fileserverclient: add config knob to control batch size
Previously we'd just send one enormous batch for everything to the
server. This led to prolonged periods of no progress output for the
user. Now we send batches in smaller chunks (default is 100) which
gives the user some idea that things are working.

Includes a trivial test, which doesn't really verify that the batching
logic is used as described, but at least prevents the boneheaded error
I had in an earlier (unmailed) version of this patch which forgot to
use configint() when loading the config setting.
2015-08-18 15:14:01 -04:00
Augie Fackler
06c09f03ab fileserverclient: correctly use exception constructor
We were passing one argument instead of 3.
2015-08-18 15:35:21 -04:00
Augie Fackler
51f7cac5a7 getfile: add error reporting to getfile method
Without this, the only way to report a failure of a file load in a
batched set of getfile requests is to fail the entire batch, which is
potentially painful. Instead, add our own error reporting in-band
which the client can then detect and raise.

I'm not completely happy with the somewhat adhoc error reporting here,
but we expect our server to have at least one additional error ("not
allowed to see file contents") which will require some special
handling on our end, so we need some level of flexibility in the error
reporting protocol so we can extend it later. Sigh.

Open question: should we reserve some range of error codes so that
it's easy for strange custom servers to have related monkeypatches to
client code for custom handling of unforseen-by-remotefilelog
conditions?

I couldn't figure out how to actually get the client to try loading
file contents over http in the test, but the get-with-headers test at
least proves that the server responses look the way I expect.
2015-08-04 14:59:53 -04:00
Durham Goode
5bb4351364 prefetch: add prefetching to bundle receiving
We were not prefetching the potential dependent files for the filelog revisions
we received over the wire. This resulted in a lot of non-batched downloads,
which was super slow. This fixes it by batch downloading the parents and delta
parents of the incoming filelog revisions and adds a test.
2015-07-21 18:32:33 -07:00
Durham Goode
9152c8be08 fileserverclient: fix progress bar
A previous commit changed count to be a list, but missed the use of it when
being passed to progress. This fixes it.
2015-07-21 18:31:01 -07:00
Augie Fackler
5e7fb3d85f test-gc: filter wc output as suggested by check-code
wc's output is not wholly portable: BSD wc likes to prepend some whitespace.
2015-07-16 12:07:17 -04:00
Augie Fackler
ea78b4307a test-gc: work around lack of -d on BSD touch
touch -t is portable, but requires some computation to get a date
value that's a week ago. A Python oneliner is a little goofy, but
seemed like a straightforward enough answer that I chose that.
2015-07-16 12:06:37 -04:00
Augie Fackler
30c29e5afc test-push-pull: glob out total line from ls since it's platform-specific 2015-07-16 11:57:20 -04:00
Augie Fackler
26ab790f75 fileserverclient: mark getfile as batchable
This lets clients send many getfile requests in a single transaction.

Note that this requires 76fcf62accb0 be applied to your Mercurial, or
you'll be bitten by a bug[0] in Mercurial's wireproto batching. As a
result of this change, remotefilelog now effectively requires the
upcoming Mercurial 3.5 if you want to use a specific release.

0: http://bz.selenic.com/show_bug.cgi?id=4739
2015-06-30 17:34:01 -04:00
Augie Fackler
16310f95f3 remotefilelog: introduce new getfile method
Right now, this is a naive fetch-one-file method. The next change will
mark the method as batchable and use a batch in the client so that
many files can be requested in a single RPC.
2015-06-30 17:32:31 -04:00
Augie Fackler
adef2bd2d0 remotefilelogserver: move umask twiddling for cache into _loadfileblob
This narrows the interval during which we've modified umask, which
seems nice. Done as a separate change for clarity.
2015-06-30 16:58:15 -04:00
Augie Fackler
d2f7930f70 fileserverclient: tease out a _getfiles method
This will make it easier to detect servers that support _getfiles2 and
prefer that method when available.
2015-06-30 16:43:18 -04:00
Augie Fackler
5966446c14 remotefilelogserver: tease out a _loadfileblob method for future use
We're about to introduce a new getfiles method, so let's take this
opportunity to split out the file loading code so it'll be used in
only one place.
2015-06-30 15:02:07 -04:00
Augie Fackler
979732847b tests: skip tests if lz4 is missing
This prevents lots of useless test output if lz4 is missing on a machine.
2015-07-16 11:28:28 -04:00
Augie Fackler
882ca8e705 remotefilelogserver: prevent getfiles from being called over http at all
This means that even old clients that fail to sniff for capabilities
before trying getfiles will get a sensible error message back from the
server.
2015-06-30 11:04:47 -04:00
Augie Fackler
4e4a3a3a7b remotefilelogserver: disable remotefilelog serving over non-ssh protocols 2015-06-29 16:34:31 -04:00
Augie Fackler
e2d021637c fileserverclient: refuse to operate on a non-sshpeer
The way the protocol is defined for getfiles interleaves reading
filenames and sending file contents, which works fine over ssh but is
incompatible with http.

This change is probably not neccessary now that remotefilelog
correctly checks for its own capability first, but it helped me debug
so I left it in for completeness.
2015-06-29 16:25:44 -04:00
Augie Fackler
dd2e200ad1 fileserverclient: sniff for remotefilelog capability before using it
This prevents clients from causing a server problem on an http server.
2015-06-29 17:33:56 -04:00
Augie Fackler
47b5fdf12d test-push-pull: while it's convenient, verify remotefilelog capability
Since this test is operating over "ssh", we should see the
remotefilelog capability here.
2015-06-29 18:10:00 -04:00
Augie Fackler
32cb84c8b7 remotefilelogserver: restrict remotefilelog capability to ssh
This only works over ssh, so let's not pretend otherwise.

A future change will ensure the capability is still advertised via ssh.
2015-06-29 17:36:25 -04:00
Augie Fackler
5a72282b12 remotefilelogserver: wrap wireproto._capabilities
If we instead wrap wireproto.capabilities, then our capabilities don't
get transmitted via the hello command, so not all clients will notice
the new capability unless we do the wrapping here.

Test output is in the test that previously demonstrated the
defect. Note that there's still a defect: we're advertising the
capability over http even though we have no hope of the getfiles
method working over http.
2015-06-29 17:35:32 -04:00
Augie Fackler
965e22e01f test-http: new test that demonstrates a few defects
1) The client doesn't look-before-you-leap on the remotefilelog capability

2) The http server crashes ungracefully when handling a remotefilelog
request (ideally it should respond with '400 No Such Method' as a
server without the extension would.)

3) capabilities are inconsistently advertised between cmd=hello and
cmd=capabilities.

Future patches will attempt to clean up most of this.
2015-06-29 16:43:54 -04:00
Augie Fackler
2c11d5bbf8 remotefilelog: stop declaring remotefilelog to be an hg-internal extension
The magic string 'internal' causes Mercurial to never blame
remotefilelog for being broken. I had suspected that remotefilelog
might work with 3.4, but the tests fail against 3.4.1, so I'm just
making testedwith empty.
2015-07-01 15:58:44 -04:00
Durham Goode
87ac4a0c9e Fix building revgraph across merge commits
The rev graph building code was flawed because it didn't track second parents
correctly. This was caught when someone was developing an extension and
attempted to commit a merge commit in some way.
2015-06-30 16:43:01 -07:00
Augie Fackler
5eecca9702 remotefilelog: handle the death of repo.sopener (hg change 0bbe3294361a)
repo.sopener has been deprecated since hg 2.3, and repo.svfs replaces
it. Since it's been dead for so long, let's just use svfs and call it
good enough.
2015-06-30 10:12:38 -04:00
Durham Goode
047afeff5f hooks: remove incominghook
Summary:
The incominghook was meant to pregenerate any remotefilelog blobs that were
likely to be needed shortly. Unfortunately it actually just slows down pushes,
since in large repos the hook takes longer than the push does sometimes.

So let's just remove it.

Test Plan: Apparently there were no tests for this :p

Reviewers: sid0, lcharignon, mitrandir, ericsumner, rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D2185894

Signature: t1:2185894:1435126819:e1e1125520411356eccff4baee31ab2938ebc0fe
2015-06-23 20:03:57 -07:00
Mateusz Kwapich
7800dae8f4 tests: repair test output due to upstream changes 2015-06-19 16:13:18 -07:00
Siddharth Agarwal
c45c59236b remove prefetch from the short help list
Summary: I really don't think it should be in this list.

Test Plan: `hg`

Reviewers: durham, #sourcecontrol, rmcelroy

Reviewed By: durham, #sourcecontrol, rmcelroy

Subscribers: rmcelroy

Differential Revision: https://phabricator.fb.com/D1997655

Signature: t1:1997655:1429189594:aa8f355a6fc61e300f824be6b2fbd64a42dde2b5
2015-04-16 00:38:43 -07:00
Durham Goode
93e4a455ff clone: fix streaming clones
Upstream refactored the streaming clone api, so we need to adjust accordingly.
2015-05-27 17:29:34 -07:00
Durham Goode
acea316460 Fix blob generation with adjustlinkrevs
Summary:
When adjustlinkrevs got moved to the filectx upstream, we incorrectly
moved it to the remotefilectx inside remotefilelog. We don't actually use
remotefilectx on the server, so wrapping it did nothing.

The fix is to move the wrapping to be in remotefilelogserver.py so it is
executed on the server side.

Test Plan:
Did a checkout with my shallow client pointed at a full repo with no
blob cache. Verified it went quickly (minutes, instead of hours).

Reviewers: pyd

Differential Revision: https://phabricator.fb.com/D2097851
2015-05-22 21:32:12 -07:00
Durham Goode
95e9918016 sparse: remove sparse-filtered results from copy tracing
Summary:
Since we only prefetch things that are in the sparse checkout, copy tracing
(which touches everything in the manifest diff) would do individual file
downloads for every file.  Let's just remove those files from the copy tracing
check entirely since the user probably doesn't care if they're outside the
sparse checkout.

Test Plan: Added a test

Reviewers: sid0, rmcelroy, lcharignon, pyd

Differential Revision: https://phabricator.fb.com/D2083768
2015-05-18 16:08:49 -07:00
Laurent Charignon
5652bd276a Match with with latest version of core to pass the test
Summary:
Match with with latest version of core to pass the test.
There were a couple of changes in core that broke the extension, I matched
those changes to make the test pass.

Test Plan: The tests are all passing

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D2053958
2015-05-07 12:50:51 -07:00
Durham Goode
b29a6b04dd Add match arg to computeforwardmissing wrapper
Upstream now has a matcher on _computeforwardmissing which will allow us to only
prefetch the necessary parts of a sparse checkout.

Since we're now being returned an iterator, we need to convert it to a list
since we iterate over it and return it.
2015-04-22 16:39:16 -07:00
Durham Goode
8bf6e4f004 sparse: make remotefilelog aware of sparse checkouts
Summary:
Previously remotefilelog would prefetch every file in a commit. With the sparse
checkout extension we want to only prefetch things in the sparse checkout.

This commit makes remotefilelog aware of the possible existence of a sparse
matcher.

Test Plan: Added tests

Reviewers: sid0, rmcelroy, pyd, lcharignon

Subscribers: kang

Differential Revision: https://phabricator.fb.com/D1967207
2015-04-02 09:58:46 -07:00
Ryan McElroy
5a769d1fd6 ajustlinknodes: check for node in nodemap
Summary:
Per @pyd's review of D1933267, we need to check for the linknode in cl.nodemap,
not in cl (whose __contains__ method only looks for revs and doesn't even check
for visibility... lolz).

Test Plan: ran tests

Reviewers: durham, sid0, pyd, ericsumner, lcharignon, davidsp, mitrandir

Reviewed By: mitrandir

Subscribers: akushner, daviser, pyd

Differential Revision: https://phabricator.fb.com/D1934941

Tasks: 6573011

Signature: t1:1934941:1427130649:b084635db9bfcd28c4d4a1bcf12a7500c06b323c
2015-03-23 09:55:23 -07:00
Durham Goode
25efa4b886 Fix adjust linknodes for ancestries with old nodes
Summary:
The new version of adjust linknodes wasn't accounting for the fact that some
ancestries contained nodes that no longer exist. Check for that before looking
for common ancestors.

The old version of this code survived by luck. We were catching KeyErrors as one
base case, and it just happens that LookupError from the changelog is also a
KeyError, so it was getting caught and eaten.

Test Plan:
We should probably add a test, but I have to leave shortly and this is pretty
broken, so we'll have to take a rain check.

Reviewers: rmcelroy, pyd, sid0

Differential Revision: https://phabricator.fb.com/D1933267
2015-03-20 18:39:38 -07:00
Ryan McElroy
1184ee707c Fix stack overflow when dealing with long file histories
Summary:
The new fixmappinglinknodes function was using recursion to traverse the file
history, but this would break for files with history that was extremely long
(stack overflow). Switch to using a manual stack approach.

Test Plan: Ran the tests (I'd added a test to cover this logic before).

Reviewers: sid0, davidsp, mitrandir, lcharignon, pyd, rmcelroy

Reviewed By: rmcelroy

Subscribers: michaelbarton

Differential Revision: https://phabricator.fb.com/D1931944

Signature: t1:1931944:1426884986:3a0ef144fb55b8c0533e5c5de90699a1823b891f
2015-03-20 14:04:40 -07:00
Siddharth Agarwal
604cebd541 make patch.trydiff wrapper more generic
Summary: I'm going to add a new parameter upstream. Make this more generic so that we don't have to try and support both the old and the new versions.

Test Plan: Ran tests with both old and new hg.

Reviewers: davidsp, rmcelroy, akushner, pyd, daviser, mitrandir, ericsumner, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1920172

Signature: t1:1920172:1426615175:d90bda3b3cc30f6e5f3149af82ae9e43dee39455
2015-03-17 10:56:59 -07:00
Durham Goode
c599c6ae79 Extra changes related to the previous commit 2015-03-12 15:58:46 -07:00
Durham Goode
1d96446f97 push: fix pushing multiple manifests with the same file node
Summary:
Previously remotefilelog did not produce all the necessary local data blobs
when doing a peer push/pull if the incoming changegroup had two manifests
that referred to the same file revision.  We would only create a file blob
containing the history for the first occurrence, then if the user tried to
access the file history for other occurrences they got an exception.

The fix is to add linkrev fixup logic, similar to the adjustlinkrev() method
from core Mercurial's filectx. Now, if no valid local file blob can be found, we
will compute a valid history by reading the changelog.

We might be able to write this data to disk in the future as well to prevent
having to repeatedly compute this.

Test Plan: Added a test

Reviewers: sid0, rmcelroy, pyd, mitrandir, lcharignon

Differential Revision: https://phabricator.fb.com/D1904453
2015-03-10 20:02:14 -07:00
Durham Goode
8bc01a01bc prefetching: fix computenonoverlap wrapper
The computenonoverlap function has changed upstream. Update ourselves to match
it.
2015-03-10 19:59:43 -07:00
Siddharth Agarwal
43e26aff3b shallowrepo: prefetch files before a commitctx
Summary:
For hg-git conversions we're going to cause commits without actually updating to the base. Currently, this will cause lots of individual fetches.

The test demonstrates the issue -- wihtout this patch it'll fetch the 2 files over 2 fetches, but with it it'll fetch the files over 1 fetch.

Test Plan: Ran the tests.

Reviewers: davidsp, rmcelroy, akushner, pyd, daviser, mitrandir, ericsumner, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1893721

Tasks: 6390769

Signature: t1:1893721:1425624679:5651f71d5023919e9321646275b681b573847c44
2015-03-05 16:06:12 -08:00
Durham Goode
8203e771e3 Fix store/data permissions to have g+w
Previously we only set the umask for shared caches. Let's set it for
.hg/store/data as well so shallow repos can be used for shared repositories.
2015-02-25 17:13:49 -08:00
Durham Goode
74c8469821 Update copy wrapping to use new upstream functions
Upstream has refactored the copy logic to compute the file lists in separate
functions, so we no longer need to compute the file lists ourselves.

Update the README's Mercurial min-version since this change depends on new APIs
inside Mercurial.
2015-01-27 19:20:47 -08:00
Durham Goode
f84dcdee5d Move _adjustlinkrev onto remotefilectx
Summary:
Upstream has moved _adjustlinkrev from being a global function to one
on the filectx. Let's do the same.

Test Plan: Ran the tests

Reviewers: mitrandir

Differential Revision: https://phabricator.fb.com/D1825043
2015-02-03 18:59:00 -08:00
Eric Sumner
0da5725c2a remotefilelog: fix tests
Summary:
Copy updated ##run-tests.py## from hg-crew and fix backup bundle
names in tests

Test Plan: ##run-tests.py##

Reviewers: sid0, daviser, davidsp, mitrandir, akushner, rmcelroy, pyd, mpm, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1813206

Signature: t1:1813206:1422567577:d1a18838a0a735e25e7d89c21af1d1f3303b6ba4
2015-01-29 13:35:35 -08:00
Durham Goode
07359d1038 Change server blob creation to not use adjustlinkrev
Summary:
adjustlinkrev makes ancestor reading orders of magnitude slower,
so we need to avoid using it. Since adjustlinkrev already returns the linkrev in
certain cases, let's just force it to always return that during file blob
creation.

Test Plan:
Generated a few thousand blobs for www and fbcode using the old and new
methods and verified that they were byte-for-byte identical.

Reviewers: sid0, pyd, mpm, rmcelroy

Differential Revision: https://phabricator.fb.com/D1782400
2015-01-14 13:14:35 -08:00
Durham Goode
d56fa342f0 Improve error message when fallback server isn't configured
Summary:
If the remotefilelog server was not specified in the hgrc, or if the project
hgrc wasn't trusted, it would throw an obtuse error about a NoneType string.
This fixes it to give a more informative error explaining the problem.

Test Plan: Added a test

Reviewers: sid0, pyd, mitrandir, ericsumner, rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D1774743

Signature: t1:1774743:1420830544:5122a8e11f668ee8c35996e0f4395883a31ce8b0
2015-01-09 09:43:14 -08:00
Durham Goode
4d92ad3ed7 Add optional cache validation
Summary:
There are reports of the local cache becoming invalid when stored on disk. This
adds an option that will do some basic validation and remediation for those
entries, and log some data to disk.

This is optional, since it incurs some performance overhead. We just want to use
it long enough to track down the issue.

Test Plan: Added a test

Reviewers: sid0, pyd, ericsumner, rmcelroy, mitrandir

Reviewed By: mitrandir

Differential Revision: https://phabricator.fb.com/D1774724

Signature: t1:1774724:1420827432:06ace9d1dc078f469e0f61ebd7f604fc3b606f6d
2015-01-08 18:59:04 -08:00