Commit Graph

57 Commits

Author SHA1 Message Date
Stanislau Hlebik
0403dba05c mononoke: remove unused options
Reviewed By: lukaspiatkowski

Differential Revision: D9627883

fbshipit-source-id: b235cb272f93178c942ebf662d77ca73c3790a40
2018-09-03 04:06:14 -07:00
Pavel Aslanov
57d5ddcaf8 added pushrebase configuration options
Summary:
- added `PushrebaseParams` to `RepoConfig`
- configurable recursion_depth and rewritedates

Reviewed By: StanislavGlebik

Differential Revision: D9578661

fbshipit-source-id: df26be4f0f54a54ab6a82fc89d6733099469ce98
2018-08-31 08:55:19 -07:00
Rain ⁣
2203a158e1 cmdlib: switch from BlobRepo to MononokeRepo
Summary: This is more general, and allows one to call `RepoClient` methods.

Reviewed By: farnz

Differential Revision: D9318658

fbshipit-source-id: 09b2e64bc0d423eafcb381902e03f349fc666a41
2018-08-15 23:36:19 -07:00
Simon Farnsworth
3733848cef Use Abomonation and cachelib to replace Asyncmemo
Summary:
Asyncmemo has two issues for our use:

1. Separate memory pool from cachelib caches.
2. Future fusion means that a `get` that should succeed will fail because there
was an earlier get still in progress.

The second is good for memoization, where the worst case from a failed get is
extra CPU work, but not so good for caching. Replace uses of Asyncmemo for
caches with a cachelib based cache

Reviewed By: StanislavGlebik

Differential Revision: D9013679

fbshipit-source-id: b85d4eec7294e0c8ee08faa671d26901b35cf1fc
2018-08-07 13:37:09 -07:00
Simon Farnsworth
cc1454d333 Restore cachelib blob caching
Summary: Reverts D8989404 so that we're using cachelib again.

Reviewed By: jsgf

Differential Revision: D9036003

fbshipit-source-id: 9867a12b81369156ee2e6aa7a7f1c81a638185d6
2018-08-07 11:37:37 -07:00
Lukas Piatkowski
dec3e9a444 mononoke: backout cachelib integration for blob caching
Summary:
Back out "[mononoke] Switch to cachelib for blob caching"

Original commit changeset: 2549d85dfcba

Back out "[mononoke] Remove unused asyncmemo imports"

Original commit changeset: e34f8c34a3f6

Back out "mononoke: fix blobimport"

Original commit changeset: b540201b93f1

Reviewed By: StanislavGlebik

Differential Revision: D8989404

fbshipit-source-id: e4e7c629cb4dcf196aa56eb07a53a45f6008eb4e
2018-07-26 10:09:32 -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
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
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
7f55aad570 Use the Bookmark struct to represent bookmarks instead of string
Summary: This diff refactors the hook code to use the Bookmark struct instead of strings

Reviewed By: farnz

Differential Revision: D8724197

fbshipit-source-id: 920aa1266ca94b2bd8683a995e4fd781159bd5b1
2018-07-05 03:22:52 -07:00
Tim Fox
ccf594d858 Update repoconfig and hookloader to support per file hooks
Summary: This diff updates rep config to support per file hooks. We also extend the hookloader to support per file hooks.

Reviewed By: lukaspiatkowski

Differential Revision: D8713464

fbshipit-source-id: 65cf20957506adc620bf06d84707669d125366ed
2018-07-05 03:22:52 -07:00
Tim Fox
02ce67d40e Refactor repoconfig to support loading of hooks, and directory per repo
Summary:
This diff refactors the server config repository to support storing and loading of hooks. In the new structure each repo lives in its own directory and the config file for the server is called "server.toml".
Hooks can be referenced by relative or absolute paths allowing either local or common hooks to be loaded.

Reviewed By: StanislavGlebik

Differential Revision: D8625178

fbshipit-source-id: 62c8c515a0fbbf7a38cfc68317300d8f42eb4d7a
2018-07-04 07:07:02 -07:00
Jeremy Fitzhardinge
1a7ae3ed36 mononoke: add per-repo "enabled" flag
Summary:
Add a per-repo config flag to repos to be configed without being
enabled. Setting "enabled = false" will make Mononoke completely ignore the
repo config. If not present, "enabled" is assumed to be true.

Reviewed By: farnz

Differential Revision: D8647161

fbshipit-source-id: 2646d41a64917d3e50f662b0b4b628ccfdbb05a8
2018-06-29 20: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
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
66746d4de5 Add bookmarks and hooks to the server config
Summary: This diff adds new sections in the repo config for bookmarks and hooks

Reviewed By: StanislavGlebik

Differential Revision: D8506052

fbshipit-source-id: 71c2734b1aed90e92ed3d9a327d034f3083dacad
2018-06-20 16:07:18 -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
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
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
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
Stanislau Hlebik
88051823df mononoke: simple precaching
Summary:
Simple precaching. Reads all the manifests for a bookmark and up to
`commit_warmup_limit` of ancestors.

Warming up file content can be slow, so we don't do it now.

Reviewed By: jsgf

Differential Revision: D7863728

fbshipit-source-id: bed1508b01e4e002a399d00ea45faf8a8e228d0a
2018-05-10 02:02:34 -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
Simon Farnsworth
e3adaf7f50 Fix performance tests
Summary:
These have bitrotted, but I need a test case for a Scuba change. Fix
them.

Reviewed By: StanislavGlebik

Differential Revision: D7813907

fbshipit-source-id: e4e9b01a8a3c1de27f59c6d5ea695152df99d4ff
2018-04-30 10:44:04 -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
Stanislau Hlebik
23ce735b81 mononoke: add xdb tier to the config and use it for filenodes
Summary:
Pass mysql tier name to the BlobRepo, so that we can use it to connect to mysql
based storages like mysql changeset storage, filenodes storage etc.

Note that currently Filenodes storage only connects to master region. This will
be fixed in the later diffs

Reviewed By: lukaspiatkowski

Differential Revision: D7585191

fbshipit-source-id: 168082abfeb7ccba549c7a49e6269cc01c490c14
2018-04-18 04:09:09 -07:00
Siddharth Agarwal
cc57855b90 mercurial: use FileContents for file contents
Summary:
This is not only the newer, more specific type -- it also makes a couple
of upcoming diffs more straightforward.

Reviewed By: StanislavGlebik

Differential Revision: D7622906

fbshipit-source-id: 4e453b827512c538f4f9777ae4d24627f3b124cf
2018-04-17 11:37:29 -07:00
Lukas Piatkowski
f6c3f72745 CODEMOD: rename mercurial_types::HgChangesetId to DChangesetId
Summary: mercurial_types::DChangesetId should be replaced by types from mononoke_types in most cases and by mercurial::HgChangesetId in others. This rename should help with tracking this

Reviewed By: sid0

Differential Revision: D7618897

fbshipit-source-id: 78904f57376606be99b56662164e0c110e632c64
2018-04-16 03:40:24 -07:00
Siddharth Agarwal
667ab89301 mercurial-types-mocks: redo the way mock manifests are defined
Summary:
The current structure makes defining new manifests really verbose and
doesn't easily support nested manifests. Make it really simple: either accept a
path map or a description (a csv).

Also switch to a `BTreeMap` to allow lookups in the next diff.

This is unfortunately hard to separate out because all the bits are
interconnected.

Reviewed By: StanislavGlebik

Differential Revision: D7531115

fbshipit-source-id: ca0fa35d4e0ac6a4e23adb2a7d2b5679ce52b643
2018-04-06 13:16:55 -07:00
Siddharth Agarwal
7cb68c0c60 mercurial-types: make the Type enum use FileType
Summary:
Since `FileType` now exists, the `Type` enum can use it instead of
defining its own stuff.

Reviewed By: farnz

Differential Revision: D7526046

fbshipit-source-id: 3b8eb5502bee9bc410ced811dc019c1ce757633f
2018-04-06 13:16:55 -07:00
Stanislau Hlebik
7fd6e274ea mononoke: remove blob_files
Summary: We are not using it, so there is no point in keeping it around

Reviewed By: farnz

Differential Revision: D7400428

fbshipit-source-id: 481ef3ec8ef1f188e01add36e81da789f186548e
2018-03-28 04:22:46 -07:00
Simon Farnsworth
86ba6a7715 Run perf tests against a simulated blobstore
Summary: Make it possible to use a simulated remote backend as a blobstore. This allows me to look at the test results and be happy that Mononoke is at fault for any slowness.

Reviewed By: kulshrax

Differential Revision: D7353229

fbshipit-source-id: 57528af704b517a70570bb2b9b140caa9120a956
2018-03-26 05:11:00 -07:00
Lukas Piatkowski
d0e66cc5f7 mercurial: distinguish between NodeHash used in mercurial Revlogs and in Mononoke Blobstore
Summary:
This codemod tries not to change the existing behavior of system, only introduce new types specific to Mercurial Revlogs.
It introduces a lot of copypasta intentionally and it will be cleaned in following diffs.

Reviewed By: farnz

Differential Revision: D7367191

fbshipit-source-id: 0a915f427dff431065e903b5f6fbd3cba6bc22a7
2018-03-22 12:24:35 -07:00
Dino Wernli
9ecf7ec915 Add support for context-enabled futures.
Summary:
The diff adds an extension of futures to the `failures_ext` crate, allowing futures with error type `failure::Error` or `failure::Fail` to store a context.

As a proof-of-concept, the resulting `context()` function is applied to a future in use in mononoke.

Reviewed By: lukaspiatkowski

Differential Revision: D7289640

fbshipit-source-id: 06788d03c8cb5563ae1621c8354eef651f9f1531
2018-03-21 04:32:39 -07:00
Lukas Piatkowski
a4cd4005df mercurial: refactor RevlogRepo to expose less methods publicly
Summary:
RevlogRepo exposes a ton of methods that are almost equvalent to taking Revlog directly and ignoring the RevloRepo abstraction above it.
This diff cleans this up a bit, there are still some methods that the "old" blobimport uses, but the "new" one shouldn't need to do that.

Reviewed By: StanislavGlebik

Differential Revision: D7289445

fbshipit-source-id: ac7130fe41c4e4484d6986fe5b19d5adc751369a
2018-03-20 11:53:09 -07:00
Siddharth Agarwal
b338897dc4 prefix ChangesetId, ManifestId and BlobHash with Hg
Summary:
Mononoke will introduce its own ChangesetId, ManifestId and BlobHash, and it
would be good to rename these before that lands.

Reviewed By: farnz

Differential Revision: D7293334

fbshipit-source-id: 7d9d5ddf1f1f45ad45f04194e4811b0f6decb3b0
2018-03-15 17:45:29 -07:00
Simon Farnsworth
050c7d95d8 Support a key prefix in ManifoldBlob Blobstore
Summary:
I want to be able to work in a private Manifold namespace when testing
that my hunches about Manifold/Mononoke interactions are good, and when testing
changes to the ManifoldBlob that should make life better. Make that possible.

In the future, once I have a Blobstore that simulates Manifold locally, this
also makes it possible to compare the simulation to Manifold without tripping
over other users.

Reviewed By: StanislavGlebik

Differential Revision: D7194754

fbshipit-source-id: 601bf1c2ded1af5db6a123fdd05600bc3eb5d7cf
2018-03-12 07:59:56 -07:00
Siddharth Agarwal
6204e214d1 create a mononoke-types crate
Summary:
These are types that are going to be used throughout Mononoke -- I'm hoping to
avoid references to current Mercurial data structures in here.

For now, the only module I've moved is part of the `path` module. The
Mercurial-specific `fsencode` bits have been kept in mercurial-types (though
maybe they should move to `mercurial`?)

In the future, this module will also include definitions for unodes, etc.

Reviewed By: jsgf

Differential Revision: D7188722

fbshipit-source-id: fc097ca12c38a787f83e35af9b8dd308f2b910ea
2018-03-08 10:57:35 -08:00
Alexander Putilin
b4cecd77da mononoke: add basic telemetry for some hg operations
Summary:
Add basic telemetry for some of hg operations that return a future. This is a draft I'm requesting feedback on (as advised by stash@).
1) The code is a bit repetitive. Is there a way to refactor it (for example, python decorator-like style)?
2) What is the best way to add telemetry for operations that return a BoxStream (and not a future)?

Reviewed By: StanislavGlebik

Differential Revision: D7056236

fbshipit-source-id: 7fd61b5533d0fe3857cc7865491b5e9e7240a886
2018-03-05 18:46:00 -08:00
Stanislau Hlebik
9beeaeadc5 mononoke: add repoid to BlobRepo
Summary: Changests store requires it in it's api methods. Let's pass repoid from configs

Reviewed By: farnz

Differential Revision: D7043830

fbshipit-source-id: e4e4d5852d0ca8488cabe2140555508c143ab8df
2018-02-26 09:43:24 -08:00
Katherine McKinley
28ce2f6211 Replace NodeHash with ChangesetId in BlobRepo
Summary:
This change removes get_changeset_by_nodeid and replaces it with
get_changeset_by_changesetid, and propagates the changes to callers.

A few places still have ChangesetId::new() because I'm not sure where
the original NodeHash comes from. If you have any pointers, I would be
happy to fix them before landing.

Reviewed By: lukaspiatkowski

Differential Revision: D7031923

fbshipit-source-id: cd00ea1d2b955538e26d7b5735aed33fe0ae0330
2018-02-21 10:42:06 -08:00
Stanislau Hlebik
1d7668ffba mononoke: remove get_mpath and get_path and use get_name
Summary:
As we discussed before, let's add get_name() method that returns MPathElement,
and remove get_path() and get_mpath().

Except for renaming, diff also make repoconfig work with tree manifest, and
fixes linknodes creation in blobimport - previously basename was used instead
of the whole path.

Reviewed By: jsgf

Differential Revision: D6857097

fbshipit-source-id: c09f3ff40d38643bd44aee8b4488277d658cf4f6
2018-02-07 07:53:48 -08:00
Katherine McKinley
95e8874519 Use ChangesetId when initializing RevlogRepo
Summary: Initialize the RevlogRepo using the ChangesetId instead of the NodeHash.

Reviewed By: lukaspiatkowski

Differential Revision: D6867296

fbshipit-source-id: 12f0847324d138466421acc3b1f159a03655333b
2018-02-06 10:21:33 -08:00
Stanislau Hlebik
09542720e4 mononoke: add TestBlobManifold config
Summary:
Config to connect to manifold. It's a test version, because it uses in-memory
bookmarks and heads.

Because Manifold BlobRepo require Remote to the tokio_core, I had to do a bit
of refactoring and delay BlobRepo creation. Now it's created after the
corresponding thread is created.

Reviewed By: jsgf

Differential Revision: D6748462

fbshipit-source-id: f14a3c98a6a00f44b5557255bc514df34325420f
2018-01-21 07:37:30 -08:00
Stanislau Hlebik
91bbf73fcb mononoke: rustfmt repoconfig.rs
Reviewed By: jsgf

Differential Revision: D6748460

fbshipit-source-id: 51eb68e41a209c310cb30f884dd2173a2cfd9a1b
2018-01-21 07:37:30 -08:00
Xiaotian Wu
92c0528b1f modify manifestid related code
Summary: nodehash -> manifestid

Reviewed By: lukaspiatkowski

Differential Revision: D6719378

fbshipit-source-id: 1ec59b33270e389da8e74b3864c37a86c9d89f81
2018-01-16 07:57:25 -08:00
Simon Farnsworth
ebafde00b0 Remove Repo trait completely
Summary:
We're never going to serve RevlogRepo in production, and we're down to
a single BlobRepo type that will have different backing stores. Remove the
unused trait, and use BlobRepo everywhere bar blobimport and repo_config
(because we previously hardcoded revlog here - we want to change to a BlobRepo
once blobimport is full-fidelity).

Reviewed By: jsgf

Differential Revision: D6596164

fbshipit-source-id: ba6e76e78c495720792cbe77ae6037f7802ec126
2018-01-15 06:37:27 -08:00
Jeremy Fitzhardinge
ac31713c84 rust: failure cleanup pass
Summary:
Don't use failure's bail!() and ensure!() macros.

Instead, failure_ext provides:
- bail_err!(err) - Converts its single parameter to the expected error and returns; ie `return Err(From::from(err));`
- bail_msg!(fmt, ...) - takes format string parameters and returns a `failure::err_msg()` error
- ensure_err!(), ensure_msg!() - corresponding changes

Also:
- remove all stray references to error-chain
- remove direct references to failure_derive (it's reexported via failure and failure_ext)
- replace uses of `Err(foo)?;` with `bail_err!()` (since `bail_err` unconditionally returns, but `Err(x)?` does not in principle, which can affect type inference)

Reviewed By: kulshrax

Differential Revision: D6507717

fbshipit-source-id: 635fb6f8c96d185b195dff171ea9c8db9e83af10
2017-12-07 14:10:17 -08:00
Jeremy Fitzhardinge
dc5e78c1c1 rust: mass convert scm/mononoke/... to use failure
Summary:
Convert scm/mononoke to use failure, and update common/rust crates it depends on as well.

What it looks like is a lot of deleted code...

General strategy:
- common/rust/failure_ext adds some things that are in git failure that aren't yet in crates.io (`bail!` and `ensure!`, `Result<T, Error>`)
- everything returns `Result<T, failure::Error>`
- crates with real error get an error type, with a derived Fail implementation
  - replicate error-chain by defining an `enum ErrorKind` where the fields match the declared errors in the error! macro
- crates with dummy error-chain (no local errors) lose it
- `.chain_err()` -> `.context()` or `.with_context()`

So far the only place I've needed to extract an error is in a unit test.
Having a single unified error type has simplified a lot of things, and removed a lot of error type parameters, error conversion, etc, etc.

Reviewed By: sid0

Differential Revision: D6446584

fbshipit-source-id: 744640ca2997d4a85513c4519017f2e2e78a73f5
2017-12-05 18:11:13 -08:00