Commit Graph

939 Commits

Author SHA1 Message Date
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
Simon Farnsworth
9b98afc9a4 Implement is_present directly in MemcacheBlobstore
Summary:
When I implement a cachemutex to keep the herd from all trying to
write the same blob multiple times, we'll be able to accelerate this. In the
short term, move the implementation up to here so that the change will be
obvious when it's put up for review.

Reviewed By: jsgf

Differential Revision: D8318152

fbshipit-source-id: f117c5fd834cab55ace10ac46bffa881457c840a
2018-06-08 06:53:16 -07:00
Simon Farnsworth
59ddd45a41 Don't do a fetch when MemoizedBlobstore::is_present is called
Summary:
Memcache is going to provide a faster implementation of `is_present`
that relies on the put cachemutex. We lose all the benefits if `is_present` up
here ends up always calling `get` from lower layers - teach it not to do that.

Reviewed By: jsgf

Differential Revision: D8318151

fbshipit-source-id: 130d4cb17c530c8677bdd563806989c393b4c6cf
2018-06-08 06:53:16 -07:00
Lukas Piatkowski
5220fc66de bundle2-resolver: add context to errors when decoding filelogs
Summary: more context, better errors

Reviewed By: farnz

Differential Revision: D8298947

fbshipit-source-id: bc950ca39b8fc010f3a225f0810e13f62d6efa24
2018-06-08 05:33:41 -07:00
Lukas Piatkowski
c90ee251ab blobrepo: add more cotext around processing and fetching from blobstore
Summary: Lack of proper error context makes it hard to understand errors returned from Mononoke

Reviewed By: StanislavGlebik

Differential Revision: D8298154

fbshipit-source-id: 57fe5df7d891b5215fba783255178f14122199cf
2018-06-08 05:33:41 -07:00
Lukas Piatkowski
186d9ec623 blobrepo: improve error contexts for ChangesetCreate
Summary: the newly added context should add much more visibility into why an error was returned

Reviewed By: jsgf

Differential Revision: D8286343

fbshipit-source-id: d65387f40da2c14964e85552ae1ec7e75a135c47
2018-06-08 05:33:41 -07:00
Lukas Piatkowski
80b114f3db bundle2-resolver: reorganize the code so that returned Error's have proper context attached
Summary:
This change screams for using something like "await", but because we don't have it yet we need to reorganize this code into a chain of `and_then`.
Thanks to that if we attach a context to a future inside `and_then` the context will be properly reported when an error happens inside that future.

This is a bit of a simplification, but the previous code used the equivalent of `map` rather than `and_then` and this resulted in Errors returned from within f.e. `upload_changesets` to have a context of "While resolving B2xInfinitepushBookmarks" attached which was confusing.

Reviewed By: StanislavGlebik

Differential Revision: D8284606

fbshipit-source-id: b8a4bd63b9732caea53089f1b9088f2624a42f87
2018-06-08 05:33:41 -07:00
Lukas Piatkowski
e6837e1671 stats: prepend "mononoke." prefix to stats exported from mononoke
Summary: this will make it easier to identify stats exported from mononoke vs external libraries

Reviewed By: StanislavGlebik

Differential Revision: D8331418

fbshipit-source-id: c151e76aa386fb13759fced7cc07b03ac67fe051
2018-06-08 04:20:42 -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
Rain ⁣
cfb1588d02 update username and email in Rust code
Summary: Going to take a while to get to everything, but here's a start.

Reviewed By: Imxset21

Differential Revision: D8311107

fbshipit-source-id: ada1908b320a5277eda2587d7e8f26b13b952154
2018-06-07 21:07:14 -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
Rain ⁣
e18b0c3676 blobrepo: factor out local state initialization code
Summary: Factor out common stuff for local state.

Reviewed By: StanislavGlebik

Differential Revision: D8310823

fbshipit-source-id: e1ce7eebd76d37688e830a5df0486bdfd1e3361c
2018-06-07 09:51:31 -07:00
Rain ⁣
02c2187851 tests: fix a couple of integration tests
Summary:
`hg pushbackup` got moved to the `infinitepushbackup` extension.

Also fix some minor output changes.

Reviewed By: StanislavGlebik

Differential Revision: D8310862

fbshipit-source-id: ae8d5579dd4082bd91e80beef4a4b675af9a8986
2018-06-07 09:51:31 -07:00
Rain ⁣
b244f1fbc5 new_blobimport: clean up some obsolete code
Summary:
* `.hg` is where mononoke sockets used to reside, but they no longer do.
* `heads` is no longer a thing
* `BlobRepo::new_rocksdb` already takes care of creating `SqliteChangesets` if it doesn't exist.

Reviewed By: StanislavGlebik

Differential Revision: D8289145

fbshipit-source-id: c8b0ad3b9bee5c22f79861474fd08256dbd0fb8f
2018-06-07 09:51:31 -07:00
Rain ⁣
26356e4e3d increase the wait timeout in integration tests to 15 seconds
Summary: Unfortunately even 10 seems to be too little for stress runs.

Reviewed By: StanislavGlebik

Differential Revision: D8310639

fbshipit-source-id: 280824a7c2ec2283d2ef3acfb968e336ca13c93b
2018-06-07 09:51:31 -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
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
9086a3ea73 bundle2-resolver: lower severity of not useful debug logs to trace
Summary: The data logged there is too large, so print only a subset of it (changesets hashes) and only as context for error

Reviewed By: farnz

Differential Revision: D8235881

fbshipit-source-id: c81eeca2baf26def4d24b288f9d29dd8c23823d8
2018-06-05 13:48:28 -07:00
Lukas Piatkowski
0aa3c76930 blobrepo: lower severity level of "Upload blob stats" log
Summary: This log is by far the most common one and it makes reading logs much harder. It should probably be changed to ODS counters, but for now lets just make it trace!

Reviewed By: farnz

Differential Revision: D8235663

fbshipit-source-id: 3685b260f1c6c43c1fde8501731583debc8d063b
2018-06-05 13:48:28 -07:00
Rain ⁣
c18bbfa396 fix race with bookmark updates during pulls
Summary: See the comment for a full explanation.

Reviewed By: jsgf

Differential Revision: D8274912

fbshipit-source-id: 936baa60925fff5ddf1e903c8408410c0a429e77
2018-06-05 13:03:04 -07:00
Stanislau Hlebik
8e96fef4b1 mononoke: replace fuse() with ignore_res()
Summary:
Fuse panics if there is an error. However the errors are quite possible - for
example, if client went away then sending stderr log panics and the whole
Mononoke server fails. This diff fixes it by using ignore res

Reviewed By: lukaspiatkowski

Differential Revision: D8276600

fbshipit-source-id: e0c91a082d80d7c54372171f9893f98b2a1e8304
2018-06-05 06:26:10 -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
Lukas Piatkowski
ca35624029 filenodes: remove transation over filenodes update
Summary:
The transaction is not necessary in there, since if any of the query fails then the commit is not written in changesets table.
We need to remove it, because with many writes to the filenodes table some of the transactions are timing out while waiting for the database's lock for transation

Reviewed By: farnz

Differential Revision: D8220722

fbshipit-source-id: 003b1369abb1a47e8ad37517745ab659116b95f6
2018-06-05 05:58:31 -07:00
Rain ⁣
c44fb39a98 packman config file for admin tool
Summary:
Going to use this to deploy on scm-owned devservers.

Following the instructions here: https://our.intern.facebook.com/intern/wiki/Distribute-a-simple-binary-to-devservers/

Reviewed By: jsgf

Differential Revision: D8274545

fbshipit-source-id: 295d6ec6c8deab67066b284482f63fdfd5945cd4
2018-06-04 22:09:49 -07:00
Stanislau Hlebik
171a456691 mononoke: use visited_pruner
Summary: See previous diff for the movitvation

Reviewed By: jsgf

Differential Revision: D8207273

fbshipit-source-id: 527c1d97546afedf36f84059ccb7c740bd412907
2018-06-04 10:28:47 -07:00
Stanislau Hlebik
bc5276ab23 mononoke: add Pruner argument
Summary:
Pruner is an FnMut that is  called on every entry
that `changed_entry_stream` visits. If Pruner returns false, then
`changed_entry_stream` won't recurse into that.

The primary motivation for that is gettreepack request. We may get requests
with a few `mfnodes`. Currently we just merge a few `get_changed_entry`
streams. The problem is that some entries will be in both streams, and thus
will be generated twice. visited_pruner changes it.

Reviewed By: jsgf

Differential Revision: D8207271

fbshipit-source-id: 1896cb68edbca57651c4767d9326b9bbbab2c980
2018-06-04 10:28:47 -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
Stanislau Hlebik
500a138b04 mononoke: add CompressContext
Summary:
We had a memory leak because context wasn't cleaned afterwards. This diff fixes
it

Reviewed By: farnz

Differential Revision: D8236762

fbshipit-source-id: f82b061f3f541d9104d1185ed04ea21224b7d5bc
2018-06-04 04:56:11 -07:00
Stanislau Hlebik
e2efcd5396 mononoke: rename Context to DecompressContext
Summary: We are going to add CompressContext in the next diff

Reviewed By: farnz

Differential Revision: D8236761

fbshipit-source-id: 0df55b9bc5e9fd78ac8c060576513c1216641ead
2018-06-04 04:56:10 -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
40311071da Hook returns future and implement lua hook as function
Summary: Hook now returns a future to allow for truly async Rust futures. Also implement Lua hooks as functions and some other small changes.

Reviewed By: StanislavGlebik

Differential Revision: D8235778

fbshipit-source-id: 92753bde4c9b65d15286102827e2f47673feb0c1
2018-06-04 04:15:09 -07:00
Jeremy Fitzhardinge
6a6c06ac81 rust/tp2: update rust-crates-io
Summary:
Big change here is update to rand 0.5. This is a significant API
change. quickcheck still uses rand 0.4, so for quickcheck users I changed it so
that quickcheck re-exports the rand it uses. This means that quickcheck users
are unchanged aside from using quickcheck::rand, whereas direct rand users have
been updated to use the new API.

Reviewed By: farnz

Differential Revision: D8234503

fbshipit-source-id: f9e620851b8dfcc33f22a0af26122adcd5fbde39
2018-06-01 09:22:18 -07:00
Stanislau Hlebik
3ab7c84382 mononoke: rename path to dirname
Summary:
I got confused myself, so decided to rename it.

dirname here means "all the path without the last path component". So for directory "a/b/c", "a/b" is a dirname. For file "a/b.txt", "a" is a dirname For root dirname is empty.

Reviewed By: jsgf

Differential Revision: D8207274

fbshipit-source-id: 0744ee020d3cf1ecc185efee445f6d40183d6366
2018-06-01 02:22:52 -07:00
Rain ⁣
8f8c956d73 wait for all repos to be warmed up before marking server as alive
Summary:
Introduce the `ReadyState` abstraction to capture repositories being
ready. Also make sure that it "fails open" -- drops and panics cause that
particular handle/future to be marked ready.

Reviewed By: lukaspiatkowski

Differential Revision: D8219667

fbshipit-source-id: 78078055c46ceaa922a4579fe42cbf89fb42a81f
2018-05-31 19:13:54 -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
Rain ⁣
873a1893ca server: move monitoring code to a separate file
Summary: Going to add a lot more code to this very soon.

Reviewed By: farnz

Differential Revision: D8152464

fbshipit-source-id: ed6b2752b470a76b5808cf7ee18fbe8939d8ffc2
2018-05-31 19:13:54 -07:00
Stanislau Hlebik
14fed129c6 mononoke: refactor changed_entry_stream to not use recursive_entry_stream
Summary:
In the future diffs we'll add a trait called Pruner, which can be used to avoid
recursing into some paths. For example, to not recurse into deleted paths, not
recurse into the paths that ends on this string etc.

In this diff we just make a small refactoring to make adding Pruner easier.
The main point of the refactoring is to not call recursive_entry_stream
function.

Reviewed By: jsgf

Differential Revision: D8207269

fbshipit-source-id: 42f246a8a7aaf7a43c40fa05ebea876830391430
2018-05-31 09:51:48 -07:00
Stanislau Hlebik
964d27f90c mononoke: add is_tree() in EntryStatus
Summary:
Just a small helper function to check if the entry is tree or not.
That should work fine for Modified entry, because both of the entries should
have the same type

Reviewed By: jsgf

Differential Revision: D8207272

fbshipit-source-id: 29d2320a06f6cb51bd36899e0da9f928af4bcb06
2018-05-31 09:51:48 -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
d39f6bc82e Improve style in memory_manifest.rs
Summary:
This is a follow-on from D8014913 (Make in-memory manifests load lazily), addressing jsgf's review comments.

I've made the following stylistic changes:

1. Use `impl Future` for all private APIs instead of `BoxFuture` (making use of `Either` instead of boxing where possible).
2. Use Rust 1.26 style `match` statements with inferred `ref` and `&` whenever possible.
3. Rework the logic in `MemoryManifestEntry::save` to not need `filter_map`.
4. Remove `future::result` and exploit `impl IntoFuture for Result` where possible to reduce code
5. Improve a couple of comments

Reviewed By: jsgf

Differential Revision: D8209186

fbshipit-source-id: c759ad8894fc25616dc6a291d46c487191f96382
2018-05-30 14:42:04 -07:00
Lukas Piatkowski
60610bfdd7 blobrepo: upload filenodes in parallel
Summary: The filenodes were uploaded serially, this caused significant performance losses.

Reviewed By: StanislavGlebik

Differential Revision: D8202109

fbshipit-source-id: 8ccc3f7bfa736d51a980e206f9868a0168b2d1b4
2018-05-30 12:06:27 -07:00
Lukas Piatkowski
0eb217cdf8 blobrepo: move signal_parent_ready before processing the entires
Summary: Since signal_parent_ready purpose is to ensure that the child Changesets might perform their own checks it is good enough to send signal_parent_ready after all blobs have been written out, but before the parent did it's own checks

Reviewed By: farnz

Differential Revision: D8202108

fbshipit-source-id: 15ac85bd18bcf9ded61363a6380ad05462c189d6
2018-05-30 12:06:27 -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
Simon Farnsworth
e1a783d3e6 Add a Memcache-backed caching blobstore
Summary:
Memcache provides us with a low-latency out-of-process cache, shared
between multiple machines. If we use this to provide a write-through cache,
then we get a couple of benefits:

1. Mononoke servers accessing the same memcache backend get low latency access
to commonly requested blobs.
2. Recently written blobs are available at low latency to the server that just
wrote them, hopefully speeding up new_blobimport.

Reviewed By: StanislavGlebik

Differential Revision: D8124623

fbshipit-source-id: 5af085aa8bb63c1366740edfda9020d72b8a9015
2018-05-30 07:21:15 -07:00
Lukas Piatkowski
244041ce2e changesets: compare old and new parent rows without IDs and ordered
Summary: As a bonus - put the whole rows in the error message to make it easier to spot what is the problem

Reviewed By: farnz

Differential Revision: D8186670

fbshipit-source-id: 719d302883b23733daa30878eaf27ea6df0180d7
2018-05-30 06:26:38 -07:00
Lukas Piatkowski
586bf6089a blobrepo: parallelize process_entries
Summary:
instead of doing for_each which causes the entries to be processed one-by-one use the map + buffer_unordered technique
This has speeden up new_blobimoprt of 2 commits from >2m to <1m30s

Reviewed By: farnz

Differential Revision: D8184176

fbshipit-source-id: 4a0c3124d2398ed41f8b93785bc3c890a23a88aa
2018-05-30 06:26:38 -07:00
Stanislau Hlebik
e874915f83 mononoke: use get_all_filenodes
Summary:
In previous diffs we've added a function that does a bulk prefetch of
filenodes. Now we can use it in the getfiles request handling code.

Before constructing file history we do a bulk prefetch. Then we use
results of the bulk prefetch as a cache. It means that we first check
whether we have file history node in the prefetched data, and if not it will be
fetched again. It allows us to later plugin a memcache or some other kind of
cache.

repo.rs file is getting bigger and bigger. I'm planning to split it, however
only after I land this diff in order not to deal with merges

Reviewed By: farnz

Differential Revision: D8185701

fbshipit-source-id: 6ca37aeb029236db51d2b5a03cb7053f969cf47e
2018-05-30 04:36:48 -07:00
Stanislau Hlebik
7b0299d92a mononoke: change from debug to trace in getfiles
Summary: It's too verbose, besides we log it remotely anyway

Reviewed By: farnz

Differential Revision: D8201176

fbshipit-source-id: 915976b7125d96b56f3ae0f0d61d0945abc71a15
2018-05-30 04:02:40 -07:00