Commit Graph

2123 Commits

Author SHA1 Message Date
Siddharth Agarwal
ed298889af filelinknodes: also write out path and node info
Summary: Needed for the generate_memblob script.

Reviewed By: jsgf

Differential Revision: D6214835

fbshipit-source-id: 130f8946748490c31a38dc7530fec8f4027379f1
2017-11-02 13:10:56 -07:00
Siddharth Agarwal
dfd53e9233 filekv: allow specifying a version during set
Summary:
This field is optional. We need to ensure in linknodes that the
version is always set to a fixed value so that linknode blobs written out to
disk are deterministic.

Reviewed By: jsgf

Differential Revision: D6214032

fbshipit-source-id: c1eea7bf28bb096c1d23165e1f50ff2dc6d21274
2017-11-02 13:10:56 -07:00
Siddharth Agarwal
acda30f2fb replace AsRef<Path> with Into<PathBuf> in a few spots
Summary:
We need ownership of the buffer in all of these cases, and
`AsRef<Path>` could potentially create unnecessary copies.

Reviewed By: jsgf

Differential Revision: D6214034

fbshipit-source-id: 806a87bfe3b125febaaaaf26c8b8dcac407de145
2017-11-02 13:10:56 -07:00
Jeremy Fitzhardinge
94d9655297 tp2: rust: update rust-crates-io and rust-bindgen
Summary:
This needed a few other updates:
- rust-bindgen enum handling changed, affecting stats and rocksdb
- memmap crate changed API

Reviewed By: sid0

Differential Revision: D6219702

fbshipit-source-id: 2acc2b24ee6a26581bc73b0a7eda84b647bc79c1
2017-11-02 13:10:56 -07:00
Stanislau Hlebik
160b89994e mononoke: accept urls with trailing slash and without
Summary: Let's not be too restrictive about urls

Reviewed By: markbt

Differential Revision: D6099460

fbshipit-source-id: 228a5b3a3cc0f09d68307a3695952543a2f5f05a
2017-11-01 19:11:20 -07:00
Stanislau Hlebik
e300d76095 mononoke: add logging to eden-server and improve error reporting
Summary:
1) Glog logging is added
2) The whole error chain is reported

Reviewed By: markbt

Differential Revision: D6099290

fbshipit-source-id: 1ec9a7fe4c6b9f2b918f47852884ba8afa997916
2017-11-01 19:11:20 -07:00
Stanislau Hlebik
5ae8299e80 mononoke: Use MemHeads and MemBookmarks in TestManifoldBlobState
Summary:
Bookmarks and heads are not used in eden server, but user still have to specify
--blobrepo-folder. Let's use MemHeads and MemBookmarks instead to avoid
specifying this parameter

Reviewed By: sid0

Differential Revision: D6099149

fbshipit-source-id: 26927bdd5c5dba2164688e72d238587f5535ccfc
2017-11-01 19:11:20 -07:00
Jeremy Fitzhardinge
aeacd5fffa mononoke: repoinfo: use impl Future to clarify signature
Summary:
The only interesting thing about the return type is that its a Future
whose Item is Generation, so change the signature to reflect that.

Reviewed By: farnz

Differential Revision: D6208970

fbshipit-source-id: 126aba31b530bd2035f0ea148582cfa5886c871b
2017-11-01 19:11:20 -07:00
Jeremy Fitzhardinge
04276f43b4 mononoke: hgproto: capture unbundle stream as Bytes
Summary:
Parse the unbundle command as an `unbundle` command with its `heads`
parameter, followed by a bundle2 stream which is parsed in order to capture it
as bytes, as a simulation of an actual stream.

Reviewed By: sid0

Differential Revision: D6209818

fbshipit-source-id: 9bc454319350e2047160347964740f3a3d2f592f
2017-11-01 18:51:21 -07:00
Jeremy Fitzhardinge
6b5a13c1f6 rust: futures-ext: only consume as much input as needed for the decoder to make progress
Summary:
Avoid over-consuming the input, as excess input isn't easily pushed
back into the input stream. This is necessary to make sure that when parsing a
bundle2 stream we don't consume input from beyond the end of the stream, which
can upset the hg ssh command processor.

Reviewed By: sid0

Differential Revision: D6214174

fbshipit-source-id: 3a2227fab5ddfbb247437508206d40e85024c48e
2017-11-01 18:51:21 -07:00
Jeremy Fitzhardinge
6ba05b01a8 mononoke: hgproto: apply rustfmt
Reviewed By: farnz

Differential Revision: D6203916

fbshipit-source-id: 0f085672b7c584baa08563cc0365c3ef6fbecdfb
2017-11-01 18:51:21 -07:00
Jeremy Fitzhardinge
04b05583df rust: async-compression: loosen decompressor lifetime bound
Summary:
Lifetime doesn't need to be static - it can be something smaller.
Propagate this into the bundle2 parser.

Reviewed By: farnz

Differential Revision: D6203918

fbshipit-source-id: f559b92029c975fee6e5c64d9d34ff9708364dc9
2017-11-01 18:51:21 -07:00
Siddharth Agarwal
1d299009d3 use hyphen instead of colon for file-based linknodes
Summary: Colons are reserved on Windows

Reviewed By: farnz

Differential Revision: D6202655

fbshipit-source-id: 0918b43dd36aa3990064bf1c79893b20570ee82c
2017-11-01 16:27:30 -07:00
Stanislau Hlebik
e64ef44fda mononoke: add an option to limit blob size in blobimport
Summary:
This option can be used non-production ready blobstores that can't yet handle
big blobs.

Reviewed By: farnz

Differential Revision: D6189922

fbshipit-source-id: fa4df5b49c6d1126d3b3114e9ebe376931947917
2017-11-01 13:01:58 -07:00
Stanislau Hlebik
8cc33676aa mononoke: add --commits-limit option to blobimport
Summary:
It's quite useful option for testing and I had to reimplement this option a
couple of time. It's time to land it.

Reviewed By: farnz

Differential Revision: D6172230

fbshipit-source-id: ec1b7c0453a3a612a173aec87978a4917568cd7b
2017-11-01 13:01:57 -07:00
Jeremy Fitzhardinge
c3a0dc052f mononoke: impl Repo for Box<Repo + Sync + Send>
Summary:
Rust doesn't do variant typing except for lifetimes, so an impl of
Repo for Box<Repo> doesn't apply to Box<Repo + Sync + Send>. Since in practice
all our Repos are Sync + Send, just implement it for that.

(AFAICT implementing it for both would result in a big chunk of copied code,
and it doesn't seem worth doing that or introducing a macro since we don't seem
to be using the non-Sync+Send version.)

Reviewed By: farnz

Differential Revision: D6208968

fbshipit-source-id: a039a31e360255ca104ac2de833ec3d61e8128d7
2017-11-01 10:36:09 -07:00
Simon Farnsworth
5fdc5389e7 add a range revset
Summary: The last important revset is "range" - all commits in the DAG between two commits inclusive (you can use SetDifference to subtract out unwanted ends). Add it to the set of provided revsets.

Reviewed By: lukaspiatkowski

Differential Revision: D6201385

fbshipit-source-id: 8bea8f4d70238d02390d69ec2ee4c37fde3f2d55
2017-11-01 08:25:57 -07:00
Lukas Piatkowski
9712530c0e blobstore: add RetryingBlobstore that retries failed put/get operations with delay
Reviewed By: StanislavGlebik

Differential Revision: D6203017

fbshipit-source-id: 277fa267e86d2cb5eede241bf80dd8d1c90a3b96
2017-10-31 20:53:08 -07:00
Siddharth Agarwal
c8d6e7f954 use RepoPath instead of MPath in a few places
Summary:
`RepoPath` represents any absolute path -- root, directory or file. There's a
lot of code that manually switches between directory and file entries --
abstract all of that away.

Reviewed By: farnz

Differential Revision: D6201383

fbshipit-source-id: 0047023a67a5484ddbdd00bb57bca3bfb7d4dd3f
2017-10-31 14:26:39 -07:00
Siddharth Agarwal
1e7f9e7162 use impl Future in a spot
Summary: Noticed this while doing some refactoring here.

Reviewed By: StanislavGlebik

Differential Revision: D6201384

fbshipit-source-id: ee0a9b2ee0ee5cf3b1d447707b90751b01bd0c9f
2017-10-31 14:26:39 -07:00
Siddharth Agarwal
e9036ade06 make the Linknodes trait Sync
Summary: All implementations are expected to be, and this simplifies downstream code.

Reviewed By: farnz

Differential Revision: D6192078

fbshipit-source-id: bf63bbe84db7919e3c6fa808da1c5c25c25d2ec8
2017-10-31 12:29:45 -07:00
Sam Fu
1e5225b5c7 remove deprecated Tokio APIs from fbcode/scm/mononoke/mercurial
Reviewed By: jsgf

Differential Revision: D6151579

fbshipit-source-id: 6cb9f3a96916d46664bc8d52a7064419324934a6
2017-10-31 11:22:05 -07:00
Jeremy Fitzhardinge
3ac3c41431 mononoke: rename server scm/mononoke/server:server -> scm/mononoke:mononoke
Summary: Use a more easily discoverable name.

Reviewed By: farnz

Differential Revision: D6191999

fbshipit-source-id: 140372bb714af7b8c2fff481f257264acb719735
2017-10-31 10:14:30 -07:00
Stanislau Hlebik
a231885209 mononoke: fix param parsing for unbundle
Summary:
Even though the parameter is called `heads`, it's not necessarily heads.
It can be:
1) hex-encoded word "force" - "666f726365"
2) Hex-encoded list of heads
3) hex encoded word "hashed" and a hash of heads' hashes.

Proof: https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/wireproto.py#l362

Previously we just parsed list of hashes, and it wasn't correct. This diff fixes it

Reviewed By: jsgf

Differential Revision: D6110315

fbshipit-source-id: 57ca12d13e3b719803b20ae1718d5f4309b806f5
2017-10-26 07:20:12 -07:00
Brandon Milton
90b02ca11a Remove uses of deprecated Tokio API
Summary:
Removes uses of deprecated Tokio API by doing the following:
1. Removing the ignore deprecation header
2. Including `futures_ext` in TARGETS
3. Porting all FutureBox uses to `futures_ext`
4. Porting `boxed()` to `boxify()`

The guide I followed:
https://our.intern.facebook.com/intern/wiki/Rust/Tokio_cleanup/

Reviewed By: sid0

Differential Revision: D6083953

fbshipit-source-id: 93b3ce0c70affbbf2b1158abf66f6f3a4d60a420
2017-10-20 09:39:46 -07:00
Siddharth Agarwal
6afdfc7f00 linknodes: switch from MPath to RepoPath
Summary:
RepoPath also captures whether this is a file or a directory (tree), which is
important for linknodes.

Also pass a `RepoPath` in, not just a `&RepoPath` -- the path is pretty much
always going to be cloned, so might as well.

Reviewed By: StanislavGlebik

Differential Revision: D6098520

fbshipit-source-id: c1a8d5defa841960b53fa919e6d8d59fb33d5c28
2017-10-19 09:39:17 -07:00
Siddharth Agarwal
e2405a5ffa mercurial-types: add a new type for MPath with root/file/dir info
Summary:
This is going to be useful for linknodes, where we must differentiate between a
linknode obtained from a directory (tree) and a linknode obtained from a file.

In this case we must disallow empty `MPath` instances because `FilePath("")` in
particular should not be allowed. Also disallow `DirectoryPath("")` for
symmetry.

Reviewed By: StanislavGlebik

Differential Revision: D6097838

fbshipit-source-id: 302aed1cb03b549787e30e3f0db8c089c9ea67fa
2017-10-19 09:39:17 -07:00
Siddharth Agarwal
7a2b4f12ea mercurial-types: add a couple of TryFrom impls for MPath
Summary: This is going to be useful in upcoming patches.

Reviewed By: StanislavGlebik

Differential Revision: D6097837

fbshipit-source-id: 0952aa47354b9e9956f934914e73def35d1af3d1
2017-10-19 09:39:17 -07:00
Siddharth Agarwal
6e8f1e962c mercurial-types: make MPath serializable
Summary: We're going to use this in upcoming patches.

Reviewed By: StanislavGlebik

Differential Revision: D6097839

fbshipit-source-id: 1abdc62d5c81dce7b5fa3b8f0a264932dded02b8
2017-10-19 09:39:17 -07:00
Siddharth Agarwal
a7ea7884d6 linknodes: add definition for Arc<L> where L: Linknodes
Summary: Upcoming work will want to use this.

Reviewed By: StanislavGlebik

Differential Revision: D6097836

fbshipit-source-id: 23532e3d1182179ea2e454df0329ba10f50d565f
2017-10-19 09:39:17 -07:00
Siddharth Agarwal
3269b802a4 factor out code to put manifest and file blobs
Summary:
copy_changeset was getting a bit too long, and linknode stuff would
have made it even longer.

Reviewed By: StanislavGlebik

Differential Revision: D6097840

fbshipit-source-id: 00800cf9516adf69f2ca19244d3e14268f148ae4
2017-10-19 09:39:17 -07:00
Siddharth Agarwal
92eb9c6e6a blobimport: use (effectively) named params for conversion
Summary:
Going to add more params here, and this is becoming quite hard to
read.

Reviewed By: StanislavGlebik

Differential Revision: D6096419

fbshipit-source-id: 50f0b99bb6b1804fc01f6a99fc0297c1695dbaa5
2017-10-19 09:39:17 -07:00
Siddharth Agarwal
a1c6c494fd blobimport: nicer manifest method names
Summary: Namespacing really helps here!

Reviewed By: StanislavGlebik

Differential Revision: D6095128

fbshipit-source-id: f7e4b6d011c2d55c3976a6ba9a20f17384c62b92
2017-10-19 09:39:17 -07:00
Siddharth Agarwal
675c1e0b56 blobimport: factor out conversion code into separate files
Summary:
I'm adding linknode support to this store, and with that and without
this refactoring the code becomes quite unmanageable.

I've recorded this as copies to preserve blame info for the bits that will
remain untouched. This seems to work pretty well.

Reviewed By: StanislavGlebik

Differential Revision: D6094812

fbshipit-source-id: f7a7a1d3546d4ef2dbfa33a0a8e97d47b44f51a5
2017-10-19 09:39:17 -07:00
Siddharth Agarwal
7205d847f5 blobimport: factor out error definitions into another module
Reviewed By: StanislavGlebik

Differential Revision: D6094813

fbshipit-source-id: fa58b9c69c82c506435d7c7d3b259c8d9cb46545
2017-10-19 09:39:17 -07:00
Siddharth Agarwal
2fbdf6d207 move blobimport code into a subdirectory
Summary: Will factor this out into several files in upcoming patches.

Reviewed By: StanislavGlebik

Differential Revision: D6094811

fbshipit-source-id: cd354888882aff2552e61dea788aeb5426e08f4d
2017-10-19 09:39:17 -07:00
Siddharth Agarwal
9b691889fd blobrepo: use impl Future in a couple of places
Summary:
I spent too much time debugging something that was made a lot easier
once I used `impl Future`.

Reviewed By: StanislavGlebik

Differential Revision: D6094810

fbshipit-source-id: 6bdcf6159a87df56eb61d85a51ade31397ff6994
2017-10-19 09:39:17 -07:00
Stanislau Hlebik
d4b41ae5d1 mononoke: move eden-server to eden_server
Summary: To make folder name consistent with the buck target

Reviewed By: farnz

Differential Revision: D6098739

fbshipit-source-id: 7d876a0fa352d98a5d4164093d07ebe7388680e7
2017-10-19 09:05:49 -07:00
Siddharth Agarwal
0a0c594e03 blobstore: unify blobstore tests
Summary:
Similar to heads/bookmarks, share blobstore tests across
implementations.

The trait bounds got a bit tricky, but I think I managed to get the ones we
need and no more.

Reviewed By: StanislavGlebik

Differential Revision: D6082649

fbshipit-source-id: 3a80adc95d6c1059dab7ec89e5ec5724370cc268
2017-10-18 15:20:39 -07:00
Lukas Piatkowski
c3a75813cf hgcli: add a bash script for using mononoke deployed inside tupperware
Summary: Enables Mononoke developers to use Mononoke tupperware deployment to pull/push/clone

Reviewed By: farnz

Differential Revision: D6077834

fbshipit-source-id: 812e0653f9ee05b186c1e310281597ce98745702
2017-10-18 05:37:00 -07:00
Stanislau Hlebik
553343bc0d mononoke: filter the same manifest entries in blobimporting
Summary:
There is no need to insert the same entries twice. Let's filter them.
Note that while it's possible to have the same manifest entries (for example,
file or dirs with the same content), all changeset entries should be unique,
because each changeset in the repo is unique and is processed exactly once.

Reviewed By: farnz

Differential Revision: D6076667

fbshipit-source-id: 64bdf25a21884eb2faf43f32590f7cbb8f8dd300
2017-10-18 01:36:22 -07:00
Stanislau Hlebik
58777d54ca mononoke: support manifold blobstore in eden server
Summary:
Manifold requires a separate thread to do the IO, so we create a separate
detached thread.

Reviewed By: sid0

Differential Revision: D6063729

fbshipit-source-id: a67d1da955aa2cd34e923a0762bbb76c858728b1
2017-10-18 01:36:22 -07:00
Stanislau Hlebik
d408fab739 mononoke: add ManifoldBlobState
Summary:
Blobrepo state with file-based bookmarks and heads and manifold blobstore.
It will be used for eden server testing.

Reviewed By: sid0

Differential Revision: D6063728

fbshipit-source-id: f0542265af015d5c20db225ed6bf85cae954a3ab
2017-10-18 01:36:22 -07:00
Stanislau Hlebik
13823f0f7e mononoke: add separate io thread to blobimport
Summary:
Let's move all IO to the separate thread. This helps quite a lot when used with
slow blostore, because parser threads are not blocked on IO -
importing upstream mercurial repo went from 20 mins to 9 mins.

Reviewed By: lukaspiatkowski

Differential Revision: D6050992

fbshipit-source-id: c3877b123bad993d819495247135544a141eab10
2017-10-18 01:36:22 -07:00
Stanislau Hlebik
97fedb6daa mononoke: clear revlogs when we have too many of them
Summary:
Blobimporting of huge repos can result in huge memory usage and may result in OOM errors.
Let's use stupid but quite effective method in practice - let's clear revlogs when we have too many of them.

We can't use lru_cache crate (http://contain-rs.github.io/lru-cache/lru_cache/) because it doesn't have immutable methods, so we won't be able to use ReadWriteLock optimization we've added before.

Reviewed By: lukaspiatkowski

Differential Revision: D5953892

fbshipit-source-id: 9d78b0065ee9901d35567972cf0014c3c00c3c77
2017-10-18 01:36:21 -07:00
Siddharth Agarwal
1cbb0baa5f heads: unify heads tests
Summary:
Just like with bookmarks in D6075454, share common test code. This can
also then be used for a MySQL-based heads implementation.

Reviewed By: kulshrax

Differential Revision: D6081295

fbshipit-source-id: a617dbf09504ccdff3634866a8d0dcfd40f7c96b
2017-10-17 16:59:27 -07:00
Siddharth Agarwal
a730eb9ec9 bookmarks: unify bookmark tests
Summary:
All bookmark implementations, including the upcoming MySQL-based one,
should work with these tests.  Don't duplicate them in every test crate.

Reviewed By: StanislavGlebik

Differential Revision: D6075454

fbshipit-source-id: 547e3c2c98326a6fdca55a562811924ebec93796
2017-10-17 09:09:48 -07:00
Siddharth Agarwal
55db1caebd linknodes: add a file-based linknodes implementation
Summary: This implementation uses the `filekv` library extracted in earlier series.

Reviewed By: jsgf

Differential Revision: D6072674

fbshipit-source-id: 01f443fb614fea7087f8a09a4d6b3eb371c34852
2017-10-17 00:36:29 -07:00
Siddharth Agarwal
d2067ebf52 linknodes: move common tests out into a test module
Summary: We'll reuse these tests for a file-based implementaion as well.

Reviewed By: farnz

Differential Revision: D6059222

fbshipit-source-id: ff63e21badda455bc83c34da2acd08395e906826
2017-10-17 00:36:28 -07:00
Siddharth Agarwal
8d9864c260 linknodes: make the old linknode optional
Summary:
Some implementations like file-based linknodes won't have this data.

The wrapper struct is required so that `Display` can be implemented.

Reviewed By: farnz

Differential Revision: D6059220

fbshipit-source-id: 705e0152abcff59cf0584741430b20e34a2cd652
2017-10-17 00:36:28 -07:00