Commit Graph

138 Commits

Author SHA1 Message Date
Tim Fox
acd3a7587e Add unit tests for runhook command line utility
Summary: This diff adds unit tests for the runhook command line utility

Reviewed By: jsgf

Differential Revision: D8257571

fbshipit-source-id: 5c390d2a45d895080fce28dcd7943da5d803ff92
2018-06-07 08:36:41 -07:00
Tim Fox
32dd998895 Add tests for different types of Lua hook errors
Summary:
This diff adds more robust testing for various errors in Lua hooks.
It also contains a little bit of cleanup in the runHook command

Reviewed By: StanislavGlebik

Differential Revision: D8253525

fbshipit-source-id: de9d298e70ec647f2c13e27c9937605ac5b57485
2018-06-07 08:36:41 -07:00
Zeyi Fan
c19780406d Improve the description of new_blobimport
Summary: Changed the about section of new_blobimport to something descriptive.

Reviewed By: kulshrax

Differential Revision: D8307334

fbshipit-source-id: 2198d43cdfaf566b57001be5230a74206306dac1
2018-06-06 19:07:35 -07:00
Matthew Dippel
260984ec5d Changed help and about for mononoke admin
Summary:
Replaced the help and about messages to summarize what the admin tool
is useful for

Reviewed By: jsgf

Differential Revision: D8302356

fbshipit-source-id: 77d1d4bb50825b0cc2d1ac2ee8d47ee906e04a22
2018-06-06 13:00:54 -07:00
Lukas Piatkowski
27bdcb40b2 filenodes: control size of the connection pool
Summary:
The new_blobimport job is having difficulties when the pool is too large, because the write transactions are taking too long. If the pool is configured to be 1 for it then everything seems fine and fast enough.
On the other hand the Mononoke server should have bigger connectino pool size to be able to quickly respond for read requests.

Reviewed By: farnz

Differential Revision: D8235413

fbshipit-source-id: 84e0013ce569c3f103a2096001605aab828d178c
2018-06-05 05:58:31 -07:00
Jeremy Fitzhardinge
a2daf8c2d5 mononoke: no need to pass Mysql connection params by value
Summary: It only needs to borrow them.

Reviewed By: kulshrax

Differential Revision: D8244267

fbshipit-source-id: 2a24a3b7c6eb65177e4e26c57650dd7e096b4202
2018-06-04 08:51:25 -07:00
Tim Fox
3c46a1d9c3 Return executions as map from hookmanager.run_hooks and create a richer HookExecution type
Summary:
Now hook manager returns result of running hooks as BoxFuture<HashMap<String, HookExecution> where HookExecution is a new richer type representing the result of running a hook.
This provides more info to the user as to why the hook rejected the changeset and a map is simpler to lookup a particular hook failure than a Vec.

Reviewed By: StanislavGlebik

Differential Revision: D8235970

fbshipit-source-id: 9a617b6d459f105aa9dad9782e784459dd716c45
2018-06-04 04:15:09 -07:00
Rain ⁣
af9eaab880 allow services to implement custom status
Summary:
There's a bit of Rust/C FFI, but hopefully the comments make it clear
how ownership works.

As part of the lifecycle I also had to handle shutdown safely. This means that `run_service_framework` actually returns now.

Reviewed By: jsgf

Differential Revision: D8133252

fbshipit-source-id: 1e394a60c6e62f5c3d56933f3e7be7a2bfd1e2c0
2018-05-31 19:13:54 -07:00
Tim Fox
a8a5e3f1ee Implement HookManager install and uninstall of hooks and running hooks on cpu pool
Summary:
This diff introduces HookManager which knows how to install, uninstall and run hooks.
Hooks are now run in parallel on a cpu_pool.

Reviewed By: lukaspiatkowski

Differential Revision: D8208538

fbshipit-source-id: f18687c14a15cadf4d832318cd66fa400586c29f
2018-05-31 07:21:00 -07:00
Simon Farnsworth
b2978095e2 Add an admin command option to interrogate memcache blobstore
Summary: If we're going to use memcache to cache things, we need to be able to confirm that the blobstore contains what we expect. Add an admin option that lets us check what's in memcache and/or in the blobstore when using memcache

Reviewed By: StanislavGlebik

Differential Revision: D8124624

fbshipit-source-id: 763786930cf9f4be6d2d8e346ae1ef94dc8e492c
2018-05-30 07:21:15 -07:00
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
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
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
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
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
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
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
Lukas Piatkowski
5c2f0c675c new_blobimport: add --debug flag
Reviewed By: StanislavGlebik

Differential Revision: D7925219

fbshipit-source-id: 54e626c53eece7bc3742d9d0b6f1b5e1c5796c0e
2018-05-09 03:05:56 -07:00
Stanislau Hlebik
e99fce6bd4 mononoke: add separate types for Bookmark and BookmarkPrefix
Summary:
This will make it easier to change the "real" bookmark type from AsciiString to
String if we decide to do that.

BookmarkPrefix is a separate type because we may want to change it from
AsciiString to String. Also we don't want to confuse a bookmark prefix with a
bookmark name.

Reviewed By: jsgf

Differential Revision: D7909992

fbshipit-source-id: 3d4d075c204ed5ef1114a743430982c2836bac04
2018-05-09 02:11:17 -07:00
Stanislau Hlebik
b94f7fe0c1 mononoke: use many threads for the blobstore
Summary:
Let's use the new feature in SendWrapper to use many io threads. That will help
us mitigate the high cpu usage issues we were having with blobstore requests.

Manifold blobstore now creates the io threads itself.

Reviewed By: kulshrax

Differential Revision: D7831420

fbshipit-source-id: ec9f3327347ca6bfbd23c482e69a6fee663b1da5
2018-05-03 10:31:32 -07:00
Stanislau Hlebik
b3432410ae mononoke: use caching for filenodes
Summary: As with changesets and blobs, let's cache filenodes data

Reviewed By: jsgf

Differential Revision: D7831105

fbshipit-source-id: 334cb474f5cc3ef8dba0945d11273b2b3875e8ad
2018-05-03 10:31:32 -07:00
Lukas Piatkowski
128d7a2424 cmd utils: add revlogrepo command for reading revlogs in Rust
Summary: The goal is to be able to read revlogs using Rust code and also parse and serialize them in Rust formats for debugging purposes

Reviewed By: farnz

Differential Revision: D7830358

fbshipit-source-id: 95e257a4482eca22b328b174bce3fceec1b47245
2018-05-01 16:35:08 -07:00
Lukas Piatkowski
3232bfa4b2 blobrepo: accept a list of exepcted changed files for Changeset creation
Summary:
The commits that are blobimported have out of order or simply incorrect lists of changed files.
Because we have to persists Changesets as is we are passing the untouched list of files here to be used by Changeset.

Reviewed By: farnz

Differential Revision: D7830310

fbshipit-source-id: 56adec2c317896decaa9176b3a6bfb0cab187ed0
2018-05-01 16:35:08 -07:00
Lukas Piatkowski
4d854a243e blobrepo: verify that the Changeset's hash provided by client matches our computed hash
Reviewed By: jsgf

Differential Revision: D7779664

fbshipit-source-id: c844c41c1ff825babe653e4d2caa98348ad34483
2018-04-28 16:33:03 -07:00
Lukas Piatkowski
de31985b79 utility cmds: add blobstore command to query blobstore for content
Summary: Useful utility that let's you f.e. fetch blob of data from manifold, decode it and show it to you

Reviewed By: jsgf

Differential Revision: D7779154

fbshipit-source-id: aaa4ae1d09b64f7f52c7942a51e8bb4ccc0cb700
2018-04-28 16:33:03 -07:00
Lukas Piatkowski
18800e00ea heads: remove related crates
Summary: the idea of Mercurial heads in Mononoke will be represented by bookmarks, so there is no need to have them around

Reviewed By: StanislavGlebik

Differential Revision: D7775032

fbshipit-source-id: 1618a1e51862d7c115b2955082f40ee890a045f1
2018-04-27 04:35:21 -07:00
Lukas Piatkowski
7e6b69046c blobrepo: persist bookmarks in on-disk Sqlite database
Summary: For on-disk-rocksdb use cases we should persist bookmarks like any other table we use

Reviewed By: farnz

Differential Revision: D7728717

fbshipit-source-id: f63a6410f5ed254a719a16a7504d1b31da5a20a8
2018-04-24 11:17:06 -07:00
Lukas Piatkowski
bccad1bf42 new_blobimport: import bookmarks from revlog repo
Summary:
This change isn't doing much on it's own since rocksdb's BlobRepo is using in memory Bookmarks ATM and they dissapear when import is finished.
Later bookmarks will be used for Head discovery, then it will be properly tested

Reviewed By: farnz

Differential Revision: D7728716

fbshipit-source-id: ad50f35b18d93aa1e38951408092e46e67fde0c7
2018-04-24 11:17:06 -07:00
Lukas Piatkowski
a692a2a9ea new_blobimport: split main.rs to make this crate more maintable
Summary: I am planning to add importing bookmarks, doing it on current main.rs would make it unreadable, so I am splitting this file now

Reviewed By: farnz

Differential Revision: D7728185

fbshipit-source-id: fdfb4f60eecd9c8af7626bd0e892bb1bfbf7f081
2018-04-24 11:17:06 -07:00
Lukas Piatkowski
f28ce26504 blobrepo: handle changesets with null root manifests
Summary: The eden integration test contains a commit with no content which new_blobimport couldn't import. With this changes the commit API is capable of handling such commits.

Reviewed By: jsgf

Differential Revision: D7709243

fbshipit-source-id: 7d55eb2ec421820d189ab05b0f8cb4411f850a7b
2018-04-24 11:17:06 -07:00
Stanislau Hlebik
4a731b2118 mononoke: do not fail if duplicate changeset was inserted
Summary:
Let's fail only if inconsistent data was inserted - for example, same commit
hash but different parents.
This matches core hg behavior, and also it's completely normal for commit cloud
to send more parent commits than necessary.

Reviewed By: lukaspiatkowski

Differential Revision: D7722649

fbshipit-source-id: 172a0985fb3fda27d55e9dce8916ec3793de5db9
2018-04-24 08:49:48 -07:00
Stanislau Hlebik
b4c67170fd mononoke: use exactly the same changesets during blobimport
Summary:
There are a few separate steps during blobimport. One of them is inserting the
blobs and another is inserting the changesets. That worked fine if RevlogRepo was
static. However if RevlogRepo has changed between first and second step we
could've inserted blobs for N commits, but insert (N + X) changesets into
changesets table. That means that a few commits would have no blobs at all.

This diff fixes it by fixing the changesets that we want to blobimport
beforehand.

Reviewed By: farnz

Differential Revision: D7615133

fbshipit-source-id: 1a66907e34a65588b101199c8f59abda53f7bc20
2018-04-24 02:18:38 -07:00
Stanislau Hlebik
392b020b8f mononoke: add an option to create mysql changesets in blobimport
Summary: As with filenodes, we also want to write changesets in a real store.

Reviewed By: lukaspiatkowski

Differential Revision: D7615101

fbshipit-source-id: 269deb8fc3c1f58afb82f453a68ea4d8a3f1f63d
2018-04-24 02:18:38 -07:00
Stanislau Hlebik
3f600af142 mononoke: add Changesets cache
Summary:
Use asyncmemo to cache Changesets.

Unfortunately currently we are using separate asyncmemo cache, so we have to
specify the size for the caches separately. Later we'll have a single cache for
everything, and the number of config knobs will go down.

Reviewed By: lukaspiatkowski

Differential Revision: D7685376

fbshipit-source-id: efe8a3a95fcc72fab4f4af93564e706cd1540c2f
2018-04-22 04:59:27 -07:00
Stanislau Hlebik
a48e52fb7e mononoke: use caching blobstore
Summary:
Let's use it! Pass config option that set's the cache max memory usage (don't
put a limit on the number of entries, it's useless in that case).

Currently we'll set a separate size for each of the caches that we use
(blobstore, changesets, filenodes, etc). Later we'll have just one single option that
sets the cache size for all of them.

Reviewed By: lukaspiatkowski

Differential Revision: D7671814

fbshipit-source-id: f9571078e6faaa80ea4c31c76a9eebcc24d8a68a
2018-04-22 04:59:27 -07:00
Siddharth Agarwal
c652345586 blobrepo: optionally verify that provided and computed entry hashes are consistent
Summary:
We know that the hashes for non-root-tree-manifests and filenodes
should always be consistent. Verify that.

Reviewed By: farnz

Differential Revision: D7704087

fbshipit-source-id: 7f6207878c5cd372b272aa6970506dd63b5a3c7c
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
9b5ee510cb blobrepo: use the incoming provided hash as the blobstore key instead of computing it
Summary:
As the comment explains, sometimes the hashes don't match the
contents. Accept such pushes.

Reviewed By: farnz

Differential Revision: D7699930

fbshipit-source-id: 376f01b6cf03f6cad84c2c878d192d55f8d81812
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
9e49e6da1a blobrepo: make upload_entry arguments named, move to Hg domain
Summary:
We're going to keep this around for now as part of double-writing.
All the hashes here are definitely Mercurial hashes, so use them that way.

Reviewed By: lukaspiatkowski

Differential Revision: D7683890

fbshipit-source-id: 270091cd11f3cec7ef4cf565de5ef913fcf7adea
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
3591b86b9f mercurial: switch file::File to HgNodeHash
Summary:
file::File works entirely in the Mercurial domain, so these
conversions are good.

Reviewed By: StanislavGlebik

Differential Revision: D7665973

fbshipit-source-id: 8a192c5d1886492ad21593693b080c8e5ddf8f7e
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
ed1c842dcd blobrepo: rename BlobEntry to HgBlobEntry
Summary:
This is because these Mercurial entries are (at least currently) going
to be stored as they come in, and this data structure is entirely in the
Mercurial domain.

Reviewed By: lukaspiatkowski

Differential Revision: D7664972

fbshipit-source-id: 9de5475eed0d7ab7085c29fd0282f205043cfe5a
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
7dc019e422 blobrepo: add some context + clean up error messages
Summary:
I was trying to debug something with the new blobimport, and this was
getting in the way.

Reviewed By: StanislavGlebik

Differential Revision: D7664660

fbshipit-source-id: 2ec4ee79fbe13584f35e7dcd9e8df2b8bdf181c0
2018-04-18 19:53:34 -07:00