Commit Graph

60 Commits

Author SHA1 Message Date
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
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
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
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
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
Mateusz Kwapich
7800dae8f4 tests: repair test output due to upstream changes 2015-06-19 16:13:18 -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
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
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
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
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
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
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
Durham Goode
5f69d8dd0b Improve error message for corrupt cache files
Summary:
We've gotten reports of corrupt cache files, and the error message is pretty
obtuse (ValueError for converting a string to an int). This refactors the size
check into a function and provides a better error message.

Test Plan: Added a test

Reviewers: sid0, pyd, mitrandir, ericsumner, rmcelroy

Reviewed By: rmcelroy

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

Signature: t1:1774721:1420830671:afd54dde8fdc00e08ed1c6cb73bf9fdc7fac2327
2015-01-09 09:11:06 -08:00
Durham Goode
c2f3ae882b Update blame test to cover more cases
There's a slight different in core Mercurial between a blame where the file was
modified in the current commit, versus a file that was modified in an older
commit. This difference affects remotefilelog (since it uses linkrevs to look
back for the first commit), so fix the test to cover this scenario.
2015-01-09 12:24:21 -08:00
Siddharth Agarwal
c81578068e tests: fix for Mercurial 3.3+ 2014-12-29 11:20:43 -08:00
Durham Goode
666cfa56b5 Update run-tests.py 2014-12-17 16:39:39 -08:00
Durham Goode
6073af5196 Update tests due to upstream changes
a989a083752e in upstream mercurial changed which deltas get chosen for revlogs,
which affects the size of the data being transfered. So we just update the test
accordingly.
2014-11-24 21:34:40 -08:00
Siddharth Agarwal
d731468f70 [bundle2] insert ourselves into the cg1packer class hierarchy and fix up the packermap
Summary: Last bits needed to get remotefilelog over bundle2 working. Includes tests.

Test Plan: Ran tests, including with `--extra-config-opt experimental.bundle2-exp=True`

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

Reviewed By: durham

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

Tasks: 5568731

Signature: t1:1671738:1415676482:b9e7a1f308919526b0c41fee54d89da876518ec7
2014-11-07 18:35:52 -08:00
Siddharth Agarwal
dfac9098fe [tests] fix up for Mercurial 3.2
Summary:
- fixes for pulls after uncompressed clones
- add a glob where there should be one

Test Plan: Ran the tests with Mercurial @

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

Reviewed By: durham

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

Signature: t1:1668739:1415643384:567a0841ef4367ee2f905f6fe5517d229d5eadcf
2014-11-07 18:17:39 -08:00
Durham Goode
3889ee7b5d Fix relative ancestor traversals for hg blame
Certain filectx constructions used the rev number of the self._changeid.  We
need to convert that to a node before using it. This was breaking blame.  I've
now added a blame test too.
2014-10-23 17:16:07 -07:00
Durham Goode
dc5a3bf415 Allow pulling from shallow bundlerepos
Bundlerepos work by providing a fake revlog layer above an existing revlog.
Since remotefilelog doesn't use revlogs for filelogs, bundlerepo's did not work.
This commit fixes it such that you can now hg pull from a bundle, as long as
that bundle is shallow (i.e. contains no file contents). This will work for the
common use case of trying to recover data from .hg/strip-backups.

For reference, shallow bundles don't contain any file data because we never
delete any file data from .hg/store/data when using remotefilelog.  Even after
the commits have been stripped.
2014-10-23 00:01:21 -07:00
Durham Goode
65503211ed Fix revset indexing bug and update test output
repo.revs() no longer returns an object that can be indexed, so we can't use []
on it anymore. So let's use list() on it first.

The bookmark output from upstream Mercurial has also changed, so we need to
update the tests.
2014-10-14 15:30:38 -07:00
Durham Goode
8a5a5330c1 Fix pullprefetch for recently landed commits
Summary:
Pull-prefetch would not download file versions from the server if the file
version already existed in the local cache or the local store data.
Unfortunately, if someone landed their commit, then later stripped their local
version, the local store data file version might become invalid and no local
cache version would exist. Meaning things like 'commit' might fail when offline.

This changes prefetch to always fetch from the server when dealing with files it
knows are from revs on the server.

Test Plan:
Added a test that makes local commits that already exist on the
server, and verifies that a pull-prefetch fetches the server file version,
despite that same version existing locally.

Reviewers: sid0, pyd, davidsp

Subscribers: orip

Differential Revision: https://phabricator.fb.com/D1607260
2014-10-09 15:20:54 -07:00
Durham Goode
c7f1c0b383 Fix committing merges
Summary:
Upstream Mercurial changed the way merging works and added
revlog.commonancestorsheads. This changes remotefilelog to implement the same
API.

Previously we were able to use ancestors.genericancestors to do the graph
traversal. Upstream Mercurial has deleted that function though (since it is now
unused), so remotefilelog must now build a temporary rev graph in order to use
the ancestors.* apis.

Test Plan: Added a test. It failed without the fix, it passes with the fix.

Reviewers: sid0, davidsp, pyd

Differential Revision: https://phabricator.fb.com/D1566787
2014-09-19 12:21:30 -07:00
Pierre-Yves David
2c956d95e2 revert: only pre-fetch files that needs to be touched
Summary:
With recent version of mercurial (>= 3.2, 4dfcf21a6aa7), revert uses status
information to determine the files that needs to be touched. It then offer a
simple handle for extensions that needs prefetch.

Test Plan:
Ran the tests. Certain tests depended on the old revert behavior (of
prefetching everything), so they required slight changes.

Reviewers: pyd, sid0, davidsp

Differential Revision: https://phabricator.fb.com/D1551059
2014-09-08 15:20:59 +02:00
Durham Goode
580f3eaeb3 Update to match Mercurial version b8c8cacd4482
Summary:
Changegroups have been refactored upstream and we need to update our
remotefilelog monkey patching accordingly.

Also fix an issue with the tests where 'function foo()' was not considered valid
on certain systems.

Test Plan: Ran the tests

Reviewers: pyd, sid0, davidsp

Differential Revision: https://phabricator.fb.com/D1551019
2014-09-11 14:39:14 -07:00
Durham Goode
17c16cf610 Optimize pullprefetch to limit number of stats
Summary:
Previously, if pullprefetch was set, we'd perform a prefetch of the
entire manifest of the specified revs (usually the public bookmarks). This
involved stat-ing all the relevant files in the cache to see if they already
existed, which added an extra 6 seconds or so to every pull.

Now we only prefetch the files that are different from our working copy. We
assume we already have all the files that are in our working copy. This reduces
the pullprefetch overhead significantly.

Test Plan:
Did a pull on my laptop. Verified it didn't hang for 6 seconds at the
prefetch stage. Also updated a test

Reviewers: davidsp, pyd, sid0

Reviewed By: sid0

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

Tasks: 4608894
2014-08-19 09:33:31 -07:00
Durham Goode
e5228d9989 Fix pullprefetch that uses bookmarks
Summary:
Previously, pullprefetch was executed during the repo.pull stage. This happens
before the bookmarks have been moved, so revsets like 'bookmark()' would
prefetch the wrong commits.

This change moves the pullprefetch logic to after the pull command is completely
finished.  Updated a test to make sure this is caught.

Also fixes a bug where we were using linkrevs to read a manifest rev entry. We
should be using the manifest rev instead.

Test Plan: Added a test. Ran it.

Reviewers: sid0, pyd, davidsp

Differential Revision: https://phabricator.fb.com/D1483345
2014-08-06 18:50:57 -07:00
Durham Goode
c44433c62c Fix hg log on patterns
Summary:
Due to a change in upstream mercurial, hg log with patterns was no longer
working. This fixes it by forcing hg log to take the slow path when using
patterns.

It also updates the warning messages to work when running hg log <file> from
within a subdirectory.

Test Plan: Ran the new tests

Reviewers: sid0

Differential Revision: https://phabricator.fb.com/D1450193
2014-07-22 12:55:29 -07:00
Durham Goode
13058fb30c Allow auto-prefetching during pulls
Summary:
Adds a remotefilelog.pullprefetch config options that accepts a revset. Whenever
a pull is run, the revs matched by that revset will be prefetched. The most
common value for this will be '(bookmark() + heads(all())) & public()', since it will download
almost everything necessary to work offline.

Test Plan: Added a test. Ran it.

Reviewers: davidsp, pyd, sid0

Reviewed By: sid0

Differential Revision: https://phabricator.fb.com/D1419420
2014-07-03 13:05:11 -07:00
Durham Goode
c989a69647 Fix flakey tests
test-local.t was flakey because the state of the dirstate is non-deterministic
if files are written out within the same second. This rebuilds the dirstate
entirely in a few cases, which removes the flakeyness.
2014-05-21 13:24:49 -07:00
Durham Goode
c5b2f574a0 Fix changegroup wrapping with new upstream Mercurial
Summary:
Recent changes to upstream Mercurial have moved localrepo.getbundle and
localrepo.addchangegroupfiles to changegroup.py.  remotefilelog wraps these
functions, and thus needs to be updated.

Applyupdate also had a function signature change, which is fixed here.

Minor fix to a test as well, which had a hard coded time instead of a glob.

Test Plan: ./run-tests.py --with-hg=/data/users/durham/hg/hg

Reviewers: sid0, davidsp, pyd, dschleimer

Differential Revision: https://phabricator.fb.com/D1260737
2014-04-04 15:55:06 -07:00
Durham Goode
0237412d94 Fix shallow clones using getbundle protocol
Preivously shallow clones only work using the streaming clone protocol. With
this change they work for the standard getbundle protocol as well. This is what
the majority of Mercurial users use, so we need to support that.
2014-02-24 22:19:15 -08:00
Durham Goode
fc3a887712 hg bundle produces full sized bundles
Summary:
hg bundle was producing shallow bundles. This change makes it produce full
sized bundles so they can be used in other repos.

Test Plan: Added a test

Reviewers: sid0

Reviewed By: sid0

CC: keegancsmith

Differential Revision: https://phabricator.fb.com/D1167462
2014-02-10 16:13:41 -08:00
Durham Goode
92d01b616c Allow readonly access to remotefilelog cache
Summary:
Previously requesting remotefilelog file blobs from the server required write
access in order to write the blob to the cache. This changes it to not abort
entirely if the user doesn't have write access.

Test Plan:
cd tests
./run-tests.py --with-hg=/data/users/durham/hg/hg test-permissions.t
Also ran the test without the fix and verified it fails.

Reviewers: sid0, davidsp, pyd, dschleimer

Reviewed By: dschleimer

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

Task ID: 3601184
2014-01-27 17:09:48 -08:00
Durham Goode
f82c2ddc69 Remove unnecessary remotecmd config from tests
The remotecmd config is no longer necessary since we now use a dummy ssh. It
was also hardcoded for a specific filesystem structure, which didn't work on
other machines.
2014-01-15 17:35:16 -08:00
Durham Goode
106035959b Add prefetch command to remotefilelog
Summary:
Adds a 'hg prefetch' command to remotefilelog for prepopulating the
local cache.  Supports specifying revsets and file patterns to limit what is
downloaded.

Test Plan: ./run-tests.py test-prefetch.t --with-hg=/data/users/durham/hg/hg

Reviewers: dschleimer, sid0, davidsp, pyd, mpm

CC: kunalb, minyoung

Differential Revision: https://phabricator.fb.com/D1129942
2014-01-15 13:41:29 -08:00
Durham Goode
393958c76b Allow naming repos
Enables specifying a name for a repo that is used in the cache key.
This allows multiple repos on a machine to share a cache without the
risk of keys overlapping.
2013-08-15 11:00:51 -07:00