Commit Graph

422 Commits

Author SHA1 Message Date
Stanislau Hlebik
0c4f5bf3f8 mononoke: basic infinitepush implementation
Summary:
Support b2x:infinitepush part. It contains changegroup v2, so just reuse the
normal push path for it.
Note that pushbackup still fails because we don't support
b2x:infinitepushscratchbookmarks part. Also all wireproto params are ignored
for b2x:infinitepush.

Reviewed By: farnz

Differential Revision: D7086120

fbshipit-source-id: 2f98e5d59059ca3c2b82842c98e6dc771c70c6f0
2018-03-01 03:23:46 -08:00
Stanislau Hlebik
3011302908 mononoke: rewrite asyncmemo to use Shared
Summary:
Asyncmemo re-implementation using Shared future. The reasons for doing it are:

1 Now it's safe to drop MemoFuture
2 Now there will be no deadlocks where one future evict another future from the
cache, and then the second future evicts the first futures and so on.

Since Shared returns SharedError, I had to do a hack to work around that. More
details in the code comments.

Reviewed By: farnz

Differential Revision: D7099852

fbshipit-source-id: e08cb859ef06f28339ac9314edb8e53e92480874
2018-03-01 02:35:34 -08:00
Dino Wernli
5c84d1d8de Return file contents as Bytes in blobrepo.
Summary: This starts porting uses of Vec<u8> for file contents to the Bytes type.

Reviewed By: jsgf

Differential Revision: D7106766

fbshipit-source-id: 15d531836132317cede7a6f9d6b047a423deb5bb
2018-02-28 17:59:12 -08:00
Lukas Piatkowski
d24a501e9e blobrepo: write commit to HeadStore
Summary:
This is a hacky way of getting the push/pull working. We should instead remove the commits that are no longer heads from HeadStore and add those that are the new heads.
In this diff though we add all the commits as heads, just because this does not break the client

Reviewed By: farnz

Differential Revision: D7112279

fbshipit-source-id: 036f0fd230de52e96cbf4168c2cda7c2a1c5bd89
2018-02-28 14:15:13 -08:00
Lukas Piatkowski
722eba6c8a mercurial-types: make debug printing of MPath easier to read
Summary: Now both RepoPath and MPath are showing human readable paths when printed

Reviewed By: farnz

Differential Revision: D7112280

fbshipit-source-id: ba7698d2ffa90a125176d70d665cdef669d63b93
2018-02-28 14:15:13 -08:00
Lukas Piatkowski
22a7f7e523 bundle2-resolver: use BlobRepo::create_changeset to upload changesets
Reviewed By: farnz

Differential Revision: D7035844

fbshipit-source-id: a0bc89f717bf878ada981bc04ae6fea0ac0b5660
2018-02-28 11:15:01 -08:00
Lukas Piatkowski
995e15697e bundle2-resolver: use (NodeHash, RepoPath) as id for uploaded blobs
Summary:
From upload_entry perspective NodeHash is not unique for uploaded entry, but when combined with RepoPath it is. An example are two files with the same content, but different paths.

Additionally in this diff the requirement for uploaded blobs to be unique is loosened for Manifests, because the b2xtreegroup might contain duplicates of Manifests

Reviewed By: farnz

Differential Revision: D7087863

fbshipit-source-id: 7e9c2438db037fa171f1e65b6882b445e8c09f7a
2018-02-28 11:15:01 -08:00
Enji Cooper
21de6e7785 Fix typos ("and and" -> "and")
Reviewed By: yfeldblum

Differential Revision: D7091797

fbshipit-source-id: cbba7e5c17e1b6d4446570fb7a2b888db8bcd17e
2018-02-27 16:36:59 -08:00
Dino Wernli
605c033d2d Stop calling the deprecated bind_connection method in eden_server.
Summary: This diff stops calling deprecated methods and re-enables the deprecation lint check.

Reviewed By: StanislavGlebik

Differential Revision: D7082508

fbshipit-source-id: 44a2c7a3939ee8eaa128ae11931b81a5717835cb
2018-02-27 11:37:59 -08:00
Lukas Piatkowski
0ceab4951c bundle2-resolver: accept more than one Filelog chunk with the same path
Summary: It seems that my assumtion that Filelog End section follow every Filelog Chunk section was wrong, because there might be multiple Filelog Chunk sections being different version of the same file from different commits.

Reviewed By: farnz

Differential Revision: D7073007

fbshipit-source-id: 3baee3fd29c77aabf4173a618509de7ff88e4de6
2018-02-27 11:14:52 -08:00
Lukas Piatkowski
37aedb6a7c bundle2-resolver: fetch missing file content from BlobRepo in DeltaCache
Summary: The assumption that deltas can be decoded using only bundle2 was wrong, we need to be able to fetch content of other files from the BlobRepo for delta application.

Reviewed By: StanislavGlebik

Differential Revision: D7085957

fbshipit-source-id: 2f6803d7f61389c5ba38b1207ede42579b9cf2e6
2018-02-27 11:14:52 -08:00
Lukas Piatkowski
6bba67fc5e bundle2-resolver: add context to errors returned from this crate
Summary: This will make it easy to track down an error without looking at stacktraces

Reviewed By: StanislavGlebik

Differential Revision: D7087301

fbshipit-source-id: c5460dae9c5c9ab43713e5db1457f5d9155b5e8e
2018-02-27 11:14:52 -08:00
Jeremy Fitzhardinge
aeff388fef tp2: update rust-crates-io
Summary: Update to include num_cpu and blake2. Also update bincode to 1.0.0

Reviewed By: StanislavGlebik

Differential Revision: D7098292

fbshipit-source-id: 67793a6f458d50fc049781f34abaf313c8ff7a79
2018-02-27 09:27:19 -08:00
Simon Farnsworth
282db746c5 Make the commit API record completion in the Changesets table
Summary:
We want to use the Changeset table as source of truth for changesets.
Record completed changesets in the database.

Additionally, now that completion is a database matter, increase the available
parallelism marginally, by allowing the changeset to upload while its parents
are still uploading

Reviewed By: jsgf

Differential Revision: D7071700

fbshipit-source-id: 405bf84eba4a06e3d6c6299ade2fbea99edf9c19
2018-02-27 02:19:11 -08:00
Simon Farnsworth
5e074bdd43 Create changesets API in BlobRepo
Summary:
Provide an API to ask BlobRepo to create changesets for you from
pieces that you either have to hand, or have created via upload_entry().

Parallelism is maintained in as far as possible - if you commit N changesets,
they should all upload blobs in parallel, but the final completion future
depends on the parents, so that completion order can be maintained.

The ultimate goal of this API is to ensure that only valid commits are added to the `BlobRepo` - this means that, once the future returned by `create_changeset` resolves, you have a repo with commits and blobs in place. Until then, all the pieces can be uploaded, but are not guaranteed to be accessible to clients.

Still TODO is teaching this to use the complete changesets infra so that we
simply know which changesets are fully uploaded.

Reviewed By: StanislavGlebik

Differential Revision: D6743004

fbshipit-source-id: 813329058d85c022d75388890181b48b78d2acf3
2018-02-27 02:19:11 -08:00
Stanislau Hlebik
3526e7137b mononoke: use changesets table in repoinfo
Summary:
Changesets table gives us a relatively fast way to get generation number. Let's
use it inside repoinfo crate.

Reviewed By: sid0

Differential Revision: D7043829

fbshipit-source-id: 82557340a7f2fd6361f4e29c1a11e38e473eeb15
2018-02-26 09:43:24 -08:00
Stanislau Hlebik
e8b335468a mononoke: use changesets table in blobimport
Summary:
Iff all the inserts finished successfully, then it's safe to mark changesets as complete.
This diff fills up changesets store after blobimport successfully finishes.

For simplicity if --commit-limit or --skip is set then we skip filling up the changeset store.

Reviewed By: sid0

Differential Revision: D7043831

fbshipit-source-id: 8ae864b45222d52281c885a49c2dca44ba577137
2018-02-26 09:43:24 -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
Stanislau Hlebik
f88f3fbb21 mononoke: use changesets table in Mononoke
Summary:
For now it does nothing. In the next diffs it will be used to tell if commit
exists in the repo or not and to speed up revsets

Reviewed By: farnz

Differential Revision: D7043828

fbshipit-source-id: 9fcc668e68ba238123a89f18ff67828848ba0cec
2018-02-26 09:43:24 -08:00
Lukas Piatkowski
39d67e5da3 integration tests: add more commits to test-push-protocol
Summary: The introduced commits feature things like adding blob that should already be present, adding blob twice and having non-linear history

Reviewed By: farnz

Differential Revision: D7071447

fbshipit-source-id: e26b7792808351e2380d68b9eb3a4d7e6e859b0e
2018-02-23 12:59:11 -08:00
Lukas Piatkowski
9ce40b36f5 bundle2-resolver: refactor resolver to be more readable
Reviewed By: farnz

Differential Revision: D7067227

fbshipit-source-id: 42384d04f4035e0fd955f450fc2a3ab0f575beba
2018-02-23 11:22:58 -08:00
Lukas Piatkowski
358fd89ff4 bundle2-resolver: use future::Shared to store futures of uploaded blobs
Summary: This is required in further diffs where a single blob can be referenced by multiple Changesets and thus must be Sharable

Reviewed By: farnz

Differential Revision: D7056227

fbshipit-source-id: 81de95fbd933d7888347ffdfbab392b1f0398e89
2018-02-23 11:22:58 -08:00
Lukas Piatkowski
4eab1b3a13 blobrepo: make get_changeset_by_changesetid return BlobChangeset rather than Box<Changeset>
Summary: BlobChangeset has some methods that are useful also outside of blobrepo crate, like getting it's node.

Reviewed By: farnz

Differential Revision: D7056035

fbshipit-source-id: 197d261fd21ab9332950d3fda401e7dab3730cb5
2018-02-23 11:22:58 -08:00
Siddharth Agarwal
1e5ddafbd4 initial complete table backend using diesel
Summary:
Diesel looks quite promising overall, as long as we can ensure async operations
work.

Some basic notes:

* This just looks async but isn't really -- doing that would need a way to send
queries over to a thread pool. (cc kulshrax)
* It is unfortunate that we must use a macro for the exact same `add` code across
MySQL and SQLite. There doesn't appear to be a way out though -- there is no
trait bound that we can apply to the `add` method here.

This is currently pretend-async -- it would be good to make this really async, but that should wait for a future diff IMO

Reviewed By: StanislavGlebik

Differential Revision: D6932028

fbshipit-source-id: ac1cfde3b96bb790f00b73d49c6d90ed128f0255
2018-02-22 17:08:59 -08:00
Lukas Piatkowski
b0d73fac92 bundle2-resolver: uploading Manifest as type::Tree instead of type::File
Reviewed By: farnz

Differential Revision: D7055923

fbshipit-source-id: 3c3f3d47a418b51ccd2eedbf42ddd7b66cb0fdab
2018-02-22 10:06:07 -08:00
Simon Farnsworth
e352098f67 Make manifest difference functions work on references to Manifests
Summary:
These functions don't need ownership, and the commit API wants to be
able to pass the same manifest in multiple times. Use a reference instead of a
Box.

Reviewed By: lukaspiatkowski

Differential Revision: D7043872

fbshipit-source-id: 5ea1b87962b07f8ebecc2f64989339a133e52fa5
2018-02-22 09:18:15 -08:00
Stanislau Hlebik
9c710056bc mononoke: remove useless Arc::new
Summary: We wrap it in Arc below anyway.

Reviewed By: farnz

Differential Revision: D7043827

fbshipit-source-id: afacd10ebb000bd8311891723437d838cd136d61
2018-02-22 07:38:33 -08:00
Lukas Piatkowski
d25ca34c0f bundle2-resolver: reorganize resolver for easier handling of BlobRepo::create_changeset
Reviewed By: farnz

Differential Revision: D7032695

fbshipit-source-id: 66a4d75004236536e5dca6da38f71e4662cda0c8
2018-02-22 04:53:56 -08:00
Lukas Piatkowski
4e8389525b bundle2-resolver: upload filelogs and manifests using BlobRepo::upload_entries
Reviewed By: farnz

Differential Revision: D7031532

fbshipit-source-id: 349889da8c7d3f0c572408b61f956fc2ca9f8fd3
2018-02-22 04:53:56 -08:00
Liubov Dmitrieva
880f8fe5f4 add cargo build support for local development
Summary: Cargo build support for Commit Cloud Thrift Service.

Reviewed By: jsgf

Differential Revision: D6943597

fbshipit-source-id: de65a81988ef72356be7ea376153df4d3b1548f0
2018-02-22 04:30:32 -08:00
Lukas Piatkowski
cea4ff4732 bundle2-resolver: parse ManifestContent from TreeManifestEntry
Summary: this parsed ManifestContent will be used in later diffs to determine the graph of dependencies between BlobEntries and Changesets

Reviewed By: StanislavGlebik

Differential Revision: D7030688

fbshipit-source-id: 243d28f7964e8247ac989a1736210457dd3eab96
2018-02-22 03:45:26 -08:00
Lukas Piatkowski
2237f2180d mercurial: extract BTreeMap to ManifestContent for better sharing with other crates
Summary: This is needed for the next diff where the ManifestContent is used in TreemanifestBundle2Parser

Reviewed By: StanislavGlebik

Differential Revision: D7030689

fbshipit-source-id: cf199e3f1317d8950446782de9899eb2ef97a149
2018-02-22 03:45:26 -08:00
Lukas Piatkowski
9ca8778ef7 bundle2-resolver: add basic telementry for DeltaCache structure
Summary:
The DeltaCache structure will hold onto the full content of all filelogs during a push.
This might potentially lead to memory spikes during large pushes or pushes of large files.
The basic telemetry added in this diff will track how does this structure memory usage changes.

Reviewed By: farnz

Differential Revision: D7025207

fbshipit-source-id: 61b8359e4a9a05b6ddb5ec6a7bc4ce9e58752f1b
2018-02-22 03:45:26 -08:00
Lukas Piatkowski
efc38342f7 bundle2-resolver: convert FilelogDeltaed to Filelog
Summary: This code handles deltaed filelogs and resolves them into proper Filelogs

Reviewed By: farnz

Differential Revision: D7011702

fbshipit-source-id: e8dc4844657011bc1085463eedd1790b87d317dc
2018-02-22 03:45:25 -08:00
Lukas Piatkowski
70cc5f55e1 bundle2-resolver: clean up not readable structure pattern matching in changeset convertion
Reviewed By: StanislavGlebik

Differential Revision: D7042765

fbshipit-source-id: 2f51def8e0db7721529eaf655c6b20c460ecafce
2018-02-22 03:45:25 -08:00
Stanislau Hlebik
11af232471 mononoke: send replychangegroup to the client
Summary:
Return a reply to a client so that it doesn't fail.
Reply consists of just one replychangegroup that tells a client that the push
has succeeded (even though currently it wasn't).

resolve() function returns future of Bytes instead of a stream. It may be
suboptimal, but should be fine for now, and it's already used by a few
wireproto methods.

Reviewed By: lukaspiatkowski

Differential Revision: D7010578

fbshipit-source-id: 9b5425b912c640d4e2bac957a02e9881813b8871
2018-02-21 11:07:19 -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
Simon Farnsworth
9e366eacd4 Introduce a LazyMemblob test blobstore
Summary:
The current Memblob store is eager; this is great for finding certain
classes of bugs (those that assume an ordering that is not guaranteed), but not
so good for exposing other classes of bugs (those that assume that the future
has done its work before it resolves).

Add a lazy variant that functions in the same way as Memblob, but that waits
until it's polled to return.

Reviewed By: StanislavGlebik

Differential Revision: D7033792

fbshipit-source-id: 4c2d8a8150d908bcb26347757f96f99e20d74fc2
2018-02-21 07:17:00 -08:00
Lukas Piatkowski
fdc24f5ce3 bundle2-resolver: use NodeHash::into_option instead of comparing to NULL_HASH
Reviewed By: farnz

Differential Revision: D7023364

fbshipit-source-id: ffe2af6dafe733e8f7e60554f4cba424da9e41ec
2018-02-21 05:05:41 -08:00
Simon Farnsworth
1510d2838f Fix default assert_present implementation
Summary:
The default implementation of `assert_present` only asserted that no
errors were found accessing the blobstore. Update it to fail if the blob is
absent.

Reviewed By: StanislavGlebik

Differential Revision: D7033794

fbshipit-source-id: 596d3b0d3d55d05a5b96760c311defe5a05af634
2018-02-21 04:06:57 -08:00
Jeremy Fitzhardinge
c4a516f9d6 mononoke: mercurial-types: add converters to/from Option for NodeHash
Summary:
We prefer to use Option<NodeHash> to represent a reference which may
be missing, whereas Mercurial file formats and wire protocols tend to use
NULL_HASH. Add some converters to make this simple.

libstd already has a global `impl From<T> for Option<T>` so we can't specialize
that here. Add a specific `into_option` method instead.

Reviewed By: StanislavGlebik

Differential Revision: D7016479

fbshipit-source-id: 1a65f8c2b8c252692a443aa7c5dd5976ad1e24b1
2018-02-20 15:27:11 -08:00
Stanislau Hlebik
06783fc66c mononoke: change bundle2_resolver::resolve signature
Summary:
Now resolve() function accepts stream of Bundle2Item and it doesn't return
remainder. Remainder is parsed in hgproto. This makes unbundle() similar to
other hgproto methods.

Note that resolve() returns future of () - this is temporary and it'll be
changed in the next diff.

Reviewed By: jsgf

Differential Revision: D7010577

fbshipit-source-id: f4bde495d0ab8785476559f65b0165dbd09e4ba5
2018-02-19 05:26:12 -08:00
Lukas Piatkowski
39399a0883 bundle2-resolver: convert ChangesetDeltaed to RevlogChangeset
Reviewed By: StanislavGlebik

Differential Revision: D7002558

fbshipit-source-id: c174d118942dd202fdbea3716acad46fb4a592c5
2018-02-16 13:22:37 -08:00
Lukas Piatkowski
cad62646cd bundle2-resolver: clean up split_changeset function
Summary: I commited the sin of overengineering here and in the next diff I would remove some of these stuff, so doing it here to make the next diff easier to read

Reviewed By: StanislavGlebik

Differential Revision: D7002559

fbshipit-source-id: 46d0776c55c6b2a76a0a816e1168347fea763d43
2018-02-16 04:50:00 -08:00
Stanislau Hlebik
ebf46512ef mononoke: test cleanup, part 2
Summary: Cleanup blobimporting

Reviewed By: lukaspiatkowski

Differential Revision: D7000047

fbshipit-source-id: 2657a5608c3d58df71154dd2e97c4c899c33714a
2018-02-16 03:08:40 -08:00
Stanislau Hlebik
f503d1993c mononoke: test cleanup, part 1
Summary:
Use hgclone_treemanifest instead of hgcloneshallow.
Note that it changes the behaviour of test-infinitepush.t - now it sends
treegroup part too. Since we actually want to send treegroup part during
infinitepush push, that means that the test was broken and now it fixed.

Reviewed By: lukaspiatkowski

Differential Revision: D7000046

fbshipit-source-id: 61b4517f23081faab1738f44d27220ae8063e077
2018-02-16 03:08:40 -08:00
Stanislau Hlebik
387bb1af8c mononoke: fixed test-push-protocol.t test
Summary:
In D6988301 luk noticed that test output is incorrect. Turned out that client
asked server to fetch revision that exists only client-side.

To fix the test let's set treeonly=True and do shallow clone.
Figuring out why exactly it won't work without these flags is very
time-consuming. But that's the usual setup we expect our clients to have.
Besides test-init.t have used these flags and worked fine, so does
test-push-protocol.t

Reviewed By: lukaspiatkowski

Differential Revision: D7000045

fbshipit-source-id: 5e3a6e9fc9c0a1ed0a1e2074f5ac86533d42fa09
2018-02-16 03:08:40 -08:00
Stanislau Hlebik
4c717285ca mononoke: improve integration tests infra
Summary:
1) Do not use system hg in tests.
Let's use current version of hg in the tests. It will simplify debugging
because we can now easily tweak both hg client and server. It will also result
in fewer test breakages, because previously our tests were broken when system
hg was updated.

2) Run integration tests in parallel with -j option

Reviewed By: quark-zju

Differential Revision: D6998535

fbshipit-source-id: dac4eb6d33978161ffe42d9d6a5a39a3ddf3a4e3
2018-02-16 03:08:40 -08:00
Lukas Piatkowski
bc4c116138 bundle2-resolver: add code for converting changegroup into changesets and filelogs
Summary: The changesets and filelogs can later be handled separately and applied on BlobRepo

Reviewed By: jsgf

Differential Revision: D6988952

fbshipit-source-id: 9959b6acb7913db208c2b4eeea8a1c9913d13678
2018-02-15 09:52:45 -08:00
Lukas Piatkowski
8d5a946ee0 mercurial-bundles: replace the flat Bundle2Item with better structured one
Summary:
The previous Bundle2Stream is a stream of enum that can represent any part of bundle2 - being it a header, inner payload or end marker.

This commit changes the Bundle2Stream to be a stream of more structured elements, where each element is a header with corresponding payload attached.

This new approach is easier to handle, because the way a bundle2 stream is supposed to be dealt with is running an operation per header (where the type of operation depends on type of header). With the old Bundle2Stream the "handling" of bundle2 required basically reparsing it's content to the structures that the new design returns directly.

Reviewed By: jsgf

Differential Revision: D6965529

fbshipit-source-id: 03f7cf57fec5c38addf32bdef3ca56d3239288b9
2018-02-15 09:52:45 -08:00