Commit Graph

939 Commits

Author SHA1 Message Date
Tim Fox
790bf3aa6c Rename hooks->hooks_old and hooks2->hooks
Summary: Rename the old hooks implementation to hooks_old

Reviewed By: StanislavGlebik

Differential Revision: D8187045

fbshipit-source-id: 50f849250f42436ee0db142aab721a12b7d95672
2018-05-30 02:03:20 -07:00
Tim Fox
b00bef4efb Implement runhook command
Summary: This diff introduces a simple command line utility which allows a hook to be run against a specific changeset. The idea is to allow hooks to be easily tested without having to run a Mononoke server.

Reviewed By: StanislavGlebik

Differential Revision: D8183908

fbshipit-source-id: 2ebadf026a23ac69bc14db6794fdf760728f1d3b
2018-05-30 02:03:20 -07:00
Tim Fox
b33c91bf5f Initial implementation of hooks
Summary:
This diff introduces an initial implementation of hooks, corresponding to stage 1 in "plan of action" in https://fb.quip.com/dnHuARInjA9I
* lib.rs contains the core hook structs and traits.
* rust_hooks contains a simple implementation of hooks for rust.
* lua_hooks contains a simple implementation of hooks for lua.
* The old hooks implementation has been moved to hooks_old

Reviewed By: StanislavGlebik

Differential Revision: D8183909

fbshipit-source-id: 17840db4ebb68009efe0df90df7383c5712bd1ba
2018-05-30 02:03:20 -07:00
Stanislau Hlebik
af7cc5eb6c mononoke: increase hgcli buffer
Summary:
We can hit a deadlock during getfiles requests. We first send all requests via
stdin, and then read the output via stdout. The problem is that any of the
buffers anywhere between hg and mononoke may fill up, and the whole process
deadlocks.

Unfortunately there is no good solution yet. For now let's make the buffer in
hgcli big enough to make sure it won't be a problem. Let's bump it to 400Mb.
Note that the buffer will be allocated on demand in the channel. So it won't
use too much memory.

Reviewed By: sunshowers

Differential Revision: D8195511

fbshipit-source-id: bd97509bd26f8cea7d41e44933e02bd0bc2c76c4
2018-05-30 00:41:54 -07:00
Simon Farnsworth
2e24a77e85 Rename CachingBlobstore to MemoizedBlobstore
Summary:
I'm about to introduce a MemoizedBlobstore - let's ensure that
ambiguity is kept to a minimum by renaming CachingBlobstore

Reviewed By: jsgf

Differential Revision: D8124625

fbshipit-source-id: 301fbb31c5a772c11e84566889b8a6ac86cdae19
2018-05-29 10:08:16 -07:00
Simon Farnsworth
e33d05223f Make CachingBlobstore generic, to allow optimization through the Arc
Summary:
In practice, caching blobstores are always wrapped around a known
concrete blob store. Make it generic in the type of the Blobstore, so that
rustc can reach in and inline appropriately if it sees an optimization
opportunity.

This is a micro-optimization, hence nice to have

Reviewed By: StanislavGlebik

Differential Revision: D8124627

fbshipit-source-id: 0d5d9b11fdede062ceaa949ace574b3d1c75e6b5
2018-05-29 10:08:16 -07:00
Simon Farnsworth
969026576d Refactor blobstore lib.rs to reduce its size
Summary:
I'm about to add a memcache caching blobstore, and the blobstore
lib.rs is getting large. Shrink it by removing the outdated comment, replacing
it with documentation comments, and moving the CachingBlobstore to its own file

Reviewed By: jsgf

Differential Revision: D8124626

fbshipit-source-id: ac081a162c2f15a26452ff708d16a108699c279b
2018-05-29 10:08:16 -07:00
Simon Farnsworth
32f8f01e82 RFC: [mononoke] Use memory_manifest to generate Mercurial from Bonsai form
Summary:
We want to be able to go to and from Bonsai Changesets in Mononoke, so
that we can operate with Mercurial clients that haven't yet been updated to
support Bonsai form. This RFC commit shows a shell of doing so, as an
illustration for the hackamonth task

Reviewed By: jsgf

Differential Revision: D8014909

fbshipit-source-id: 28adf18ecf80e0116290662c117731b4c1632ff9
2018-05-29 08:52:54 -07:00
Simon Farnsworth
11019c0a7e Make in-memory manifests load lazily
Summary:
Loading the entire manifest tree just for a limited set of conflicts
and changes is wasteful. Lazily load the referenced parts of the tree instead

Reviewed By: jsgf

Differential Revision: D8014913

fbshipit-source-id: 07678bee39de02414fdc062cf680fcd049a28415
2018-05-29 08:52:54 -07:00
Stanislau Hlebik
0b93cff8d4 mononoke: add a method to fetch all filenodes at once
Summary:
It will be used in getfiles wireproto method. It requires fetching the whole
file history, and doing lots of point lookups is too slow.

Reviewed By: lukaspiatkowski

Differential Revision: D8182050

fbshipit-source-id: b17cb2259b2237f0027bfb499fbe97d9b40b1a62
2018-05-29 04:11:47 -07:00
Stanislau Hlebik
ef4c28f4f1 mononoke: refactor dieselfilenodes
Summary:
Move functionality of converting FilenodeRow into FilenodeInfo into a separate
function. It will be used in the next diff

Reviewed By: lukaspiatkowski

Differential Revision: D8182051

fbshipit-source-id: f2276aa979200f71aa05808595842c09a9f5899f
2018-05-29 04:11:47 -07:00
Stanislau Hlebik
865b59eb46 mononoke: add has_copyinfo
Summary:
Motivation for this change is the following:
We want to avoid doing point lookups to the db to fetch the history, and
instead select the history for a file or a directory with a single select. That
should be many times faster.
After we select the data from filenodes table, we need to fetch  copy info
data. To do that we need to either do lots of point lookups to the fixedcopyinfo (which
undermines the point of doing single select) or construct a giant select
statement. First option is inefficient, the second can introduce big code
complexity.

Instead let's add a single field that says whether we have fixed copy info or
not. Db size increase should be tiny.

For the data that we've already imported I'm planning to run a script that will
fill the has_copyinfo field correctly.

Reviewed By: jsgf

Differential Revision: D8164029

fbshipit-source-id: c91c99b065808a93a9b361914cf9b3822d78cb60
2018-05-27 13:06:17 -07:00
Stanislau Hlebik
d1e5fb7a79 mononoke: add traffic_replay binary
Summary:
This is a binary that reads json encoded requests from cmd line and sends them
to Mononoke. Usually requests will be sent via scribe from hg servers.

Then the data will be logged to scuba table `Mononoke Mercurial Comparison`

Also change hgcli to print errors to stderr

Reviewed By: farnz

Differential Revision: D8143781

fbshipit-source-id: 8d6c5511dfd2368f5d018825502c384f2ad89d4a
2018-05-25 07:51:12 -07:00
Stanislau Hlebik
dd37633300 mononoke: do not upload traces if tracing is disabled
Summary:
It has a few benefits. Firstly, we won't get misleading empty trace ids in the
logs. Secondly, uploading traces takes a noticeable amount of time that affects
the overall latency. That is especially noticeable for getfiles requests.

Reviewed By: farnz

Differential Revision: D8158917

fbshipit-source-id: b4fe2183d9157f4d7c52e25e4efef9a06bb1b5ac
2018-05-25 05:35:49 -07:00
Lukas Piatkowski
bce740ec29 blobrepo: sort list of changed files as mercurial would sort them
Reviewed By: StanislavGlebik

Differential Revision: D8159064

fbshipit-source-id: d1d5141aa2b84bfc48a2edc6d0cd3959b69cef93
2018-05-25 03:51:37 -07:00
Lukas Piatkowski
3a7893942b blobrepo: print Blob content when hash consistency check failed
Reviewed By: StanislavGlebik

Differential Revision: D8144316

fbshipit-source-id: 1b98b2bf0814bde2539d610580ec8a5e842bb27f
2018-05-25 03:05:37 -07:00
Lukas Piatkowski
c5f971d960 new_blobimport: force set bookmarks rather than gracefully create them
Reviewed By: farnz

Differential Revision: D8137458

fbshipit-source-id: 898290b19852d3998ff1d55282045167e33e46e5
2018-05-24 05:14:20 -07:00
Lukas Piatkowski
1b8c556a5e new_blobimport: add --no-bookmark flag to disable bookmark update
Reviewed By: StanislavGlebik

Differential Revision: D8135043

fbshipit-source-id: f2c51ee1779526bd3d630e5a3a2151983999339d
2018-05-24 05:14:20 -07:00
Lukas Piatkowski
79b3d3d063 server: add treemanifestserver bundle2 capability to Mononoke server
Summary: This is required for pushes, without it the pusher assumes we don't need tree manifests

Reviewed By: farnz

Differential Revision: D8139396

fbshipit-source-id: 42ad18b2f437a0b9441c0d84e4519b87f2902c0d
2018-05-24 05:14:20 -07:00
Lukas Piatkowski
7b5bca3119 new_blobimport: fix misuse of clap's ArgGroup
Reviewed By: StanislavGlebik

Differential Revision: D8125848

fbshipit-source-id: 60709533d1953eb5707f3e9b88331de64a0f5218
2018-05-24 02:51:17 -07:00
Lukas Piatkowski
2bedb01d19 new_blobimport: update a bookmark only if the changeset is present in blobstore
Summary: This should prevent new_blobimport from updating bookmarks to non-existing changesets

Reviewed By: farnz

Differential Revision: D8122315

fbshipit-source-id: 20bcbb6887b54a88b39f9ba375884e8b9c0143f7
2018-05-23 13:25:25 -07:00
Lukas Piatkowski
86490e1ea5 new_blobimport: add --skip, --commits-limit and --changeset flags
Summary:
Those flags will let us control the subset of commits that the new_blobimport is supposed to import.
It's a temporary solution to be used instead of the old blobimport but before "hg push" works

Reviewed By: farnz

Differential Revision: D8122318

fbshipit-source-id: a1ac0824020341cd4bb18ec46d91caee50d9606e
2018-05-23 13:25:25 -07:00
Simon Farnsworth
02ce7eee2d Remove Result from HgBlobEntry constructor
Summary:
This could never fail - so don't allow for failure, but use the type
system to deal with the error case.

Reviewed By: jsgf

Differential Revision: D8014910

fbshipit-source-id: 8f5f0a3ff55a96b57cd4c246d072793c986724d5
2018-05-22 12:22:24 -07:00
Simon Farnsworth
0d8fd3e491 Make conflict handling a thing, albeit with asserts
Summary:
We want to handle conflicts here - do so, but with asserts, by merging
two manifests together.

The asserts will be removed once we make this all lazy

Reviewed By: jsgf

Differential Revision: D8014912

fbshipit-source-id: 7a09186f7e24a3af93d15a859c877e3a319fb110
2018-05-22 12:22:24 -07:00
Stanislau Hlebik
96898bba07 mononoke: do not log too big node lists
Summary:
Some wireproto methods may have huge argument lists. They just print too much
data to stderr, and make stderr basically useless. Let's limit it

Reviewed By: jsgf

Differential Revision: D8076949

fbshipit-source-id: 58e760f25a7d4fdc9fc7bd95635f916a08e15ed2
2018-05-22 06:49:56 -07:00
Stanislau Hlebik
df27ef0109 mononoke: accept non-empty rootdir in gettreepack
Summary:
It happens quite often in practice, so we have to support it.
Luckily it's not that hard to implement

Reviewed By: jsgf

Differential Revision: D8076494

fbshipit-source-id: 460ba8b4bac121b84554e89b285d5ef78cff4838
2018-05-22 06:49:56 -07:00
Stanislau Hlebik
2b896f2cf7 mononoke: log wireproto request parameters
Summary:
Log parameters to scuba for getfiles and gettreepack.  These are the most
important wireproto methods.

Reviewed By: jsgf

Differential Revision: D8076492

fbshipit-source-id: 031bad732ee31d254a707ddd0e8c444d23c2fb0f
2018-05-22 06:49:56 -07:00
Lukas Piatkowski
76688a2e4f bundle2-resolver: ignore phases pushkey
Summary: There is nothing we can do with it ATM

Reviewed By: StanislavGlebik

Differential Revision: D8090873

fbshipit-source-id: 232024938fe33583e328ad3231d9213dd6792601
2018-05-22 05:15:23 -07:00
Franck Stauffer
d3479724d5 Update rust-crates-io
Summary: csv crate has been updated to 1.0.0 which has API changes compared to the previous version.

Reviewed By: sunshowers

Differential Revision: D8014794

fbshipit-source-id: 8c5f148050c042df47a76fa2f8c7634794c69ccd
2018-05-21 14:00:04 -07:00
Simon Farnsworth
05acc629e0 Make memory manifests use less mutation
Summary: Once we have a lazy loading version, we'll want a way to cope with multiple accessors all trying to update the same `children` array with identical data; make it immutable in use, so that overwriting it multiple times is harmless

Reviewed By: jsgf

Differential Revision: D8014908

fbshipit-source-id: 9a2750fb1fca54601051fede1d9a37de8cfc2a74
2018-05-21 06:57:34 -07:00
Lukas Piatkowski
c894d73317 new_blobimport: add conf parameter to define manifold prefix of blob keys
Reviewed By: StanislavGlebik

Differential Revision: D8057267

fbshipit-source-id: 909a647e93fc01dddd95092bf747e9274069a6a0
2018-05-21 06:24:12 -07:00
Lukas Piatkowski
d0b695406a new_blobimport: buffer_unordered the changesets in main.rs
Summary:
Instead of writing changesets one-by-one run mutiple of them at once.
The size `100` for the buffer is arbitrary, but it shouldn't matter much since we already have backpressure on the database writes.

Reviewed By: farnz

Differential Revision: D8057268

fbshipit-source-id: ca3766505395dcb6be6684323462f1bb23222435
2018-05-21 06:24:12 -07:00
Stanislau Hlebik
08b1e0226c asyncmemo: do not add key sizes to the total weight
Summary:
We had an asyncmemo bug when keys were, for example, Strings. If we insert
String::new("key"), and then try to remove String::new("key"), then these keys
may have different weights because Strings may have different capacity.

This is not the case for values though, because inserted and deleted value is
always the same object.

Let's not take key sizes into account at all. That means that the real asyncmemo memory usage will be
higher, however values are a great deal bigger than keys, so it sholdn't be an
issue.
Also we are planning to do it anyway, because we want to split
asyncmemo hashmap into in-flight futures and completed futures, and in-flight
futures won't take key sizes into account.

Reviewed By: jsgf

Differential Revision: D8040684

fbshipit-source-id: 332dbe5663182dd84ea291ca4b33b41995ac0166
2018-05-18 01:58:19 -07:00
Jeremy Fitzhardinge
337d3797a8 rust/asyncmemo: try using parking_lot for locking
Summary:
parking_lot's primitives are apparently lighter-weight than using
standard (pthreads) ones, and are more or less drop-in replacements.

Reviewed By: farnz

Differential Revision: D7661246

fbshipit-source-id: c7558a15971bf5b30c4dadb9437586832cdad3d4
2018-05-17 12:27:27 -07:00
Stanislau Hlebik
8dd4ffb6eb mononoke: add admin tool
Summary:
This tool will be installed on all devservers in our team. It should have
useful debugging commands. Currently it has a command to fetch an entry from
the blobstore, and a command to get content by path/commit hash.

Reviewed By: farnz

Differential Revision: D8028933

fbshipit-source-id: e0c37660a24e40dd9dc8f19d1789b2f25d99bfe6
2018-05-17 01:06:50 -07:00
Simon Farnsworth
2a1b5533c3 Add and remove items from memory manifests
Summary:
We're going to need to be able to edit memory manifests. Provide
remove and set operations, to match the Bonsai Changeset data structures

Reviewed By: StanislavGlebik

Differential Revision: D7620527

fbshipit-source-id: e85459c5dbfa8855267fd2cf6578c9fc39f223f8
2018-05-16 09:35:28 -07:00
Simon Farnsworth
0ff53dd012 Skip empty manifests on save
Summary:
Removing entries can leave us with empty manifests. Rather than clean
that up mid-flow, simply skip empty manifests when saving

Reviewed By: StanislavGlebik

Differential Revision: D7620526

fbshipit-source-id: 2f0799eba305a5295eaad28cd4ad90c9de04306f
2018-05-16 09:35:28 -07:00
Simon Farnsworth
5cfff4305d Make it possible to keep the manifest tree in memory
Summary:
To do Bonsai Changesets, we're going to need to perform surgery on
manifests. Provide a mechanism to get the Tree nodes only into memory, and
write them back out, so that we can do the surgery the easy way.

Reviewed By: StanislavGlebik

Differential Revision: D7557271

fbshipit-source-id: 7afdc3ef464fc042eb758af863ade8938c4e9fc5
2018-05-16 09:35:28 -07:00
Simon Farnsworth
4f1a5d8ea1 Make it possible to generate hashes for uploaded content during upload
Summary:
Previously, we assumed that all content hashes came from Mercurial;
this is not going to remain true, as we will want to be able to upload manifests
that have been synthesised from Bonsai Changesets. Turn the previous boolean
into a tri-state, and fix up all callers to get the behaviour they expect.

Reviewed By: StanislavGlebik

Differential Revision: D8014911

fbshipit-source-id: 9156b9fab4542ceb269626ad005e1b28392b5329
2018-05-16 09:35:28 -07:00
Lukas Piatkowski
3174e6e60b new_blobimport: fix misspelled max-concurrent-request-per-io-thread clap parameter
Reviewed By: kulshrax

Differential Revision: D7971048

fbshipit-source-id: 39ef3df4d2fcd9c1d60f21707c0e4d4c2612180c
2018-05-11 12:54:46 -07:00
Lukas Piatkowski
7dff6240c1 new_blobimport: speed up changeset parsing
Summary: Parsing and reading revlogs is cpu intensive, thus let's use cpupool for it

Reviewed By: StanislavGlebik

Differential Revision: D7926174

fbshipit-source-id: 7f023088941e1ad118a683da972f87607e0bfec4
2018-05-11 12:54:46 -07:00
Lukas Piatkowski
1f58bd7060 new_blobimport: print number of uploaded CS every 5000
Summary: printing every CS is too verbose, but we still want to see progress in non-debug mode

Reviewed By: kulshrax

Differential Revision: D7925747

fbshipit-source-id: c3ed92ef8c8fbf7714779a2bf011d31c94aefa37
2018-05-11 12:54:46 -07:00
Jeremy Fitzhardinge
51c49a47be tp2: update to rust 1.26.0 and corresponding rust-crates-io rebuild
Summary:
Rust 1.26 adds many new language features. In particular `impl Trait` is now
stable, so we no longer need `conservative_impl_trait`.

There also seems to have been changed in the (unstable) TryFrom with respect to
usize, and the behaviour of the never type `!`.

There are still a few deprecation warnings, but they don't cause the build to
fail.

Path remapping is now stable, so the buck config needs to change to use it
rather than the unstable command line option.

TODO:
- get aarch64 rust-crates-io build (can defer to a later update)

Reviewed By: Imxset21

Differential Revision: D7966091

fbshipit-source-id: 2e61e262c21eb01c852a36f49c6a6369cdaddcdb
2018-05-11 11:07:33 -07:00
Lukas Piatkowski
25ea94dd27 server: remove clienttelemetry from capabilities since it is not supported yet
Summary: this breaks the prod since we are not able to parse clienttelemetry being send by hg

Reviewed By: jsgf

Differential Revision: D7967361

fbshipit-source-id: e10eb52852ccb8c2878db01cd63b05cd7f901ae4
2018-05-11 08:52:43 -07:00
Arun Kulshreshtha
4483e94781 Update tp2 to patch Diesel
Summary:
@[1636530097:mung] reported that there was a bug wherein Diesel was incorrectly using MySQL's API by incorrectly calling `mysql_store_result` after `mysql_next_result` indicates that no more results are available. This behavior [appears to be intentional](705cdbe1fe/diesel/src/mysql/connection/raw.rs (L160)), but directly contradicts what the [documentation says is correct](https://dev.mysql.com/doc/refman/8.0/en/mysql-store-result.html). In MySQL 8.0, this results in the client getting an error for incorrect usage of the API.

I've added a local patch to [our fork of Diesel](https://github.com/kulshrax/diesel) on Github to [remove the extra call to `mysql_store_result`](7ae79c193e), and rebuilt the `rust-crates-io` tp2 project to use this version of Diesel. This diff updates the symlinks in fbcode to point to the updated tp2 project.

Reviewed By: lth

Differential Revision: D7961290

fbshipit-source-id: 804c599a5688cd54fb0fcc33688c608d068d7a7b
2018-05-10 18:17:32 -07:00
Stanislau Hlebik
7e540c6dbc mononoke: use tcp instead of unix socket for hgcli
Summary: This allows us to put hgcli on the different host

Reviewed By: jsgf

Differential Revision: D7910980

fbshipit-source-id: 45bdd1ee42b54f8f1a425ed6950e785cdf85bfc3
2018-05-10 02:02:40 -07:00
Stanislau Hlebik
97c75e1076 mononoke: do not fail in case of bad connection
Summary: Let's just log it

Reviewed By: jsgf

Differential Revision: D7910978

fbshipit-source-id: 50dd61637d5b967f4c4af086539f565d8ddb4be6
2018-05-10 02:02:40 -07:00
Stanislau Hlebik
37db2d0ff7 mononoke: configure Manifold QPS via config option
Summary:
This is a (hopefully) short term hack to overcome the problem of overloading
Manifold.
Ideally manifold client has to adjust dynamically to the load. However
implementing it is
not trivial, so for now let's configure via config option.

Reviewed By: jsgf

Differential Revision: D7910979

fbshipit-source-id: c2dc32b592747732e7e6574e0fecf2d0aaef447e
2018-05-10 02:02:39 -07:00
Stanislau Hlebik
a4e7962ffc mononoke: add a separate connection acceptor thread
Summary:
Curently hgcli can connect to Mononoke only if they are on the same host,
because unix domain socket are used. Also Mononoke has to use separate unix
domain socket for different repos.
The goal of this stack of diffs is to remove these limitations:
1 Make it possible to have hgcli and Mononoke server on different hosts
2 Make it possible to use one port/unix domain socket to connect to many repos.

This diff adds a separate thread that parses the Preamble, extracts the
reponame and sends request to a thread responsible for this repo.

Also hgcli now has a new cmd line option that specifies path to connect to.

Reviewed By: jsgf

Differential Revision: D7845156

fbshipit-source-id: a48bcfeec4755b2d5b3dfcf8e0383e6945178018
2018-05-10 02:02:38 -07:00
Stanislau Hlebik
1e8184e231 mononoke: fix sshrelay
Summary: put_slice panics if not enough space. This diff fixes it

Reviewed By: jsgf

Differential Revision: D7876156

fbshipit-source-id: b1e2cc520e5c598588df9a8090fb70efb413b381
2018-05-10 02:02:35 -07:00