Commit Graph

17 Commits

Author SHA1 Message Date
Rain ⁣
33d7591900 blobrepo: turn manifold connection arguments into a struct
Summary:
There are so many individual arguments here that it's honestly hard to keep
track.

It is unfortunate that a bunch of string copies have to be done, but not really
a big deal.

Reviewed By: jsgf

Differential Revision: D8675237

fbshipit-source-id: 6a333d01579532a0a88c3e26b2db86b46cf45955
2018-06-28 11:46:06 -07:00
Stanislau Hlebik
531986e5da mononoke: rename *test_manifold to *_manifold
Summary: It's no longer test, we use it in prod

Reviewed By: farnz

Differential Revision: D8611639

fbshipit-source-id: dc52e0bcdc26c704c0d9cf820d7aa5deae3e06e4
2018-06-25 07:51:20 -07:00
Tim Fox
7a71a18012 Introduce ChangesetStore so hook manager can get changesets from blobstore or in memory cache
Summary:
This diff introduces the ChangesetStore trait so the HookManager does not directly depend on the BlobRepo. This means the manager can obtain changesets from a simple in memory implementation of ChangesetStore which can be populated with changesets before they are committed to the server. This means the exact same hook manager logic can be used irrespective of whether the changesets are committed or not.

The diff includes two implementations of ChangesetStore - A simple in memory implementation backed by a HashMap, and one that backs onto BlobStore.

Reviewed By: StanislavGlebik

Differential Revision: D8446430

fbshipit-source-id: 8d14e48cb562fcd10a17370e34f13a662af827df
2018-06-19 20:53:00 -07:00
Tim Fox
d7348170c0 Implement memoization of hooks with Asyncmemo
Summary: This diff implements memoization of hooks. If a hook has already been run against the same changeset it is not run again, instead the cached result is used.

Reviewed By: StanislavGlebik

Differential Revision: D8431102

fbshipit-source-id: b4080ba48a3214e767392cbcb46425aa05bc2b64
2018-06-18 13:52:21 -07:00
Tim Fox
06b60d5f67 Refactor hook manager to take changeset_id and lookup changeset internally
Summary: This diff refactors the hook manager to run hooks based on a changeset_id not the actual changeset. The actual changeset is looked up by the hook manager lazily when running a hook. This is needed to make it work well for AsyncMemo as we don't want the changeset cached in the key.

Reviewed By: StanislavGlebik

Differential Revision: D8422442

fbshipit-source-id: 40bc89124942e05c5aaeb2b4ee00215afd816642
2018-06-18 13:52:21 -07:00
Tim Fox
e5805bb07c Use in memory repo test fixture for runhook tests
Summary: This diff refactors the runhook tests to use the linear fake blobrepo to supply changesets

Reviewed By: farnz

Differential Revision: D8418096

fbshipit-source-id: 74fd2578095dbae86ed9e96eac3ca4b344c036da
2018-06-18 08:21:25 -07:00
Tim Fox
1f5c837cf9 Expose repository name to hook
Summary: Expose repository name to hooks

Reviewed By: StanislavGlebik

Differential Revision: D8346071

fbshipit-source-id: d0cceeed14c6c5e3e925988c68172ec8cf68f2af
2018-06-18 08:21:25 -07:00
Lukas Piatkowski
18d475fb9a filenodes: separate pool of connection for writes from reads
Summary: There shouldn't be more than one thread writing to the database, because it causes lags in slaves and they race for database locks between themselves. One write connection should be sufficient enough.

Reviewed By: StanislavGlebik

Differential Revision: D8348604

fbshipit-source-id: ceef081ed89611978accfa55969883078d65a58f
2018-06-11 06:38:14 -07:00
Tim Fox
cbddfe0e10 Implement all the fields of changeset for passing to hooks
Summary: This test implements the passing of all current changeset fields to hooks

Reviewed By: StanislavGlebik

Differential Revision: D8298019

fbshipit-source-id: 0e6be3c83b1e4d4c3eab95c76c9041ea2a57f0d3
2018-06-08 03:50:30 -07:00
Lukas Piatkowski
4f44c3f130 mercurial_types: remove D* types and move mercurial types around
Summary:
Now it is as it should be: mercurial_types have the types, mercurial has revlog related structures
burnbridge

Reviewed By: farnz

Differential Revision: D8319906

fbshipit-source-id: 256e73cdd1b1a304c957b812b227abfc142fd725
2018-06-07 13:19:16 -07:00
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
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
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
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
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