Commit Graph

3456 Commits

Author SHA1 Message Date
Durham Goode
bdea38dd56 Move fileservice to be per repo instead of global
Previously the file service client was a global object that all repos could
share. This was a bit hacky and is no longer needed. Now the file service
client exists per repo instance.

This is part of a series of changes to abstract the local caching and remote
file service in such a way that we can plug and play implementations.
2014-02-11 14:41:56 -08:00
Durham Goode
9eda4f7a0f Fix fallback when memcache process exits unexpectedly
If the memcache process exited early, remotefilelog was throwing an exception
instead of falling back to the server. This change makes it fall back to the
server, and also print a warning that the cache connection closed early.
2014-01-09 11:41:12 -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
f76b0f894c Fix looking up double digit alternates
The alternate lookup code was mistakening looking for only the last digit
instead of looking at the entire prefix. This meant files with more than 10
alternates would start failing to find histories, which breaks rebase.
2014-01-09 11:40:39 -08:00
Pierre-Yves David
b24e20f14b add the crecord extension to the list of installed extension.
The crecord extension is a nice ncurse version of record that allow you to
interactively select changes to include from files to line level.
2013-12-18 17:43:19 -08:00
Durham Goode
16a7f940d5 Increase batch request size
When falling back to the master server for cache misses, we only kept two
requests in flight at any time. Over high latency connections (like across
oceans) this resulted in very slow downloads.

This change increases the request size to 10,000 keys at once. This will keep
the size of the request lower than the tcp buffer size, while allowing us to
maximize our throughput.
2013-12-17 14:31:21 -08:00
Durham Goode
285ad01336 Handle the case where the alternates directory doesn't exist yet 2013-12-13 17:14:55 -08:00
Durham Goode
688d0f9594 Fix debugremotefilelog command 2013-12-13 11:42:50 -08:00
Durham Goode
4e8c3b941d Fix broken alternates lookup 2013-12-13 11:21:51 -08:00
David Soria Parra
790e43474a Use a processgroup to ensure all arc subprocesses are properly killed
Summary:
phrevset can hang when the revwalk already returns a rev but
the parallel arc call didn't finish with arc having subprocesses running.
This will result in hg log showing output but hanging for a quiet a bit.
We have to use a processgroup and make arc the leader of it to kill
all it's subprocesses properly. Note this will make it incompatible
with windows.

Test Plan:
Tested locally and ensured that a differential revision is
found and we abort nicely.

Reviewers: durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1096568
2013-12-12 14:49:04 -08:00
Durham Goode
17f5a0d712 Fix issues with hg pulling from svn 2013-12-12 12:34:39 -08:00
Durham Goode
4d6f31837e Fix hang when manifest size is greater than tcp buffer
Previously we sent the entire list of files to the fallback repo in a single ssh
write/flush.  If the size of this write exceeded the tcp buffer on the receiving
end, the call would hang until the buffer had room.  The problem is that the
receiving end (the server) is hung trying to send data back to the
client. Therefore it deadlocked.

The fix is to send and receive requests one at a time. We always have the next
request in flight while receiving so we shouldn't be waiting on requests too
often.
2013-12-11 13:39:53 -08:00
Durham Goode
143e90ccdd Add phrevset to make file 2013-12-04 18:47:56 -08:00
Delyan Kratunov
95f6d97e12 [hg] Add support for Differential revsets
Summary:
Add the ability to issue commands like

  hg log -r D12345

Supports already shipped commits (by parsing the SVN rev number and delegating to hgsubversion), as well as mercurial commits in various states

Test Plan:
Easier to show than tell:

  [delyank@dev1436 ~/www] arc feature test_diff_revset
  [delyank@dev1436 ~/www] echo "Don't commit me" > dontcommit.test
  [delyank@dev1436 ~/www] hg add dontcommit.test
  [delyank@dev1436 ~/www] hg commit -m "[test] Test commit"
  [delyank@dev1436 ~/www] arc diff
  [...]
  Created a new Differential revision:
          Revision URI: https://phabricator.fb.com/D1055569
  [...]

  [delyank@dev1436 ~/www] hg log --debug -r D1055569
  [diffrev] Getting diff from Conduit..done
  [diffrev] VCS is hg
  changeset:   587735:82d4de66e17bb3b92fe15df4eda8b8420b7ed074
  bookmark:    test_diff_revset
  tag:         tip
  phase:       draft
  [...]
  description:
  [test] Playing with conduit, don't commit
  [...]
  Differential Revision: https://phabricator.fb.com/D1055569

  [delyank@dev1436 ~/www] echo "No, really, don't" >> dontcommit.test
  [delyank@dev1436 ~/www] hg amend # change local hash
  [delyank@dev1436 ~/www] hg log --debug -r D1055569
  [diffrev] Getting diff from Conduit..done
  [diffrev] VCS is hg
  [diffrev] Traversing log for 1055569
  changeset:   587735:48565d21a43f730aa3b9cebccbb47fa406df557b
  bookmark:    test_diff_revset
  tag:         tip
  phase:       draft
  [...]
  description:
  [test] Playing with conduit, don't commit
  [...]
  Differential Revision: https://phabricator.fb.com/D1055569

  [delyank@dev1436 ~/www] hg log --debug -r D1053132 # a diff that's already been shipped
  [diffrev] Getting diff from Conduit..done
  [diffrev] VCS is svn
  changeset:   586857:61a4036e89bafefaba4de2ebe1190db999a8915d
  [...]
  description:
  [hashtagbot] Add the #filetask hashtag to Task Creeper
  [...]
  Differential Revision: https://phabricator.fb.com/D1053132

Reviewers: sid0, davidsp

Reviewed By: davidsp

CC: jhunt, davidsp

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

Task ID: 3159944
2013-11-15 14:55:42 -08:00
Durham Goode
034fd17869 Fix --fixup when the children are already fixed 2013-09-10 19:26:13 -07:00
Durham Goode
238a5915c7 Fix hg smartlog when current commit is nullrev.
Fix hg smartlog --master option to actually work.
Add help text.
2013-09-05 14:24:01 -07: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
Durham Goode
85e48b58fd Move server and debug logic into their own files
__init__.py was getting quite large. This change moves the server and debug
logic into their own files.  Client-side logic remains in __init__.py
2013-11-25 16:36:44 -08:00
Durham Goode
d9d4477013 Remove global variable for tracking shallow remotes
Previously we used a global variable to track if the incoming connection was
from a shallow remote (based on if the network command was a *_shallow command).
This is hacky and overall a bad idea. The new implementation stores the shallow
flag as a bundlecapability passed to the getbundle command.

A side effect of this is remotefilelog won't work with versions of mercurial
that don't use the getbundle command.
2013-11-25 14:22:56 -08:00
Durham Goode
b88d1b44d4 Replace linknode fallback algorithm
The previous algorithm thought that if the system cache had the file rev, it was
guaranteed to be valid. This isn't true in the case of a machine in which
multiple people share the cache (one person may have pulled a rev but the other
hasn't).

The new algorithm is more explicit. It checks:

- system cache
- local cache
- local cache fallbacks
- remote cache
- master server
2013-11-22 13:41:54 -08:00
Durham Goode
cbddd1460d Switch to dummyssh for test runs 2013-11-22 13:39:35 -08:00
Durham Goode
e5f5e3244b Add more comments explaining various complexities 2013-11-05 17:19:59 -08:00
Durham Goode
24ce0242d7 Add example cache client implementation
Adds a cache client implementation using the opensource python-memcached
library. It's more of an educational example than a production ready one since
it doesn't perform the requests asynchronously.  It does however split up large
files into smaller chunks for you.
2013-10-17 14:18:23 -07:00
Durham Goode
18baf608df Remove unused time and traceback imports 2013-10-16 13:40:25 -07:00
Durham Goode
f5b8ea4e79 Tweak README 2013-10-16 13:41:34 -07:00
Durham Goode
d122f76e5b Add readme and GPL info 2013-10-15 17:20:12 -07:00
Durham Goode
1275d15990 Add include and exclude configuration settings
The remotefilelog extension currently doesn't work with tags. Adding include and
exclude patterns allows users to specify which files they want to treat as
shallow and which the want to download the entire history for. By excluding
.hgtags from being shallow, this enables tags to work in a mostly shallow repo.

This also enables largefile like scenarios where most files are full and only a
few large ones are kept remote.
2013-09-26 10:46:06 -07:00
Durham Goode
5a628dc440 Fix linknode test failure 2013-10-09 10:20:47 -07:00
Durham Goode
3c6137f555 Fix revert prefetch causing excess output 2013-10-07 17:13:00 -07:00
Durham Goode
b47e016320 Replace linknode recovery tests with a real world test 2013-10-04 14:40:47 -07:00
Durham Goode
7268e5b709 Refactor ancestormap linknode logic to handle a bug
A rare bug can occur where the local file blob might not exist, but a valid old
version of that blob does exist. This refactor the linknode logic in ancestormap
to check the old versions if the server fetch fails to find the blob.

It still prints an ugly warning message from the server, but this whole issue is
quite rare anyway.
2013-10-03 15:15:15 -07:00
Durham Goode
ab72a92e85 GC server cache and add GC tests 2013-10-02 16:21:48 -07:00
Durham Goode
be29ee042a Fix reverting from non-root directories 2013-10-02 09:45:52 -07:00
Durham Goode
335e1d1bfc Prefetch before revert 2013-09-17 11:24:31 -07:00
Durham Goode
2ccd88dfcd Support new mercurial _basesupported 2013-10-01 15:11:57 -07:00
Durham Goode
efdfcc1502 Send all available data during a pull 2013-09-19 16:22:14 -07:00
Durham Goode
3667c253fd Refresh changelog during getfiles loop 2013-09-19 15:56:26 -07:00
Durham Goode
cf9d751d8a Add remotefilelog debug commands 2013-09-17 20:15:08 -07:00
Durham Goode
6a8a2f0e58 Fix rare issue with broken linknodes in the ancestormap 2013-09-16 18:46:24 -07:00
Durham Goode
f480c7deef Remove remotefilectx.__str__
Recent changes to Mercurial mean this is implemented by a base class.
2013-09-11 12:29:01 -07:00
Durham Goode
4ce55b8a0f Add log file warning 2013-09-11 10:27:56 -07:00
Durham Goode
6781d80d25 Fix local pulls to send file data 2013-09-09 11:44:08 -07:00
Durham Goode
6acb5968a1 Clean up empty cache files if we encounter them 2013-09-09 11:23:03 -07:00
Durham Goode
3619a1911d Cut down number of sys calls during filelog reads
When the cache is stored on a filesystem, excessive stat calls can slow
mercurial updates down dramatically. This reduces it to a single open call for
the cache location and if that fails, a single open call for the local location.
2013-09-09 10:23:29 -07:00
Durham Goode
c17ec690c9 Change cache key to use a two character prefix for directories.
Some file systems can't handle having a ton of files/directories inside a
directory, so this splits up all our files amongst directories.
2013-09-06 13:28:15 -07:00
Durham Goode
4d70ed4fce Fix a bug with status prefetching in merge scenarios 2013-09-04 19:07:01 -07:00
Durham Goode
1391bcc1c6 Add a test suite 2013-09-03 20:03:43 -07:00