Commit Graph

97 Commits

Author SHA1 Message Date
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
Stanislau Hlebik
b947ec0bf1 mononoke: bundle2resolver changes for pushrebase
Summary:
Now bundle2 resolver first tries to parse `b2x:commonheads`. If it exists then
it then assumes it's a pushrebase bundle. Otherwise it assumes it's a normal
push bundle.

The actual handling of pushrebase bundle will be implemented in the next diff

Reviewed By: farnz

Differential Revision: D8858318

fbshipit-source-id: de5879abec2b3ed82e3b505d621c45754ab4d4d2
2018-07-17 13:08:50 -07:00
Stanislau Hlebik
2b935c7f60 mononoke: refactor bundle2 resolver
Summary:
I'm planning to add a separate function that will resolve pushrebase bundle. In
this diff let's just move resolving of normal bundle to a separate function

Reviewed By: farnz

Differential Revision: D8858184

fbshipit-source-id: 085d1e013135d9d557183058d11b2031b0bdf083
2018-07-17 13:08:50 -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
Jeremy Fitzhardinge
a5937a5424 mononoke/dbbookmarks: return txn success as bool
Summary:
We need to be able to distinguish logical transaction failure from
infrastructure failure, so change the `Transaction::commit` future to
`Future<Item=bool, Error=Error>`, where `false` indicates a logical transaction
failure. This allows the caller to determine whether a retry or other recovery
logic is needed.

Reviewed By: lukaspiatkowski

Differential Revision: D8555727

fbshipit-source-id: 8ab64f3019f2644e7eaabc8d699d99aa8eb08fbb
2018-06-29 20:37:09 -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
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
Lukas Piatkowski
5ccd967e0c bundle2-resolver: add scuba logs for the size of unbundle
Summary: more logging in bundle code

Reviewed By: StanislavGlebik

Differential Revision: D8577658

fbshipit-source-id: 079ef36176619744302c1e0b6cd99f69f6d5f9af
2018-06-21 15:51:59 -07:00
Lukas Piatkowski
1c077c636b bundle2-resolver: provide filechanges from revlog cs rather than compute it during push
Summary: We had a suspicion that this computation is slow and affects the performance of pushes. Later we found many other different reasons why push is slow and we never rechecked if this diff is still valuable, but this will change anyway with Bonsai Changesets coming.

Reviewed By: StanislavGlebik

Differential Revision: D8549429

fbshipit-source-id: 878127677ea6d3f76661da5bc8a7e54f5ba7485e
2018-06-20 18:11:21 -07:00
Lukas Piatkowski
13359d36a4 bundle2-resolver: pass only necessary entries for persisting a changeset
Summary:
Prior to this diff when we constructed list of child entries to be passed to CreateChangeset we have been walking the tree of manifests and appending everything that we have found to the child entries list, which often include the entries of the commit parent if it is pushed in the same unbundle command.

After this diff we append only the things that are connected to the diff to be created filtering out the ones that will be handled by parent creation.

This code assumes that the client doesn't send us entries that are part of parent that were pushed in a separate unbundle command. If we wouldn't make that assumption then we would need to consult the blobstore in order to filter out those entries.

Reviewed By: StanislavGlebik

Differential Revision: D8547867

fbshipit-source-id: ac72f1b6066c15b1fea029e0224fe0ebf9a2db59
2018-06-20 18:11:20 -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
Lukas Piatkowski
24d3fc9e60 bundle2-resolver: add counters that will help understand the size of pushes
Reviewed By: farnz

Differential Revision: D8449818

fbshipit-source-id: d2000ea1ed4948ae1f5cb51fff39b62c248a2e99
2018-06-15 10:10:41 -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 ⁣
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
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
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
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
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
76688a2e4f bundle2-resolver: ignore phases pushkey
Summary: There is nothing we can do with it ATM

Reviewed By: StanislavGlebik

Differential Revision: D8090873

fbshipit-source-id: 232024938fe33583e328ad3231d9213dd6792601
2018-05-22 05:15:23 -07:00
Simon Farnsworth
4f1a5d8ea1 Make it possible to generate hashes for uploaded content during upload
Summary:
Previously, we assumed that all content hashes came from Mercurial;
this is not going to remain true, as we will want to be able to upload manifests
that have been synthesised from Bonsai Changesets. Turn the previous boolean
into a tri-state, and fix up all callers to get the behaviour they expect.

Reviewed By: StanislavGlebik

Differential Revision: D8014911

fbshipit-source-id: 9156b9fab4542ceb269626ad005e1b28392b5329
2018-05-16 09:35:28 -07:00
Jeremy Fitzhardinge
51c49a47be tp2: update to rust 1.26.0 and corresponding rust-crates-io rebuild
Summary:
Rust 1.26 adds many new language features. In particular `impl Trait` is now
stable, so we no longer need `conservative_impl_trait`.

There also seems to have been changed in the (unstable) TryFrom with respect to
usize, and the behaviour of the never type `!`.

There are still a few deprecation warnings, but they don't cause the build to
fail.

Path remapping is now stable, so the buck config needs to change to use it
rather than the unstable command line option.

TODO:
- get aarch64 rust-crates-io build (can defer to a later update)

Reviewed By: Imxset21

Differential Revision: D7966091

fbshipit-source-id: 2e61e262c21eb01c852a36f49c6a6369cdaddcdb
2018-05-11 11:07:33 -07:00
Stanislau Hlebik
e99fce6bd4 mononoke: add separate types for Bookmark and BookmarkPrefix
Summary:
This will make it easier to change the "real" bookmark type from AsciiString to
String if we decide to do that.

BookmarkPrefix is a separate type because we may want to change it from
AsciiString to String. Also we don't want to confuse a bookmark prefix with a
bookmark name.

Reviewed By: jsgf

Differential Revision: D7909992

fbshipit-source-id: 3d4d075c204ed5ef1114a743430982c2836bac04
2018-05-09 02:11:17 -07:00
Lukas Piatkowski
3232bfa4b2 blobrepo: accept a list of exepcted changed files for Changeset creation
Summary:
The commits that are blobimported have out of order or simply incorrect lists of changed files.
Because we have to persists Changesets as is we are passing the untouched list of files here to be used by Changeset.

Reviewed By: farnz

Differential Revision: D7830310

fbshipit-source-id: 56adec2c317896decaa9176b3a6bfb0cab187ed0
2018-05-01 16:35:08 -07:00
Lukas Piatkowski
4d854a243e blobrepo: verify that the Changeset's hash provided by client matches our computed hash
Reviewed By: jsgf

Differential Revision: D7779664

fbshipit-source-id: c844c41c1ff825babe653e4d2caa98348ad34483
2018-04-28 16:33:03 -07:00
Lukas Piatkowski
346183fa8c blobrepo: fix delta application by applying it on raw content of filenode
Summary: The deltas are meant to be applied on raw filenode content that has incorporated copy/move information. Make it so

Reviewed By: jsgf

Differential Revision: D7777329

fbshipit-source-id: 23ce90269cdf5dbb8a16aab026c031c2af68fccb
2018-04-28 16:33:03 -07:00
Lukas Piatkowski
3859718ff5 mercurial_types: return Error on malformed delta application
Summary: The current behavior of delta::apply will panic Mononke server when the client sends malformed delta request. This change will instead propagate an Error explaining why the delta was malformed.

Reviewed By: jsgf

Differential Revision: D7775544

fbshipit-source-id: a64c27c7b9f13323b8be70eb8c2cdf315ce8f08d
2018-04-28 16:33:03 -07:00
Lukas Piatkowski
800b605a35 bundle2-resolver: multiple pushkey parts for pushing multiple bookmarks
Summary: Being able to push multiple bookmarks in a single hg push is required for using hg push as tailing of fbsource which contains few remote bookmarks

Reviewed By: StanislavGlebik

Differential Revision: D7743737

fbshipit-source-id: ba24445762baafbaa5b3295dc8995fe871f97872
2018-04-24 11:17:06 -07:00
Lukas Piatkowski
f28ce26504 blobrepo: handle changesets with null root manifests
Summary: The eden integration test contains a commit with no content which new_blobimport couldn't import. With this changes the commit API is capable of handling such commits.

Reviewed By: jsgf

Differential Revision: D7709243

fbshipit-source-id: 7d55eb2ec421820d189ab05b0f8cb4411f850a7b
2018-04-24 11:17:06 -07:00
Siddharth Agarwal
c652345586 blobrepo: optionally verify that provided and computed entry hashes are consistent
Summary:
We know that the hashes for non-root-tree-manifests and filenodes
should always be consistent. Verify that.

Reviewed By: farnz

Differential Revision: D7704087

fbshipit-source-id: 7f6207878c5cd372b272aa6970506dd63b5a3c7c
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
9b5ee510cb blobrepo: use the incoming provided hash as the blobstore key instead of computing it
Summary:
As the comment explains, sometimes the hashes don't match the
contents. Accept such pushes.

Reviewed By: farnz

Differential Revision: D7699930

fbshipit-source-id: 376f01b6cf03f6cad84c2c878d192d55f8d81812
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
9e49e6da1a blobrepo: make upload_entry arguments named, move to Hg domain
Summary:
We're going to keep this around for now as part of double-writing.
All the hashes here are definitely Mercurial hashes, so use them that way.

Reviewed By: lukaspiatkowski

Differential Revision: D7683890

fbshipit-source-id: 270091cd11f3cec7ef4cf565de5ef913fcf7adea
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
3591b86b9f mercurial: switch file::File to HgNodeHash
Summary:
file::File works entirely in the Mercurial domain, so these
conversions are good.

Reviewed By: StanislavGlebik

Differential Revision: D7665973

fbshipit-source-id: 8a192c5d1886492ad21593693b080c8e5ddf8f7e
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
ed1c842dcd blobrepo: rename BlobEntry to HgBlobEntry
Summary:
This is because these Mercurial entries are (at least currently) going
to be stored as they come in, and this data structure is entirely in the
Mercurial domain.

Reviewed By: lukaspiatkowski

Differential Revision: D7664972

fbshipit-source-id: 9de5475eed0d7ab7085c29fd0282f205043cfe5a
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
65e4e05ed1 bundle2-resolver: also upload Thrift-encoded content blobs
Summary:
This is the first step to getting bonsai changesets into the blob store.

So far the code just waits for content blob uploads to be done. In future diffs Mononoke will synthesize this information into a bonsai changeset as well.

Reviewed By: lukaspiatkowski

Differential Revision: D7627784

fbshipit-source-id: da0c96772ce4d18aed579cecca6135137a8dbe18
2018-04-20 08:40:54 -07:00
Siddharth Agarwal
51d9316db8 bundle2-resolver: rename a couple of type aliases
Summary: In the next diff this code is going to start using `ContentBlob` instances. To avoid confusing Mononoke blobs with Mercurial ones, rename these types and add an `Hg` prefix.

Reviewed By: StanislavGlebik

Differential Revision: D7661571

fbshipit-source-id: 4985cc0c7934667966ca60b64bef349af853c2a0
2018-04-18 19:53:34 -07:00
Siddharth Agarwal
41824251b8 bundle2-resolver: add some comments around the use of Shared
Summary:
This confused me at first -- took me a while to figure out what's going on
here. Hopefully these comments will help the next person who stares at this
code.

Reviewed By: StanislavGlebik

Differential Revision: D7659993

fbshipit-source-id: a009041501f9108d2c01532e9df793cfcecb5496
2018-04-18 19:53:34 -07:00
Siddharth Agarwal
1cd28c2587 blobrepo: use named args for creating a changeset
Summary:
The list of arguments is becoming too long, and I need to add even
more here.

Reviewed By: StanislavGlebik, farnz

Differential Revision: D7652096

fbshipit-source-id: 62a4631e163e95cf5c950a949e72facab629ea54
2018-04-18 19:53:34 -07:00
Siddharth Agarwal
6546e61866 bundle2-resolver: encapsulate related blobs in a struct
Summary: Going to add more to this in upcoming diffs.

Reviewed By: StanislavGlebik

Differential Revision: D7652094

fbshipit-source-id: e52e248c64f5a754ad0c3abe54ca38a4a32514d5
2018-04-18 19:53:34 -07:00
Siddharth Agarwal
3925a39658 bundle2-resolver: pass around ChangegroupPush
Summary:
I'm going to add more stuff to this and I don't want to keep adding
parameters to `upload_changesets`

Reviewed By: StanislavGlebik

Differential Revision: D7648077

fbshipit-source-id: 9b0cbf3efe1bd8d43c0b3c5269c9119f0075428c
2018-04-18 19:53:33 -07:00
Siddharth Agarwal
4b607998bf mercurial: some improvements to File API
Summary:
Now that `BlobNode` no longer returns `None`:

* don't expose the `BlobNode` API outside the crate because it turns out to not be very useful (it should probably go away eventually?)
* make the `File` API not return `Option` types
* Add a new `file_contents` that returns a brand-new `FileContents` (this is the first time we're tying together Mercurial and Mononoke data structures!)

Also remove a `Symlink` API that isn't really correct honestly.

Reviewed By: StanislavGlebik

Differential Revision: D7624729

fbshipit-source-id: 38443093b8bfea91384c959f3425cf355fac9f65
2018-04-17 11:37:29 -07:00
Lukas Piatkowski
10857e6a37 CODEMOD: rename mercurial::BlobNode to HgBlobNode
Reviewed By: sid0

Differential Revision: D7620628

fbshipit-source-id: 8d616c3b9cd3342f71155f11bcef4feb760ddf0e
2018-04-16 03:40:25 -07:00
Lukas Piatkowski
2e0522f884 CODEMOD: rename mercurial::EntryId to HgEntryId
Reviewed By: sid0

Differential Revision: D7620299

fbshipit-source-id: 9bc1505473567528d1f174ae0f0f1312af187814
2018-04-16 03:40:25 -07:00
Lukas Piatkowski
4c4a06c4fe CODEMOD: replace mercurial::{HgChangesetId, HgManifestId, HgNodeHash} with {HgChangesetId, HgManifestId, HgNodeHash}
Summary: The Hg prefix is unique now so let's not use verbose mercurial::

Reviewed By: sid0

Differential Revision: D7620112

fbshipit-source-id: 0aece310ed817445fef4c94b32f78fda3a3b1c49
2018-04-16 03:40:25 -07:00
Lukas Piatkowski
03255529fa CODEMOD: rename mercurial::NodeHash to HgNodeHash
Reviewed By: sid0

Differential Revision: D7619973

fbshipit-source-id: 229fea891788c33eb1f45446ba2333e945ca5553
2018-04-16 03:40:25 -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
497daaa17f bundle2-resolver: switch filelog from using HgBlob to Bytes
Summary:
I'm adding a non-`HgBlob` path separately, and using `HgBlob` here is
inconvenient.

Reviewed By: StanislavGlebik

Differential Revision: D7589854

fbshipit-source-id: 21e425e7d70691b982dbd66b1ea4996d1e0eef66
2018-04-13 11:34:14 -07:00