Commit Graph

1361 Commits

Author SHA1 Message Date
Stanislau Hlebik
706e98799b mononoke: support many blobstores in metaconfig
Summary: Restructure the configs so that we can specify more than one blobstore

Reviewed By: lukaspiatkowski

Differential Revision: D13234286

fbshipit-source-id: a98ede17921ed6148add570288ac23636b086398
2018-12-05 05:58:07 -08:00
Stanislau Hlebik
a51cb1dacf mononoke: rename TestBlobManifold to BlobRemote
Reviewed By: aslpavel

Differential Revision: D13319437

fbshipit-source-id: 7f5eccde3698b2c4fdcf9f0cb5843a2965ab11a3
2018-12-05 05:58:07 -08:00
Kostia Balytskyi
cced1d0478 mononoke: change unionnodestream to use ChangesetId
Summary:
Refactored UnionNodeStream to use changesetid
Modified all other classes using it
Modified tests.

Depends on: D13275956

Reviewed By: StanislavGlebik

Differential Revision: D13326684

fbshipit-source-id: fd34f52739cf3e2876aa7a30c5060b3b3410f413
2018-12-05 04:57:58 -08:00
Filip Hrenić
49579b36d0 Change IntersectNodeStream to use ChangesetId
Summary:
Refactored intersect nodestream to use changesetid
Modified all other classes using it
Modified tests (some still need to be modified, see `TODO Hrenic`)

Reviewed By: StanislavGlebik

Differential Revision: D13275956

fbshipit-source-id: 90d3c191e161be8a9ce1841de0e04ce60438764b
2018-12-04 13:32:05 -08:00
Lukas Piatkowski
5d9a151d85 mononoke: pass CoreContext down to blobstore
Reviewed By: jsgf

Differential Revision: D13324220

fbshipit-source-id: af7a2a650338ea66e504ea0acae1d103af10f8e3
2018-12-04 11:40:15 -08:00
Johan Schuijt-Li
ba5db40d9a Do not drop connection on TLS resumption when using client certificates
Summary: Set the proper context for sessions.

Reviewed By: liubov-dmitrieva

Differential Revision: D13258641

fbshipit-source-id: edd18d4abc8f5475e0d2ac8395dfc877b2dd5958
2018-12-04 08:30:07 -08:00
Stanislau Hlebik
d02dfe3cd9 mononoke: use RepoConfig for all cmd libraries
Summary:
Previously we manually specified blobstore type and all the necessary
parameters. That was error-prone but worked because we had only one blobstore.
Since we are going to add secondary blobstores soon configuring binaries like
blobimport will be harder because we'll need to specify parameters for all
blobstores. Let's make it so that
blobimport, mononoke admin and other binaries read the configuration the same
way as Mononoke does it i.e. via toml files.

Reviewed By: lukaspiatkowski

Differential Revision: D13183244

fbshipit-source-id: 99caa6348133acec11dd04ae44e1f9f0a8ebb197
2018-12-04 03:52:26 -08:00
Stanislau Hlebik
04fb5f514b mononoke: reverse dependencies between BlobRepo and metaconfig
Summary:
Previously metaconfig depended on BlobRepo, and so ManifoldArgs had to be
definided in BlobRepo. That was an weird dependency, but a necessary one
because of Mononoke config repo. In the previous diffs we got rid of the
Mononoke config repo, so now we can reverse the dependencies.

Reviewed By: lukaspiatkowski

Differential Revision: D13180160

fbshipit-source-id: efe713ce3b160c98d56fc13559c57a920146841f
2018-12-04 03:52:26 -08:00
Stanislau Hlebik
f07155b402 mononoke: remove mononoke configs, use toml files
Summary:
Config repo proved to be tricky to understand and hard to use. Let's just use
toml files.

Reviewed By: farnz

Differential Revision: D13179926

fbshipit-source-id: 3a44ee08c37284cc4c189c74b5c369ce82651cc6
2018-12-04 03:52:26 -08:00
Lukas Piatkowski
d8476a6527 mononoke: pass CoreContext down to filenodes
Reviewed By: StanislavGlebik

Differential Revision: D13304158

fbshipit-source-id: d73597ed64822d7a986f6a8d46a96cfbbe99a8e7
2018-12-04 01:16:32 -08:00
Lukas Piatkowski
02e79837a4 mononoke: pass CoreContext down to bookmarks
Reviewed By: StanislavGlebik

Differential Revision: D13302943

fbshipit-source-id: 356ec3cd3c47f843a5869edb7079d4cbd0ee33aa
2018-12-04 01:16:32 -08:00
Arun Kulshreshtha
5f10031e48 Add integration test for mononokeapi
Summary:
Add an integration test that talks to the API server from remotefilelog.

Since this involves running a local instance of Mononoke and the API server, I've added it to Mononoke's integration tests rather than Mercurial's integration tests in order to re-use the setup code from Mononoke's tests. Since the server is running locally, and would use a different SSL setup that the VIP that hg would normally access it through, the local API server is run without SSL enabled.

Reviewed By: Anastasiya-Zhyrkevich, farnz

Differential Revision: D13089196

fbshipit-source-id: 01f415d8ee7173f7f2ab3a234565fd79d618126e
2018-12-03 17:50:16 -08:00
Stanislau Hlebik
bd7246dcf7 mononoke: use common traits from NodeFrontier
Summary: Address aslpavel's comments from D13275471

Reviewed By: aslpavel

Differential Revision: D13301218

fbshipit-source-id: 5e51dd3b19a6cd41ae9b4071ec3edb2f0c81999c
2018-12-03 05:09:02 -08:00
Stanislau Hlebik
a9d81657d0 mononoke: fix test
Summary: test-init.t and test-lfs-to-mononoke.t were failing. This diff fixes them

Differential Revision: D13301143

fbshipit-source-id: 1f8060d4c6b641c555ba8a5cdcfe4cb14ac89d0a
2018-12-03 02:17:29 -08:00
Jeremy Fitzhardinge
ec86d453ae rust/stats: don't require users to import lazy_static
Summary:
Now that Rust macros can be `use`d like normal symbols, `stats` can
simply import the `lazy_static!` macro without requiring its users to do it.

Reviewed By: Imxset21

Differential Revision: D13281897

fbshipit-source-id: a6780fbace07dd784308e642d4a384322a17c367
2018-12-02 14:34:39 -08:00
Lukas Piatkowski
14636545aa mononoke: pass CoreContext down to changesets
Reviewed By: StanislavGlebik

Differential Revision: D13277448

fbshipit-source-id: 6e9a8dac77af8ab991005d14f654e315c234fe44
2018-11-30 10:14:22 -08:00
Lukas Piatkowski
08db0a35eb mononoke: pass CoreContext down to bonsai-hg-mapping
Reviewed By: aslpavel

Differential Revision: D13277450

fbshipit-source-id: 97cfbd917b321727bb4d960c91a784787660eb5b
2018-11-30 10:14:22 -08:00
Harvey Hunt
8ca5b452a2 mononoke: Log more context for known() wireproto command
Summary:
We currently log information for wireproto commands, such as duration
and occasionally the args.

As a first step to increasing the amount of information we log, record the
number of known and unknown nodes for the known() wireproto command to the new
scuba column "extra_context".

Reviewed By: StanislavGlebik

Differential Revision: D13254857

fbshipit-source-id: 891d127c0a8efe741a6e7bfa35d3a56b9d79bf5c
2018-11-30 05:21:58 -08:00
Stanislau Hlebik
c6f21b1cc8 mononoke: efficient search of max generation in NodeFrontier
Summary:
Previously `max_gen()` function did a linear scan through all the keys, and it
was linear. Let's use `UniqueHeap` datastructure to track maximum generation
number.

Reviewed By: lukaspiatkowski

Differential Revision: D13275471

fbshipit-source-id: 21b026c54d4bc08b26a96102d2b77c58a981930f
2018-11-30 04:34:02 -08:00
Stanislau Hlebik
3ae6daeb0c mononoke: use skiplist in getbundle
Reviewed By: jsgf, lukaspiatkowski

Differential Revision: D13169016

fbshipit-source-id: 59c567663680a99dd977e087f38374e77c72afd6
2018-11-29 08:19:30 -08:00
Stanislau Hlebik
52f12e92ac mononoke: remove recursion from SkiplistIndex lca_hint
Summary:
Recursion can easily become too deep and overflow the stack. Let's use
`loop_fn` instead

Reviewed By: lukaspiatkowski

Differential Revision: D13169015

fbshipit-source-id: bf5cf151e83fd4bd785ff4b81a93858e7e2dcfde
2018-11-29 08:19:30 -08:00
Stanislau Hlebik
af03216ee2 mononoke: admin command to build and read skiplist indexes
Summary:
Let's add a command that builds and reads a skiplist indexes. This indexes will
be used by getbundle wireproto request to decrease the latency and cpu usage.

Note that we are saving only the longest "jump" from the skiplist. This is done
in order to save space.

Reviewed By: jsgf

Differential Revision: D13169018

fbshipit-source-id: 4d654284b0c0d8a579444816781419ba6ad86baa
2018-11-29 08:19:30 -08:00
Stanislau Hlebik
a48e88dc28 mononoke: remove lazy skiplist building
Summary:
Previously if a commit didn't have a skiplist index then it'd be built lazily.
So if a getbundle requests a very old commit then skiplist index entries for
too many commits might be built and stored in memory.

Instead of lazily building the index let's add a constructor that accepts a
skiplist graph. That'd allow us to skiplist graph persistently and create it on
demand

Reviewed By: jsgf

Differential Revision: D13169019

fbshipit-source-id: 813bdd7e6cc90312d97275a7db5e266d97b545e0
2018-11-29 08:19:30 -08:00
Stanislau Hlebik
e704bd24fe mononoke: use NodeFrontier in getbundle
Summary:
NodeFrontier is a hashset that stores commits and their generation numbers.
We'll use it to figure out what nodes client already has (`exclude` nodes).
Before this change we used `GroupedByGenenerationStream`, but it doesn't allow
us to skip some commits. We can skip commits with NodeFrontier though.

Reviewed By: lukaspiatkowski

Differential Revision: D13122521

fbshipit-source-id: 08eddb71e49b16b879f65bc9b8b177dc5dbcc034
2018-11-29 08:19:30 -08:00
Stanislau Hlebik
0f5153e1df mononoke: skiplist thrift serialization
Summary:
We'd like to save skiplist data in blobstore so that we won't have to recompute
it. Let's use thrift serialization for it

Reviewed By: lukaspiatkowski

Differential Revision: D13122386

fbshipit-source-id: f44cdcf38fa6a219df9217906a872e60c319e391
2018-11-29 08:19:30 -08:00
Stanislau Hlebik
402f03056d mononoke: use ChangesetFetcher in skiplist code
Summary:
Let's make it use the same ChangesetFethcer as getbundle already does. It will
be used in the next diffs

Reviewed By: lukaspiatkowski

Differential Revision: D13122344

fbshipit-source-id: 37eba612935a209098a245f4be0af3bc18c5787e
2018-11-29 08:19:29 -08:00
Stanislau Hlebik
631556ed0d mononoke: migrate skiplist to bonsai changesets
Summary:
Most of our revsets are already migrated, let's migrate skiplists as well since
we want to use them in getbundle requests.

Reviewed By: lukaspiatkowski

Differential Revision: D13083910

fbshipit-source-id: 4c3bc40ccff95c3231c76b9e920af5db31b80d01
2018-11-29 08:19:29 -08:00
Stanislau Hlebik
cfb3dd2e15 mononoke: batching of bonsai-hg mapping request
Summary:
We've recently found that `known()` wireproto request gets much slower when we
send more traffic to Mononoke jobs. Other wireproto methods looked fine, cpu
and memory usage was fine as well.

Background: `known()` request takes a list of hg commit hashes and returns
which of them Mononoke knows about.

One thing that we've noticed is that `known()` handler sends db requests sequentially.
Experiments with sending `known()` requests with commit hashes that Mononoke
didn't know about confirmed that it's latency got higher the more parallel
requests we sent. We suspect this is because Mononoke has to send a requests to
db master, and we limit the number of master connections.

A thing that should help is batching the requests i.e. do not send many
requests asking if a single hg commit exists, but sending the same request for
many commits at once.

That change also required doing changes to the bonsai-mapping caching layer to
do batch cache requests.

Reviewed By: lukaspiatkowski

Differential Revision: D13194775

fbshipit-source-id: 47c035959c7ee12ab92e89e8e85b723cb72738ae
2018-11-27 09:40:52 -08:00
Stanislau Hlebik
0ba690721c mononoke: add logging
Reviewed By: farnz

Differential Revision: D13194752

fbshipit-source-id: e41cb97071c73e7415fc0d139fd69ba8141221d5
2018-11-26 05:24:27 -08:00
Stanislau Hlebik
0780682c9c mononoke: fix tests
Summary: SSLLockTypes disappeared again.

Reviewed By: HarveyHunt

Differential Revision: D13176693

fbshipit-source-id: 30acd08cc07726e891f83b25837ddfbb4e4b9c86
2018-11-23 02:20:41 -08:00
Stanislau Hlebik
9bc593e6fa mononoke: remove unused RepoType
Summary: We can't really serve Mononoke from a revlog repo. Let's remove it

Reviewed By: HarveyHunt

Differential Revision: D13175450

fbshipit-source-id: 41ad328564bb0965bb93bf214bd89a1d456b397d
2018-11-23 01:23:09 -08:00
Stanislau Hlebik
e6b9f3e0f7 mononoke: read bookmarks from local replica
Summary:
Currently we read all bookmarks from primary replica a few times during `hg
pull`. First time when we do listkeys, second time when we get heads.
That might create a high load on primary replica.

However the delay between primary and secondary replicas is fairly small, and so it
*should* be fine to read bookmarks from secondary local replica as long as there is only
one replica per region (because if we have a few replicas per region, then
heads and listkeys response might be inconsistent).

Reviewed By: lukaspiatkowski

Differential Revision: D13039779

fbshipit-source-id: e1b8050f63a3a05dc6cf837e17a448c3b346b723
2018-11-23 01:19:04 -08:00
Anastasiya Zhyrkevich
bb31c81995 RevIdx flags ExtStored parsing
Summary:
Mononoke blobimports filenodes from Mercurial Host Machines to its blobstore.
It parses revlogs to retrieve flags used for parsing.
Revlogs Contains the flags for Marking Ext Stored FIles. This flag means that the file is not stored at the  Mercurial Host machine, but somewhere remotely.
This diff provides the api to get the extstored flag from revlog.

Reviewed By: farnz

Differential Revision: D13081950

fbshipit-source-id: ba5bc04ad3659d4880960995d1cc46594d89e220
2018-11-22 10:33:58 -08:00
Anastasiya Zhyrkevich
d713993c60 mononoke: [lfs] upload blake2 ->sha256 mapping on fetch
Summary:
According to [Git-LFS Plan](https://www.mercurial-scm.org/wiki/LfsPlan), `getfiles` instead of file content should return file in the [following format](https://www.mercurial-scm.org/wiki/LfsPlan#Metadata_format)
```
oid: sha256.SHA256HASH
size: size_int
```

Hg client requests files using sha1 hgfilenode hash. To calculate sha256 of the content, Mononoke is fetching the file from blobstore to memory, and calculate sha256.
It does not give any profit in time and memory consumptions, comparing to non-LFS transfer of Mononoke.

*Solution:*
To put a `key-value` to blobstore, after first request of the file. This means, that after hg client requested sha256 of the file for the first time, after calculation, put it to the blobstore.
Next request of the sha256 of the file content avoid recalcualtion of sha256 in Mononoke. It return sha256 saved in the blob.

Reviewed By: StanislavGlebik

Differential Revision: D13021826

fbshipit-source-id: 692e01e212e7d716bd822fa968e87abed5103aa7
2018-11-22 10:27:46 -08:00
Harvey Hunt
368b2119bc Add regex_match to hook functions
Summary:
Add a helper function for hooks that can be used to match a string to a regex.

Regex matching can either be called from ctx.regex_match(s, r) or file.path_regex_match(r)

This will later be used in the no_bad_filenames hook, but will be helpful for other
hooks too.

Reviewed By: purplefox

Differential Revision: D12941544

fbshipit-source-id: f8f73a767da5ae77f486c925b6adc1333a198c3f
2018-11-22 09:28:19 -08:00
Tim Fox
d64d9121c5 Allow hook manager cache params to be configured
Summary: ${title}

Reviewed By: StanislavGlebik

Differential Revision: D13082486

fbshipit-source-id: fbdffdbfca218199dc2ac61abfcb8887b299db6d
2018-11-22 03:30:17 -08:00
Jeremy Fitzhardinge
36712348b6 tp2/rust: update rust-crates-io
Summary: Include arc-swap, and rand updates

Reviewed By: farnz

Differential Revision: D13141834

fbshipit-source-id: 6e49d841bf1ca39463743081e2cb5ea5e770daf0
2018-11-21 08:55:04 -08:00
Anastasiya Zhyrkevich
97c0bbb3ad optimization of getting file of a certain revision
Summary:
The file of some revision is the initial file content with applied deltas
Delta is a vector of Fragments.
Fragment is a sequential change of the file (old part of the content -> new content)

This diff is representing the implementation of optimization of the process of getting a file content of some revision.

Reviewed By: lukaspiatkowski

Differential Revision: D12928138

fbshipit-source-id: fcc28e2d0e0acf83e17887092f6593e155431c1b
2018-11-20 05:17:27 -08:00
Anastasiya Zhyrkevich
322945ad81 get rid of hardcoded blobstore_key prefixes
Summary:
Mononoke requires several references to the same blob in the blobstore.
Sha256 aliases are good example. [post](https://fb.facebook.com/groups/scm.mononoke/permalink/739273266435251/)

Short description of alias mechanism:
- we have `key: value` blob in blobstore.
- put a `key1: key` blob in blobstore to have 2-step access from `key1` to `value`.

All the keys in Mononoke are of the form `type_prefix.hash_name.hash`

I expanded MononokeId interface to have an access to the prefix `type_prefix.hash_name` for verification `key` content (see alias mechanism description).

Reviewed By: farnz

Differential Revision: D13084145

fbshipit-source-id: 5b8a4e80869481414a7356ccd7c9aab6e24a5138
2018-11-20 01:43:06 -08:00
Jeremy Fitzhardinge
5eede4ee98 mononoke: test for glusterblob
Summary: Add Glusterblob test to blobstore-test.

Reviewed By: lukaspiatkowski

Differential Revision: D13049137

fbshipit-source-id: c60af05e6bc1de8f1372e226c823cedebaf3b282
2018-11-15 13:08:03 -08:00
Jeremy Fitzhardinge
48ca128c88 mononoke/blobtest: make blobstore tests properly async
Summary:
Prepare for gluster blobstore by making the test framework properly
async. It needs a full tokio environment (IO reactor, etc) for async operation, rather than
just `Future::wait`.

Reviewed By: StanislavGlebik

Differential Revision: D13055656

fbshipit-source-id: 6263ff706b3a374f0868f05989b6880f3c5a16ed
2018-11-15 13:08:03 -08:00
Jeremy Fitzhardinge
fb8f81b579 mononoke/glusterblob: add smc support
Summary: Add `with_smc` to allow making a connection using an SMC tier name.

Reviewed By: kulshrax

Differential Revision: D12989046

fbshipit-source-id: bdf9ef4729ac8f90a6a0ac16fb3ce9669d0bcf52
2018-11-15 13:08:03 -08:00
Jeremy Fitzhardinge
cc50c65446 mononoke: gluster blobstore implementation
Summary:
This implements the Blobstore trait using an underlying Gluster volume (or
really any NFS server, but some aspects are tailored to Gluster).

Reviewed By: lukaspiatkowski

Differential Revision: D12989045

fbshipit-source-id: 76b4fe87ed1f392342c31be12115eee972221ca0
2018-11-15 13:08:03 -08:00
Stanislau Hlebik
73f0c8e282 mononoke: fix integration tests
Summary:
Update test certificates, because they expired. Set next expiration date in 10
years.

```
stash@devvm3292
/data/users/stash/fbsource/fbcode/scm/mononoke/tests/integration
(eab3173|remote/master) $ openssl req -x509 -nodes -days 3650 -newkey rsa:2
048 -keyout testcert.key -out testcert.crt
Generating a 2048 bit RSA private key
.............+++
.....................................................................................................................+++
writing new private key to 'testcert.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:uk
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:localhost
Email Address []:
```

Also update the warning in some tests

Reviewed By: farnz

Differential Revision: D13082351

fbshipit-source-id: 8636e711e82113e692ecd146154cbe4796b33a59
2018-11-15 05:13:24 -08:00
Tim Fox
c25675a220 ensure_valid_email hook
Summary: Implement $name

Reviewed By: StanislavGlebik

Differential Revision: D13024134

fbshipit-source-id: e5693c262d9c28fb8c54ce0961dc8254e58fe01f
2018-11-13 09:37:23 -08:00
Tim Fox
b7a8069530 verify_integrity hook
Summary: Port verify_integrity hook to Mononoke

Reviewed By: StanislavGlebik

Differential Revision: D12839290

fbshipit-source-id: a04cdb96e534ba61d359008bef3f327b1758f8ee
2018-11-13 09:37:23 -08:00
Stanislau Hlebik
ad122a6f02 mononoke: fix tests
Summary:
New debug line started to show up. Hard to track where it comes from, but let's
add it to the test.

Reviewed By: farnz

Differential Revision: D13042463

fbshipit-source-id: 0901920d127099b4f27c242df4f6c3814d701a08
2018-11-13 08:14:39 -08:00
Tim Fox
dafbef1dc3 Integrate Aclchecker with hooks
Summary:
Integrate AclChecker into hooks.

Note, TODO: Create a new hipster group "reviewers"

Reviewed By: StanislavGlebik

Differential Revision: D10507735

fbshipit-source-id: 62c02bdd2e79b8b77ea118ed97bec4a8f48f01db
2018-11-13 05:41:49 -08:00
Stanislau Hlebik
aae4562523 mononoke: revert D12945071
Summary: It causes test failures. REvert for now until they fixed

Reviewed By: farnz

Differential Revision: D13040073

fbshipit-source-id: fc05373c882baf42f7bd2a3a1c1173e8ba26a952
2018-11-13 05:02:29 -08:00
Stanislau Hlebik
31a8a44ffb mononoke: more efficient bookmark fetch
Summary:
Previously sql query that was sent to the server had `name like CONCAT('', %)`
for empty prefixes. That's inefficient, and since empty prefix requests are
common it's worth fixing them.

Reviewed By: lukaspiatkowski

Differential Revision: D13021876

fbshipit-source-id: 2fd9b2361e9be57cb15251e37f7988ee048468ec
2018-11-13 01:02:59 -08:00