Commit Graph

24 Commits

Author SHA1 Message Date
Thomas Orozco
7c25a6010e mononoke: UploadHgFileContents: don't buffer contents to compute a Filenode ID
Summary: This update our UploadHgFileContents::ContentUploaded implementation to not require buffering file contents in order to produce a Mercurial Filenode ID.

Reviewed By: farnz

Differential Revision: D16457833

fbshipit-source-id: ce2c5577ffbe91dfd0de1cac7d85b8d90ded140e
2019-07-31 05:19:40 -07:00
Thomas Orozco
f9360cab9d mononoke/filestore: incorporate in Mononoke
Summary:
NOTE: This isn't 100% complete yet. I have a little more work to do around the aliasverify binary, but I think it'll make sense to rework this a little bit with the Filestore anyway.

This patch incorporates the Filestore throughout Mononoke. At this time, what this means is:

- Blobrepo methods return streams of `FileBytes`.
- Various callsites that need access to `FileBytes` call `concat2` on those streams.

This also eliminates the Sha256 aliasing code that we had written for LFS and replaces it with a Filestore-based implementation.

However, note that this does _not_ change how files submitted through `unbundle` are written to blobstores right now. Indeed, those contents are passed into the Filestore through `store_bytes`, which doesn't do chunking. This is intentional since it lets us use LFS uploads as a testbed for chunked storage before turning it on for everything else (also, chunking those requires further refactoring of content uploads, since right now they don't expect the `ContentId` to come back through a Future).

The goal of doing it this way is to make the transition simpler. In other words, this diff doesn't change anything functionally — it just updates the underlying API we use to access files. This is also important to get a smooth release: it we had new servers that started chunking things while old servers tried to read them, things would be bad. Doing it this way ensures that doesn't happen.

This means that streaming is there, but it's not being leveraged just yet. I'm planning to do so in a separate diff, starting with the LFS read and write endpoints in

Reviewed By: farnz

Differential Revision: D16440671

fbshipit-source-id: 02ae23783f38da895ee3052252fa6023b4a51979
2019-07-31 05:19:40 -07:00
Pedro Rittner
e62faa2130 tp2/rust: add lettre and riker to rust-crates-io
Summary:
Adding [lettre](https://crates.io/crates/lettre) and [riker](https://crates.io/crates/riker).

Followed procedure in [the wiki](https://our.intern.facebook.com/intern/wiki/Rust-at-facebook/updating-rust/).

Note that there were [some changes in the upstream url 2 crate](7f1bd6ce1c (diff-2c09afcdc3c420ab0678ba9b5e83959cR22)) that necessitated some changes to Mononoke's URL parsing.

Reviewed By: fanzeyi

Differential Revision: D16465163

fbshipit-source-id: e889b8cfa27fef3e99c1fa0454d4f47115ae08b7
2019-07-24 20:04:48 -07:00
Thomas Orozco
63bc3b6331 mononoke: Mercurial types: Manifest Entry: return u64 for get_size()
Summary: The size of entries isn't related to our local pointer size. This updates that.

Reviewed By: StanislavGlebik

Differential Revision: D16336407

fbshipit-source-id: 2f500c54d218d81f06ba0827bd72ad8be1192b9d
2019-07-18 02:30:59 -07:00
Stanislau Hlebik
1270d709a8 mononoke: remove Logger from BlobRepo
Summary:
It's used only in a very few places, and most likely that's by accident. We
pass logger via CoreContext now

Reviewed By: krallin

Differential Revision: D16336953

fbshipit-source-id: 36ea4678b3c3df448591c606628b93ff834fae45
2019-07-17 08:31:56 -07:00
David Tolnay
fed2ac83f4 rust: Head start on some upcoming warnings
Summary:
This diff sets two Rust lints to warn in fbcode:

```
[rust]
  warn_lints = bare_trait_objects, ellipsis_inclusive_range_patterns
```

and fixes occurrences of those warnings within common/rust, hg, and mononoke.

Both of these lints are set to warn by default starting with rustc 1.37. Enabling them early avoids writing even more new code that needs to be fixed when we pull in 1.37 in six weeks.

Upstream tracking issue: https://github.com/rust-lang/rust/issues/54910

Reviewed By: Imxset21

Differential Revision: D16200291

fbshipit-source-id: aca11a7a944e9fa95f94e226b52f6f053b97ec74
2019-07-12 00:56:44 -07:00
Simon Farnsworth
4fd31beaa2 Remove VisitedPruner completely
Summary: It's a footgun, as its memory use is bounded by the size of the repo, so it's almost never what you really want, but instead a band-aid over a deeper problem.

Reviewed By: StanislavGlebik

Differential Revision: D16132084

fbshipit-source-id: 12683801652509ebb09881595768d640df0b7490
2019-07-08 03:50:56 -07:00
Greg Cowan
041770b090 Transition fbcode Rust crates to 2018 edition
Summary: Marking all Cargo.tomls in fbcode as 2018 edition.

Reviewed By: jsgf

Differential Revision: D15951175

fbshipit-source-id: edf18449c214ee1ff285d6a2cb61839aaf58a8cd
2019-06-24 13:15:17 -07:00
Pavel Aslanov
7c7e084825 Convert MPathElement to a newtype around Bytes
Summary: We are copying `MPath` a lot, this change should reduce amount of allocations and memory reuse for `MPath`

Reviewed By: farnz

Differential Revision: D15939495

fbshipit-source-id: 8da8f2c38f7b46f27d0df661210c9964aed52101
2019-06-21 15:40:55 -07:00
Johan Schuijt-Li
02a82f4f0b types: speed up hex encode and decode
Summary:
Hex encoding and decoding is in the hot path for gettreepacks, particularly
when we have large fetches (for example with clones), we can easily do this in
the order of tens or hundreds of thousands.

Switch to using a SSE/AVX2 optimized hex encoding/decoding which results in
a 10x performance improvement for decoding. Encoding was already using a
relatively optimized version, so gain is expected to be much lower for encoding.

Reviewed By: farnz

Differential Revision: D15940209

fbshipit-source-id: 28734f45f7508a94b110e25c01e1baa955ebd4e4
2019-06-21 10:48:46 -07:00
Pavel Aslanov
a0a3a421f2 make HgEntryId an enum
Summary: `HgEntryId` is much more useful in a typed from (enum of `(FileType, HgFileNodeId)` and `HgManifestId`), most of the time we now which type entry should contain and it makes it harder to make and error, all other use cases which require just hash should use `HgNodeHash` instead. This diff includes minimal changes which are necessary to make it work. Some of the cases which do sequence of `Entry::get_hash().into_nondehash() -> HgManifestId::new() | HgFileNodeId::new()` are left for future diffs.

Reviewed By: farnz

Differential Revision: D15866081

fbshipit-source-id: 5be9ecc30dbfd0a49ae6c5d084cdfe2dac351dac
2019-06-18 11:11:52 -07:00
Zeyi (Rice) Fan
6bc1af095d update to Rust 1.34.0
Reviewed By: jsgf

Differential Revision: D14963608

fbshipit-source-id: 550d63cd10c52e8bcbb25137bc29811955da0b20
2019-05-21 12:25:14 -07:00
Stefan Filip
74255bb6d9 types: update history entry to use RepoPath
Summary: Refactoring

Reviewed By: quark-zju

Differential Revision: D14877540

fbshipit-source-id: c275c335ffe89ebf2fa1229925b1db2015374659
2019-05-21 12:25:10 -07:00
Thomas Orozco
cf6cd664fa remove HgNodeHash from HgChangesetEnvelopeMut
Summary: This removes HgNodeHash (and uses HgChangesetId instead) in HgChangesetEnvelopeMut.

Reviewed By: StanislavGlebik

Differential Revision: D14855029

fbshipit-source-id: c1f343870e18266ae3e636c1b36dfa05fce00bd3
2019-05-21 12:25:06 -07:00
Pavel Aslanov
a257f82f7c remove some extern crates and #[macro_use]
Summary:
Convert to `2018` version and remove `#[macro_use]` and `extern crate` from following folders:
- blobrepo
- blobstore
- mercurial_types
- mononoke_types

Reviewed By: StanislavGlebik

Differential Revision: D14827294

fbshipit-source-id: 4b8a2edb5d9ad1fe75083e172cd0da359fa6dc2e
2019-05-21 12:25:03 -07:00
Stanislau Hlebik
eb67262de4 mononoke: return HgEntryId in find_path_in_manifest
Summary:
It's cheap so let's return it. It will be used in the next diffs

Context:
There are some commit cloud commits that take ages to compute. For some reason
commit cloud sends too many manifests, which mononoke doesn't filter out and
does a lot of unnecessary checks, which take ages. This stack fixes it.

Reviewed By: farnz

Differential Revision: D14666306

fbshipit-source-id: 75e39f7d88e139f3558825faec5d4e94f6987050
2019-05-21 12:24:57 -07:00
Arun Kulshreshtha
cb1ef172ff Add batch data fetching endpoints for Eden API
Summary: Add new API server endpoints for performing batch fetches of data and history. The requests and responses are currently serialized as JSON, though the format can be trivially changed later to something like CBOR (or any other format supported by serde).

Reviewed By: xavierd

Differential Revision: D14573735

fbshipit-source-id: ac46aa8a55db44b695c53f9e32cc4ea2e17504c8
2019-05-21 12:24:56 -07:00
Stanislau Hlebik
34e77e6d94 mononoke: append metadata in getpackv1
Summary:
getpackv1 needs to return copy metadata together with the content. This diff
fixes it

Reviewed By: kulshrax

Differential Revision: D14668319

fbshipit-source-id: 56a6ea2eb3a116433446773fa4fbe1f5a66c5746
2019-05-21 12:24:53 -07:00
Laurence Emms
491abcd4a8 Removed HgNodeHash from known()/lookup()/heads()/between() methods in
Summary:
Removed references to HgNodeHash in repo_client in the specified functions. In
addition, updated other files due to type related dependencies.

Reviewed By: StanislavGlebik

Differential Revision: D14543934

fbshipit-source-id: b0d860fe7085ed4b91a62ab1e27fb2907a642a1d
2019-05-21 12:24:52 -07:00
Arun Kulshreshtha
4e019aff10 types: rename LooseHistoryEntry and PackHistoryEntry
Summary: `LooseHistoryEntry` and `PackHistoryEntry` aren't the best names for these types, since the latter is what most users should use, whereas the former should only typically used for data transmission. As such, we should rename these to clarify the intent.

Differential Revision: D14512749

fbshipit-source-id: 5293df89766825077b2ba07224297b958bf46002
2019-03-18 19:49:12 -07:00
Stanislau Hlebik
2e7a787a11 mononoke: handle getpackv1 request on Mononkoe
Summary:
The diff adds support for getpackv1 request. Supporting this request is
necessary because hg client will stop using getfiles soon.

There are two main differences between getfiles and getpackv1. getfiles returns
loose files formats, while getpackv1 returns wirepack pack file (same format as
used by gettreepack). getpackv1 supports fetching more than one filenode per
file.

Differential Revision: D14404234

fbshipit-source-id: cfaef6a2ebb76da2df68c05e838d89690f56a9f0
2019-03-15 11:52:38 -07:00
Igor Abramov
a70e6d30c6 mononoke: remove HgNodeHash from hook_tailer
Summary: Replacing the usage of deprecated HgNodeHash with HgChangesetId.

Reviewed By: StanislavGlebik

Differential Revision: D14455700

fbshipit-source-id: 326f6b3bcea67062769093c037306f9a21bbbfa4
2019-03-14 14:22:08 -07:00
Stanislau Hlebik
e6c8ef00aa mononoke: fix computing of changed files
Summary:
The problem was in using `file_changes()` of a bonsai object. If a file
replaces a directory, then it just returns an added file, but not a removed
directory.

However `changed_entry_stream` didn't return an entry if just it's mode was changed (i.e. file became executable, or file became a symlink). This diff fixes it as well

Let's use the same computing changing files method instead of `file_changes()`.

Differential Revision: D14279470

fbshipit-source-id: 976b0abd93646f7d68137c83cb07a8564922ce17
2019-03-08 06:28:49 -08:00
Kostia Balytskyi
e561682ecd mononoke: rename crates to contain underscores instead of dashes
Summary: Let's not use dashes in crate names.

Reviewed By: StanislavGlebik

Differential Revision: D14341596

fbshipit-source-id: 85a7ded60cf2e326997ac70ee47a29116af97590
2019-03-06 07:18:28 -08:00