Commit Graph

227 Commits

Author SHA1 Message Date
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
Simon Farnsworth
2d15681343 Switch to cachelib for blob caching
Summary:
Start deprecating AsyncMemo for caching purposes, by removing its use
as a blobstore cache.

Reviewed By: StanislavGlebik

Differential Revision: D8840496

fbshipit-source-id: 2549d85dfcba6647e9b0824ab55ab76165a17564
2018-07-21 13:37:14 -07:00
Rain ⁣
fa58de6e4e blobrepo: add support for doing in-memory writes to blobstore
Summary:
This proves to be extremely useful for the upcoming bonsai
verification code.

The in-memory stuff is more complicated for the database backends, so punt on
that for now with some warnings.

Reviewed By: farnz

Differential Revision: D8909426

fbshipit-source-id: 1d66d877cfa48ef06bbe614f37c66cf6c2f0446c
2018-07-20 11:37:36 -07:00
Rain ⁣
3e28228560 Back out "[mononoke][manifold] switch to thrift backed manifold client"
Summary:
The thrift client should return false or None for missing objects, but instead
errors out.

Reviewed By: StanislavGlebik

Differential Revision: D8899842

fbshipit-source-id: 81e5433ee63b7c8e6a4e898443a2a24bc784d014
2018-07-18 13:37:11 -07:00
Rain ⁣
aec68835af mercurial-types: don't overload Display for Type's manifest suffix
Summary:
I don't like this because particularly the empty string for regular
files looks weird.

Reviewed By: StanislavGlebik

Differential Revision: D8888553

fbshipit-source-id: 20a9048a19b3fdfe681160a637bc2dfc8932c113
2018-07-18 11:22:30 -07:00
Pavel Aslanov
455d59b715 fix full traversal of manifest in MemoryManifestEntry::is_empty
Summary: `MemoryManifestEntry::is_empty` caused full traversal of memory manifest

Reviewed By: sunshowers, farnz

Differential Revision: D8895341

fbshipit-source-id: 15b6d4c4e2c9ec36094fedb09d3f74a49c24bea5
2018-07-18 10:07:42 -07:00
Stanislau Hlebik
74783f77d8 mononoke: use cloned in blobrepo
Summary: Also make it possible to have mutable clones

Reviewed By: farnz

Differential Revision: D8889900

fbshipit-source-id: 77d304ec5e07c84398e328b361ebf062cd18de45
2018-07-18 04:21:42 -07:00
Stanislau Hlebik
08dd810568 mononoke: use ChangesetMetadata
Summary: Let's pass just one field instead of 4

Reviewed By: farnz

Differential Revision: D8889899

fbshipit-source-id: 8b30496a86950ed534439f5469f8740ee32345b8
2018-07-18 04:21:42 -07:00
Zeyi Fan
59103d8996 switch to thrift backed manifold client
Summary: This commit removes the usage of the old manifold client so we can get rid of `tokio_io::Remote`;

Reviewed By: jsgf

Differential Revision: D8751815

fbshipit-source-id: 41ab75076f1b2591496919ea91eb6b1d4d7ae506
2018-07-17 11:57:48 -07:00
Pavel Aslanov
894fb1e75d fixed manifest_lookup concurency issue
Summary:
Bonsai verification tool fails
`buck run mode/opt scm/mononoke:bonsai-verify -- --repo-id 1001 867ca5df5dd87de7a98ffd4495bc97ea57a8af61 --debug --limit 1 --changes`

After debuggin this run with a lot of printfs it turned out we only keeping last entry, `manifest_lookup` was to blame

Reviewed By: farnz

Differential Revision: D8875499

fbshipit-source-id: 0df4c766d55657c8c4cd7005facce715b31e733e
2018-07-17 09:22:44 -07:00
Lukas Piatkowski
24dc56c8a3 manifoldblob: remove usages of tokio_core
Summary: tokio::runtime can handle multithreading, no need for all this bolierplate

Reviewed By: StanislavGlebik

Differential Revision: D8861170

fbshipit-source-id: 2c489068a55f8cba1854f8a748df1e6efe8b47b7
2018-07-17 04:54:58 -07:00
Pavel Aslanov
6a77477d4d added BonsaiHgMapping to BlobRepo
Summary: Makes `BonsaiHgMaping` accessible from `BlobRepo` object

Reviewed By: StanislavGlebik

Differential Revision: D8821709

fbshipit-source-id: 03070ac4f9f390b76740c5d493f5a86b14024158
2018-07-13 08:03:13 -07:00
Matthew Dippel
c6fd393842 Removed RepoGenCache from the public API of revset
Summary:
Removed all references to RepoGenCache from publically callable functions in the revset package. This involved:
- Modifying blobrepo so that its get_generation_number method returned a Generation wrapper instead of a raw usize, to allow it to be used in a cleaner manner in the revset code.
- Simultaneously changing the constructors of all the structures in revset. This seems like a big change, but many of them call each other, passing a RepoGenCache object down the line, so eliminating them all at once made for the cleanest update.
- Modifying helper functions in the revset structures which would create streams of nodes by taking ownership of a RepoGenCache object within a closure. Instead they now take ownership of a clone of the repo. This strategy was already done earlier in the same helper functions, so I am assuming the cost of cloning a repo into a closure is small.
- Modifying the only external usage of revset within the mononoke server code.

This is part of a several step process to completely remove RepoGenCache from the code base. The next steps should be:
- Remove all references to RepoGenCache in the testing macros for revset.
- Delete RepoGenCache and clean up any dangling references to it.

Reviewed By: StanislavGlebik

Differential Revision: D8743560

fbshipit-source-id: 125f851075d836d40224d339e1daee912a39f7e4
2018-07-12 09:24:32 -07:00
Simon Farnsworth
d40a725f7b Refactor MemcacheBlobstore to split into common and memcache parts
Summary:
When we add cachelib bindings to Rust, we're going to want to implement a
cachelib blobstore that's more or less the same as the memcache version, but
backed by a cachelib pool instead of a memcache instance.

Split this code up so that we don't duplicate functionality

Reviewed By: StanislavGlebik

Differential Revision: D8523713

fbshipit-source-id: 882298abab8c208103f6d8c74fee60a768c877f6
2018-07-10 10:10:18 -07:00
Pulkit Goyal
fc880f518b Add Cargo.toml files to crates. (#7)
Summary:
This is a series of patches which adds Cargo.toml files to all the crates and tries to build them. There is individual patch for each crate which tells whether that crate build successfully right now using cargo or not, and if not, reason behind that.

Following are the reasons why the crates don't build:

  * failure_ext and netstring crates which are internal
  * error related to tokio_io, there might be an patched version of tokio_io internally
  * actix-web depends on httparse which uses nightly features

All the build is done using rustc version `rustc 1.27.0-dev`.
Pull Request resolved: https://github.com/facebookexperimental/mononoke/pull/7

Differential Revision: D8778746

Pulled By: jsgf

fbshipit-source-id: 927a7a20b1d5c9643869b26c0eab09e90048443e
2018-07-09 19:52:27 -07:00
Tim Fox
5adf5c109b Implement per file hooks
Summary:
This diff implements hooks which act upon individual files. The results of the hooks are cached using Asyncmemo.

The cache is currently keyed on (changeset_id, hook_name, file path) but this will change to file content hash once we move to Bonsai changesets.

Reviewed By: StanislavGlebik

Differential Revision: D8707726

fbshipit-source-id: ceaf94abd09e1dd7f6b2d8f9c87a9a221439a252
2018-07-04 07:07:02 -07:00
Pavel Aslanov
b5670e3bdc correctly handle conflicts in memory manifest
Summary:
Correctly resolve file/directory conflict in `MemoryManifest`
 - when we have file/directory conflict and have entry in `BonsaiChangeset` that indicates that file should be deleted we need resolve conflict by keeping directory
 - more details in [Bonsai changeset actions](https://fb.quip.com/A2kqArd9Nb90#WHBACA4Vitd)

Reviewed By: lukaspiatkowski

Differential Revision: D8658958

fbshipit-source-id: 815a91b847c5c0c9586eb5d317ebb9412196d5f4
2018-07-02 05:21:36 -07:00
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
Rain ⁣
355e1a3216 admin: allow decoding Thrift-serialized structures
Summary: This will be pretty useful while debugging.

Reviewed By: jsgf

Differential Revision: D8667770

fbshipit-source-id: 1c776741844d74529415124ab826b013414678c7
2018-06-28 11:46:06 -07:00
Lukas Piatkowski
2731dca698 scuba_ext: separate static tag from dynamic message in scuba logs
Summary:
It's easier to use scuba when you separate the part of log that identifies the log from the part that can have arbitrary data in it.
It's also easier to search for code after a sample was found

Reviewed By: jsgf

Differential Revision: D8625612

fbshipit-source-id: 7d7e382530dd5d7e5d69c6d34caccda4b6d2921b
2018-06-26 02:51:40 -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
Pavel Aslanov
6b1b5eb36f Bonsai::ChangeFile saving unittest
Summary: `Bonsai::ChangeFile` saving unittest

Reviewed By: farnz

Differential Revision: D8420777

fbshipit-source-id: 732da663583b160e1a4512cb287eef720d435340
2018-06-22 05:21:14 -07:00
Pavel Aslanov
cd3a0df197 merge same data different parents
Summary: This code handles "trivial merge"  (when file blob contains same data but different parents) of `MemoryManifest`

Reviewed By: farnz

Differential Revision: D8420775

fbshipit-source-id: dd0c640b8cc822d2dc42eed8f0e9a8e0a00f2cdc
2018-06-22 05:21:13 -07:00
Lukas Piatkowski
5a5688c2e7 blobrepo: add scuba logging for changeset creation
Summary: more logging more fun

Reviewed By: StanislavGlebik

Differential Revision: D8577655

fbshipit-source-id: 92a160ea8f8c0b8e012a1461fbd3f5d71b4bd171
2018-06-21 15:51:59 -07:00
Rain ⁣
93c181c35d mercurial-types: simplify Manifest API significantly
Summary:
Manifests are always able to return entries immediately, and never
fail.

Reviewed By: lukaspiatkowski, farnz

Differential Revision: D8556499

fbshipit-source-id: e21a2522f1219e47db9b55b24b6ac6c0c463933e
2018-06-20 18:22:55 -07:00
Stanislau Hlebik
1da09b3735 changesets: use connection to master only as fallback and for writes
Summary: Going to master adds a latency. Let's go to master only if we haven't found anything in the replica

Reviewed By: lukaspiatkowski

Differential Revision: D8548598

fbshipit-source-id: b0632ccf7f148d20e66763981c8ef4e615fd7f6c
2018-06-20 17:37:22 -07:00
Lukas Piatkowski
93cee8f271 filenodes: use connection to master only as fallback and for writes
Summary: we want most of the read traffic to be handled by replicas

Reviewed By: lukaspiatkowski

Differential Revision: D8548027

fbshipit-source-id: 297b070b5b33ec114026ecf3f1079fdb26f54b19
2018-06-20 17:37:22 -07:00
Rain ⁣
972822e218 blobrepo: simplify code for converting bonsai FileChange to hg
Summary:
Fetching the blob is still required to compute the node hash, but we don't have
to reupload it.

Reviewed By: farnz

Differential Revision: D8508462

fbshipit-source-id: 341a1a2f82d8f8b939ebf3990b3467ed7ad9244c
2018-06-20 13:24:57 -07:00
Rain ⁣
4eca2ec2d9 upload file blobs as Thrift data structures
Summary:
This will also allow file blob sharing between the Mercurial and Mononoke
data models.

Reviewed By: farnz

Differential Revision: D8440330

fbshipit-source-id: a29cd07dcecf0959dffb74b7428f3cb11fbd3db6
2018-06-20 13:24:56 -07:00
Rain ⁣
8b05fd5c16 blobrepo: use thrift blobs for manifests
Summary:
Store manifests as Thrift blobs instead. Required fixing up a lot of
different places, but they should all be pretty clear now.

Reviewed By: farnz

Differential Revision: D8416238

fbshipit-source-id: 523e3054e467e54d180df5ba78445c9b1ccc3b5c
2018-06-20 13:24:56 -07:00
Rain ⁣
dd3a8b59df blobrepo: improve function to get raw content
Summary:
Since file and manifest nodes are going to be stored differently, rename this to
get_hg_raw_content to make it clear that it'll work for both files and
manifests.

I tried allowing a `Chain` to be used, but ran into https://github.com/carllerche/bytes/issues/213. Boo.

Reviewed By: farnz

Differential Revision: D8413001

fbshipit-source-id: 2f06affa265beaed2ac0a48ee4fec8ce922307da
2018-06-20 13:24:56 -07:00
Rain ⁣
9ede6636a7 BREAKING CHANGE: switch to Thrift encoding for changesets
Summary:
Pretty straightforward. Also using this opportunity to add per-repo
prefixes, since all the hashes are going to break anyway.

Note for reviewers: almost all the change is regenerated test fixtures (unfortunately necessary to make atomic). The actual substantive changes are all in the first few files.

Reviewed By: farnz

Differential Revision: D8392234

fbshipit-source-id: c93fc8c6388cb00fe5cff95646ad8c853581cb8c
2018-06-20 13:24:56 -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
Simon Farnsworth
43c9f2f29a Use different memcache keys for each backing blobstore
Summary:
It would be suboptimal if memcache could be abused to examine objects
you should not have access to. Change the key used so that (a) it's a regional
cluster for wider caching, and (b) it's got the blobstore details in it so that
you cannot extract objects not from your blob store.

Reviewed By: StanislavGlebik

Differential Revision: D8424298

fbshipit-source-id: 78f9a1a7302b4a60575f257bda665f719dc1a7b6
2018-06-15 14:03:44 -07:00
Pavel Aslanov
25f253d3b4 save the file FileChange as a Mercurial format HgBlobEntry
Summary: Added logic to save `FileChange` as a Mercurial format `HgBlobEntry`

Reviewed By: sunshowers

Differential Revision: D8187792

fbshipit-source-id: 4714c81ab23ebac528cfec15c4a9e66083d4fb6c
2018-06-15 12:33:23 -07:00
Lukas Piatkowski
86e5dcae14 blobrepo: add counters for various operations done in blobrepo
Reviewed By: farnz

Differential Revision: D8449057

fbshipit-source-id: 03a2293080c49969ab4c1ae258f832c01b264239
2018-06-15 10:10:41 -07:00
Jeremy Fitzhardinge
66db975869 tp2: update to rust 1.26.2
Summary:
Update to Rust 1.26.2 toolchain, which has a fix for a soundness
problem in match ergonomics. There was one instance of code affected by this.

Reviewed By: farnz

Differential Revision: D8401773

fbshipit-source-id: 9dfdd933b1e0cf92cdc179a84ea1b67064585ba1
2018-06-13 13:45:31 -07:00
Rain ⁣
46a2603ba1 blobrepo: add the ability to prefix all blobstore gets and puts
Summary:
Note that no prefix is actually prepended at the moment -- there's an
XXX marking the spots we'll need to update. We'll probably add a prefix once Thrift serialization is turned on.

Reviewed By: farnz

Differential Revision: D8387761

fbshipit-source-id: 0fe2005692183fa91f9787b4c80f600df21d1d93
2018-06-13 13:13:07 -07:00
Pavel Aslanov
df655aad8c generic store|fetch for mononoke types
Summary:
Implementation of generic `store|fetch` for bonsai types.
 - bonsai types have unique typed hashes associated with each bonsai type, I'm leveraging this fact to implement generic `store|fetch` methods on `BlobRepo`

Reviewed By: farnz

Differential Revision: D8254810

fbshipit-source-id: 5f798fade4cb8d1ac851f94c7ad7e64636bbca65
2018-06-13 02:35:32 -07:00
Rain ⁣
e3ff3de80c blobstore: move memblob into main blobstore
Summary: It's really straightforward and useful for internal blobstore testing.

Reviewed By: farnz

Differential Revision: D8374496

fbshipit-source-id: 8501e31218ecb5d80530a114e0be5e5d0e8f6c91
2018-06-12 15:40:10 -07:00
Rain ⁣
ed033f2b25 store and return p1 and p2 separately for changesets
Summary:
Unfortunately `HgParents` can't represent all valid parents, because
it can't represent the semantically important case where `p1` is `None` and
`p2` is not. (For incoming changesets we'd like to keep full fidelity with
Mercurial.)

All the Thrift definitions store `p1` and `p2` separately anyway, so just make
that change throughout `RevlogChangeset` and `BlobChangeset`.

Reviewed By: StanislavGlebik

Differential Revision: D8374125

fbshipit-source-id: 63674daaad05d4d4cae3778744dbf1c14b3c2e3b
2018-06-12 15:40:10 -07:00
Rain ⁣
3665c48fc7 remove the old blobimport tool
Summary:
The old blobimport tool will not be able to import commits with the new Thrift serialization they'll be switching to.

`blobrepo::utils::RawNodeBlob` is also used by the admin tool, and it will go away once we start using Thrift serialization.

Reviewed By: farnz

Differential Revision: D8372455

fbshipit-source-id: d02a37e33e1ccd4dd1f695e38dbb40851dd51cd6
2018-06-12 15:40:10 -07:00
Rain ⁣
72ba438c95 switch fixture generation to new_blobimport
Summary:
Mostly this was about adding support for file stores to
`new_blobimport`.

Reviewed By: StanislavGlebik

Differential Revision: D8372063

fbshipit-source-id: 2e3791c6222ec430015008f038e1df0464d3f0ba
2018-06-12 15:40:10 -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
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
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
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
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