Commit Graph

54 Commits

Author SHA1 Message Date
Pavel Aslanov
b5670e3bdc correctly handle conflicts in memory manifest
Summary:
Correctly resolve file/directory conflict in `MemoryManifest`
 - when we have file/directory conflict and have entry in `BonsaiChangeset` that indicates that file should be deleted we need resolve conflict by keeping directory
 - more details in [Bonsai changeset actions](https://fb.quip.com/A2kqArd9Nb90#WHBACA4Vitd)

Reviewed By: lukaspiatkowski

Differential Revision: D8658958

fbshipit-source-id: 815a91b847c5c0c9586eb5d317ebb9412196d5f4
2018-07-02 05:21:36 -07:00
Pavel Aslanov
6b1b5eb36f Bonsai::ChangeFile saving unittest
Summary: `Bonsai::ChangeFile` saving unittest

Reviewed By: farnz

Differential Revision: D8420777

fbshipit-source-id: 732da663583b160e1a4512cb287eef720d435340
2018-06-22 05:21:14 -07:00
Pavel Aslanov
cd3a0df197 merge same data different parents
Summary: This code handles "trivial merge"  (when file blob contains same data but different parents) of `MemoryManifest`

Reviewed By: farnz

Differential Revision: D8420775

fbshipit-source-id: dd0c640b8cc822d2dc42eed8f0e9a8e0a00f2cdc
2018-06-22 05:21:13 -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
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
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 ⁣
e3ff3de80c blobstore: move memblob into main blobstore
Summary: It's really straightforward and useful for internal blobstore testing.

Reviewed By: farnz

Differential Revision: D8374496

fbshipit-source-id: 8501e31218ecb5d80530a114e0be5e5d0e8f6c91
2018-06-12 15:40:10 -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
0aa3c76930 blobrepo: lower severity level of "Upload blob stats" log
Summary: This log is by far the most common one and it makes reading logs much harder. It should probably be changed to ODS counters, but for now lets just make it trace!

Reviewed By: farnz

Differential Revision: D8235663

fbshipit-source-id: 3685b260f1c6c43c1fde8501731583debc8d063b
2018-06-05 13:48:28 -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
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
18800e00ea heads: remove related crates
Summary: the idea of Mercurial heads in Mononoke will be represented by bookmarks, so there is no need to have them around

Reviewed By: StanislavGlebik

Differential Revision: D7775032

fbshipit-source-id: 1618a1e51862d7c115b2955082f40ee890a045f1
2018-04-27 04:35:21 -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
16c35f6aac blobrepo: some improvements to test utils
Summary:
* `Into<Bytes>`, not `Into<String>`
* Centralize in one place because I'm going to be adding more non-trivial code to this in upcoming diffs

Reviewed By: farnz

Differential Revision: D7694764

fbshipit-source-id: e6373cf1562b9a464894466ecf3be59e9892ac78
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
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
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
8282139719 mercurial-types: use the base DateTime from mononoke-types
Summary:
The base type is better because it can represent dates from before
1970 as well.

Reviewed By: StanislavGlebik

Differential Revision: D7652095

fbshipit-source-id: 6d66a06e18ba28e13e70b9f0e921acbd3d55baaf
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
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
c35a537aaa CODEMOD: rename mercurial_types::EntryId to DEntryId
Summary: mercurial_types::DEntryId should be replaced by types from mononoke_types or mercurial in most cases. This rename should help with tracking this

Reviewed By: sid0

Differential Revision: D7619571

fbshipit-source-id: bf8d81ec9ffe6a5525d923d7ee67d8e92498aa4d
2018-04-16 03:40:24 -07:00
Lukas Piatkowski
7e05a01ce5 CODEMOD: rename mercurial_types::HgManifestId to DManifestId
Summary: mercurial_types::DManifestId should be replaced by types from mononoke_types in most cases and by mercurial::HgManifestId in others. This rename should help with tracking this

Reviewed By: sid0

Differential Revision: D7619062

fbshipit-source-id: 447224194c6555334b64dc29ebabe3ef0d0cb87e
2018-04-16 03:40:24 -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
Lukas Piatkowski
16cbfd5133 CODEMOD: rename mercurial_types::NodeHash to DNodeHash
Summary: mercurial_types::NodeHash should be replaced by types from mononoke_types in most cases and by mercurial::NodeHash in others. This rename should help with tracking this fact.

Reviewed By: sid0

Differential Revision: D7618389

fbshipit-source-id: a876e723d911df626c7851fba56a056843b4e049
2018-04-16 03:40:24 -07:00
Stanislau Hlebik
89befdb26d mononoke: avoid using linknodes
Summary: They are replaced by filenodes

Reviewed By: farnz

Differential Revision: D7443320

fbshipit-source-id: 13c7d07bc00dcbaa991663c8da8a07fcb0de1332
2018-04-13 02:47:24 -07:00
Siddharth Agarwal
8e7a1acc0f mercurial-types: rename Blob to HgBlob
Summary:
This will probably go away soon, but for now I want to be able to
disambiguate the new Thrift-encoded blobs in Mononoke from these.

Reviewed By: StanislavGlebik

Differential Revision: D7565808

fbshipit-source-id: d61f3096fa368b934a923dee54a0ea1e3469ae0d
2018-04-11 13:42:31 -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
fc3971aa62 mononoke: remove a few BlobRepo constructors
Summary:
They do not provide a lot of value, so let's not have them at all. It will make
adding filenodes easier.

Reviewed By: farnz

Differential Revision: D7428601

fbshipit-source-id: 647fa36d962cb6a8996f92246e4d900751040a52
2018-03-29 03:29:57 -07:00
Jeremy Fitzhardinge
3373c16b62 scm/mononoke: run changeset operations in worker threads
Summary:
Run changeset db operations in worker threads to make them async as
far as the rest of the system is concerned.

Reviewed By: farnz

Differential Revision: D7350002

fbshipit-source-id: 66fadf9ad2f16929e0c07a6907aa9d5f5a7075a8
2018-03-23 13:47:55 -07:00
Arun Kulshreshtha
c12923a087 Use std::time instead of time crate in futures-stats
Summary: Remove usage of deprecated `time` crate in `futures-stats`, and fix all callsites using the new `time-ext` crate.

Reviewed By: farnz

Differential Revision: D7349956

fbshipit-source-id: 10ef86c4942b8533a734c7daadfa895f5ef92f23
2018-03-22 06:01:43 -07:00
Stanislau Hlebik
91d795ec72 mononoke: use diesel bookmarks
Summary: Replace old_bookmarks with the new diesel implementation

Reviewed By: farnz

Differential Revision: D7271599

fbshipit-source-id: cb6433fe44a8e6f87046a3820f7c3e68725505f6
2018-03-21 14:24:51 -07:00
Siddharth Agarwal
2c2dabdd38 use Option<&MPathElement> instead of &Option<MPathElement>
Summary:
The `Option<&MPathElement>` type is more general -- it's easy to
convert from `&Option<MPathElement>` to it, but the other way around can
require a clone.

Reviewed By: farnz

Differential Revision: D7339161

fbshipit-source-id: 0c8ab57a19bc330245c612e3e0e3651e368ab8cb
2018-03-21 09:32:11 -07:00
Simon Farnsworth
54618629b5 Gather a full set of changeset creation timings
Summary:
To diagnose slow changeset creation, we need to know which chunk was
slow. As with upload_blob and process_entries in past diffs, measure key
phases.

The idea is that we can combine all these times (5 per changeset, 2 per blob)
to work out what needs tracing when we're looking for slowness

Reviewed By: StanislavGlebik

Differential Revision: D7195013

fbshipit-source-id: 9769ead981f02d6ecf0258190763e90762936387
2018-03-16 10:36:44 -07:00
Simon Farnsworth
3864f2e0d3 Record the time spent processing entries during changeset creation
Summary:
Processing entries does two things:

1. Polls all the upload futures until they're all complete.
2. Works out what entries are required to be present for this changeset.

This is the bulk of the Blobstore operations in creating a changeset, so we
know that if this is slow, then we either have a slow Blobstore, *or* we have a
bug. Further, we can combine this with the metrics for upload_blob to know
whether we're doing uploads nicely in parallel, or whether there's
serialization we didn't intended (time taken here greater than sum of time
taken in blob uploads)

Reviewed By: StanislavGlebik

Differential Revision: D7182445

fbshipit-source-id: 205b43700f28ff7e5461235e16a6955b8c597a52
2018-03-16 10:36:44 -07:00
Siddharth Agarwal
76027dfac0 verify that MPathElement instances are sane
Summary:
While writing Thrift deserialization code I realized there was nothing
that actually checked that MPathElement instances don't have embedded nulls or
slashes.

Reviewed By: farnz

Differential Revision: D7296838

fbshipit-source-id: 6a23d559da11e5e935e23d7b9a13f58894efaf62
2018-03-16 10:15:05 -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
7452236c99 Refactor special stats drain into a macro
Summary:
I'm going to reuse this for unit-testing changeset timings. Make it a
macro so that I don't keep repeating myself.

Reviewed By: StanislavGlebik

Differential Revision: D7182442

fbshipit-source-id: de40e0f10892b2268c4d39cf771b7a8be6e1cf76
2018-03-13 12:28:20 -07:00
Simon Farnsworth
6d53f3e310 Add timing information to BlobRepo upload_blob
Summary:
We want to be able to measure the time it takes to upload individual
blobs, to confirm that we don't have a concurrency issue to chase down (e.g.
blobs accidentally uploaded in series).

Measure content upload time separately, so that we know not to dive down a
rabbit hole if the measured slowness is just the time spent uploading content

Reviewed By: StanislavGlebik

Differential Revision: D7172154

fbshipit-source-id: 08729a8ffaa69a364a64f6277edfa591a8712592
2018-03-07 13:45:51 -08:00
Simon Farnsworth
868e95e831 Split up the BlobRepo commit tests
Summary:
I'm going to be adding more to test the timing features, so split this
up to make code sharing easier

Reviewed By: StanislavGlebik

Differential Revision: D7172156

fbshipit-source-id: 056be70268dd1c8a37aff8e8d53342b8cea4a355
2018-03-07 04:37:27 -08:00
Simon Farnsworth
bb8c39183e Thread a logger into BlobRepo
Summary: I'm going to need a logger to log future-stats output to (and later trace output). Thread one through to BlobRepo

Reviewed By: StanislavGlebik

Differential Revision: D7167450

fbshipit-source-id: 4ed729e4d448b66e491cefa19380d3be9bc99091
2018-03-06 08:09:19 -08:00
Dino Wernli
fa2b14cd8b Remove the generic types from Blob and BlobNode in favor of Bytes
Summary: Replace the generic types if `Blob` and `BlobNode` with `Bytes`.

Reviewed By: lukaspiatkowski

Differential Revision: D7115361

fbshipit-source-id: 924d347377569c6d1b3b4aed14d584510598da7b
2018-03-02 09:45:04 -08:00
Dino Wernli
36917d583a Address some leftover comments from D7106766.
Reviewed By: lukaspiatkowski

Differential Revision: D7123890

fbshipit-source-id: 73d2531413d34bff6db8baaf959e11084def616e
2018-03-02 09:02:59 -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
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
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