Commit Graph

34 Commits

Author SHA1 Message Date
Anastasiya Zhyrkevich
d2a4f4e042 getfiles, config lfs threshold
Summary:
getfiles implementation for lfs

The implementation is the following:
- get file size from file envelope  (retrieve from manifold by HgNodeId)
- if file size > threshold from lfs config
   - fetch file to memory, get sha256 of the file, will be fixed later, as this approach consumes a lot of memory, but we don't have any mapping from sha256 - blake2 [T35239107](https://our.intern.facebook.com/intern/tasks/?t=35239107)
   - generate lfs metadata file according to [LfsPlan](https://www.mercurial-scm.org/wiki/LfsPlan)
   - set metakeyflag (REVID_STORED_EXT) in the file header
- if file size < threshold, process usual way

Reviewed By: StanislavGlebik

Differential Revision: D10335988

fbshipit-source-id: 6a1ba671bae46159bcc16613f99a0e21cf3b5e3a
2018-10-17 02:20:06 -07:00
Lukas Piatkowski
cad69fedd0 filenodes: use sqlfilenodes instead of dieselfilenodes; pass myrouter_port around
Reviewed By: farnz

Differential Revision: D10338868

fbshipit-source-id: 60734d9635df442691cad3637aebd5bc838e03ad
2018-10-11 10:52:05 -07:00
Lowik Chanussot
395b124f5d Make get_manifest_by_nodeid accept HgManifestId
Summary: Make get_manifest_by_nodeid accept HgManifestId and correct all calls to get_manifest_by_nodeid.

Reviewed By: StanislavGlebik

Differential Revision: D10298425

fbshipit-source-id: 932e2a896657575c8998e5151ae34a96c164e2b2
2018-10-11 06:50:16 -07:00
Simon Farnsworth
6e2455a12e Hook up (untested) support for streaming clones
Summary:
We now have a way for a MySQL database to tell us how to send
streaming clones to the client. Hook it all up, so that (with any luck), once
we have data in MySQL and the blobstore, we'll see working streaming clones.

Reviewed By: StanislavGlebik

Differential Revision: D10130774

fbshipit-source-id: b22ffb642d0a54b09545889779f79e7a0f81acd7
2018-10-04 11:37:46 -07:00
Tim Fox
debd4a5f95 Integrate hooks into mononoke write path
Summary: Integrate hook manager into the Mononoke pushrebase path

Reviewed By: lukaspiatkowski

Differential Revision: D9896005

fbshipit-source-id: ffd79b539288d95b134af97b776b7fcc3afa0ce7
2018-10-02 07:07:16 -07:00
Simon Farnsworth
1c3f40aaf5 Log a JSON blob to Scribe for every commit to Manifold repos
Summary:
JSON blobs let other users of Mononoke learn what they need to know
about commits. When we get a commit, log a JSON blob to Scribe that other users can pick up to learn what they want to know.

Because Scribe does not guarantee ordering, and can sometimes lose messages, each message includes enough data to allow a tailer that wants to know about all commits to follow backwards and detect lost messages (and thus fix them up locally). It's expected that tailers will either sample this data, or have their own state that they can use to detect missing commits.

Reviewed By: StanislavGlebik

Differential Revision: D9995985

fbshipit-source-id: 527b6b8e1ea7f5268ce4ce4490738e085eeeac72
2018-09-27 04:25:16 -07:00
Simon Farnsworth
0aaa4577bc Add minimal support to trigger streaming clones in Mercurial client
Summary:
Streaming clones are a neat hack; we get to send files down to the
Mercurial client, which it then writes out as-is. Usefully, we can send no
files, and the protocol still works.

Set up the capabilities etc needed so that we send streaming clones to
Mercurial clients, even if they're rather useless so far.

Reviewed By: StanislavGlebik

Differential Revision: D9926967

fbshipit-source-id: b543e802adac38c8bc318081eec364aed87b0231
2018-09-19 06:36:56 -07:00
Stanislau Hlebik
785ea8921d mononoke: make getbundle streaming
Summary: Should reduce memory usage and make getbundle a bit faster

Reviewed By: farnz

Differential Revision: D9861578

fbshipit-source-id: 57bca3700e3a38aeb70f267e6dc90d6b8a9d2955
2018-09-18 01:53:10 -07:00
Sebastian Lund
847ccb0bef mononoke: use ChangesetId in DifferenceOfUnionsOfAncestorsNodeStream
Summary: Use `ChangesetId` in `DifferenceOfUnionsOfAncestorsNodeStream` instead of `HgNodeHash`. This avoids several bonsai lookups of parent nodes.

Reviewed By: StanislavGlebik

Differential Revision: D9631341

fbshipit-source-id: 1d1be7857bf4e84f9bf5ded70c28ede9fd3a2663
2018-09-17 09:52:29 -07:00
Lukas Piatkowski
b68675f549 mononoke config: stop using "path" in manifold based repos
Summary:
The "path" in manifold blobrepo is used for logging, but it has been quite confusing with "fbsource" and "fbsource-pushrebase" to be logged in an identical way - both are "fbsource", because of the "path" config. Lets not use the "path" for logging, instead use the "reponame" from metaconfig repo.

In case we ever want to have two repos that are named the same (please don't) or have logging under a different name than "reponame" from config then we can add a proper optional "name" parameter, but for now we don't require this confusing feature.

Reviewed By: StanislavGlebik

Differential Revision: D9769514

fbshipit-source-id: 89f2291df90a7396749e127d8985dc12e61f4af4
2018-09-11 08:06:31 -07:00
Stanislau Hlebik
045623e7c7 mononoke: move getbundle response creation in bundle2resolver
Summary: We are going to use it in pushrebase as well

Reviewed By: lukaspiatkowski

Differential Revision: D9635432

fbshipit-source-id: 5cbe0879d002d9b6c21431b0938562357347a67f
2018-09-06 06:53:57 -07:00
Sebastian Lund
ee92a7f421 mononoke: return root asap in get_change_manifests_stream if max_depth=1
Summary: In case `max_depth=1` we should only return the topmost entry, which in this case always is the root-entry. This fixes it so that we always return-fast in case `max_depth=1`.

Reviewed By: StanislavGlebik

Differential Revision: D9614259

fbshipit-source-id: a6b82bd5aac74d004f61a07bc24f5d26e5c56412
2018-09-03 11:36:57 -07:00
Pavel Aslanov
57d5ddcaf8 added pushrebase configuration options
Summary:
- added `PushrebaseParams` to `RepoConfig`
- configurable recursion_depth and rewritedates

Reviewed By: StanislavGlebik

Differential Revision: D9578661

fbshipit-source-id: df26be4f0f54a54ab6a82fc89d6733099469ce98
2018-08-31 08:55:19 -07:00
Stanislau Hlebik
904e4ee900 mononoke: decrease getfiles buffer
Summary:
Looks like we shouldn't have raised in the first place. Big getfiles buffer
causes OOMs on the servers. Also memory profiling shows that quite often most
of the Mononoke server's memory is used for serving remotefilelog requests.

Reviewed By: purplefox

Differential Revision: D9601990

fbshipit-source-id: 356a65d0749b064486436fb737bd5a47b3beecfa
2018-08-31 01:36:23 -07:00
Harvey Hunt
b582d26357 Add lookup support for bookmarks
Summary:
Modify the lookup() RPC function to be able to accept either a
bookmark or commit hash. A commit hash lookup is attempted first, falling
back to a bookmark lookup if it fails.

Reviewed By: StanislavGlebik

Differential Revision: D9457349

fbshipit-source-id: 78db21c01c498b045f5781097cb12f7220a40999
2018-08-28 09:53:24 -07:00
Zeyi Fan
c1b1005d91 clean up HgBlob and HgBlobHash
Summary: This commits change `HgBlob` from an enum into a struct that only contains one Bytes field, completely removes `HgBlobHash` and changes the methods of `HgBlob` from returning `Option`s into directly returning results.

Reviewed By: farnz

Differential Revision: D9317851

fbshipit-source-id: 48030a621874d628602b1c5d3327e635d721facf
2018-08-19 15:52:34 -07:00
Alex Maloney
1496846903 Futures split Stats into FutureStats and TimedStats
Summary: Since this data is specific to TimedStream and not TimedFuture I split the Stats struct into FutureStats and StreamStats

Reviewed By: StanislavGlebik

Differential Revision: D9355421

fbshipit-source-id: cc2055706574756e2e53f3ccc57abfc50c3a02ba
2018-08-17 13:07:24 -07:00
Lukas Piatkowski
09a8d9430f manifest utils: use structure rather than closure to represent pruner and implement DeletedPruner
Summary: gettreepack doesn't care for deleted entries, only about added or modified ones

Reviewed By: StanislavGlebik

Differential Revision: D9378909

fbshipit-source-id: 2935e6b74fbb0208f7cf89ab4b1e761bb9c6000b
2018-08-17 09:07:27 -07:00
Lukas Piatkowski
2d92742e38 gettreepack: handle the depth parameter being send by client
Reviewed By: StanislavGlebik

Differential Revision: D9378908

fbshipit-source-id: 980e625765803c7cac9a272f3e701a3b2fa8da28
2018-08-17 09:07:26 -07:00
Stanislau Hlebik
74e32f9ea7 mononoke: save pushrebase commits
Summary:
First step of implementing pushrebase algorithm. Save the commits that client
has sent us. The parts that client sends us are the same as in normal push
except for the names and parameters.

Reviewed By: farnz

Differential Revision: D9304750

fbshipit-source-id: d5be6635c0cf1a14a66a5fed5ba13f344195e8bc
2018-08-17 05:21:56 -07:00
Jeremy Fitzhardinge
24526e8396 mononoke/repo_client: fix typo
Summary: Fix spelling of Inconsistent

Reviewed By: StanislavGlebik

Differential Revision: D9357204

fbshipit-source-id: 4cc5d8d99c28dce9b25f0d334e1820709b3ccc4c
2018-08-16 10:37:02 -07:00
Simon Farnsworth
046fc8c019 Use select_all instead of a chain of select statements
Summary:
Caught by inspection - this builds up a long linked list of streams
to evaluate, where `select_all` has a vector and uses `FuturesUnordered` to
optimize which stream to check next.

Reviewed By: lukaspiatkowski

Differential Revision: D9359932

fbshipit-source-id: 83e645cc5f17a6376d0f0925b88cb390caf3dc4f
2018-08-16 08:36:53 -07:00
Rain ⁣
2203a158e1 cmdlib: switch from BlobRepo to MononokeRepo
Summary: This is more general, and allows one to call `RepoClient` methods.

Reviewed By: farnz

Differential Revision: D9318658

fbshipit-source-id: 09b2e64bc0d423eafcb381902e03f349fc666a41
2018-08-15 23:36:19 -07:00
Rain ⁣
7f039b5c63 repo_client: Arc<BlobRepo> -> BlobRepo
Summary: Remove `Arc<BlobRepo>` from more places since `BlobRepo` will do its own internal `Arc`ing.

Reviewed By: StanislavGlebik

Differential Revision: D9317987

fbshipit-source-id: 899e8b2ede278e62a83e64c144eb18c8cc7e57c6
2018-08-15 23:36:18 -07:00
Jeremy Fitzhardinge
3a28aeef53 mononoke: start passing CoreContext around.
Summary: Introduce CoreContext to replace separate log/scuba/trace things.

Reviewed By: StanislavGlebik

Differential Revision: D9322150

fbshipit-source-id: fe65c8e0c601ba0fe00ef7e6bfa226f0d9c78dd0
2018-08-15 11:31:54 -07:00
Rain ⁣
833063b64a repo_client: rename MononokeRepo::path to log_name
Summary: The "path" here is only used for logging. Also add another constructor which can be used to provide custom naming.

Reviewed By: StanislavGlebik

Differential Revision: D9309237

fbshipit-source-id: 0192a3f74129ad063aa41ed61125b3b1d2711a77
2018-08-14 11:47:56 -07:00
Liubov Dmitrieva
52a9bdd6a5 eliminate excessive thousands of lines logging
Summary: all that places logged all list of HgNodeHash

Reviewed By: StanislavGlebik

Differential Revision: D9242904

fbshipit-source-id: 42a98b04986f2ed432a8956828356bd5b9bcaa88
2018-08-13 12:08:16 -07:00
Lukas Piatkowski
0d30b4e660 get_files: increase buffer size to process more files in parallel
Summary: the current 100 is just too small, which can be seen while tracing the requests

Reviewed By: farnz

Differential Revision: D9032184

fbshipit-source-id: adbd274d2bd275cc57af635ff42321f06fa358de
2018-08-10 10:06:27 -07:00
Lukas Piatkowski
ce955cec53 mononoke server: instead of uploading trace per wireproto command store one per whole request
Summary: This makes it easier to look at traces as a whole client session, it also makes it possible to see how long did the entire request took time (previously it would not count the time to send data back).

Reviewed By: farnz

Differential Revision: D9032172

fbshipit-source-id: 048fcb21d4eb70424643f7bb2afa426e09904ada
2018-08-10 10:06:27 -07:00
Lukas Piatkowski
425c397217 blobrepo: add get_filenode method to simplify filenode access
Summary: As a bonus this diff also contains unifying the linknode family of methods (they all now accept arguments via reference) and better tracing for get_files request

Reviewed By: StanislavGlebik

Differential Revision: D9031283

fbshipit-source-id: 4526a8446984904bce7d4dcef240088c7f2ffaa3
2018-08-10 10:06:27 -07:00
Lukas Piatkowski
c0f01f5b4f mononoke stats: add latency of wireprotocol, getfiles, gettreepack and getbundle to ods
Summary: Canaries are better used with ODS counters, so the important metrics (like latency) need to be logged to both scuba and ODS

Reviewed By: jsgf

Differential Revision: D9007402

fbshipit-source-id: 43c057dfdccc5639051d2adee90704de71fc2df7
2018-07-26 10:09:32 -07:00
Stanislau Hlebik
ff04a36412 mononoke: rename BlobChangeset and ChangesetContent
Summary:
These types are Hg specific. Since we are going to add bonsai changeset
creation soon, let's make it clear in the types

Reviewed By: farnz

Differential Revision: D8911359

fbshipit-source-id: 8b6cc45122402d7b7e074e66d904d979030de705
2018-07-26 10:09:31 -07:00
Stanislau Hlebik
113bc68bec mononoke: fix returned linknode type
Summary: That's actually HgChangesetId, not HgNodeHash

Reviewed By: farnz

Differential Revision: D8911209

fbshipit-source-id: b7f47b57e93f554bbd78e8f5ae281a50e9a128ff
2018-07-23 10:25:13 -07:00
Lukas Piatkowski
69d791a81f server: split server binary crate into 4 separate crates
Summary: Iterating over the code on server is a bit painful and it has grown a lot, splitting it should speed up future refactories and make it more maintainable

Reviewed By: jsgf, StanislavGlebik

Differential Revision: D8859811

fbshipit-source-id: 7c56f9f835f45eca322955cb3b9eadd87fbb30a1
2018-07-17 04:54:58 -07:00