Commit Graph

311 Commits

Author SHA1 Message Date
Stanislau Hlebik
9ba06ebc3c asyncmemo: remove entry with the same key before inserting new one
Summary:
There was a bug when if the entry with the same key is present in the hash and
the hash is full, then some entry will be evicted even though it's not
necessary.
It adds one hash map lookup, but it shouldn't be a big problem

Reviewed By: jsgf

Differential Revision: D6702001

fbshipit-source-id: 1c8cadc5e4bad6f6d95279b21edf00ed99f62c49
2018-01-19 01:10:27 -08:00
Xiaotian Wu
2c4d93ceb8 modify entryid related code
Summary: modify entryid code

Reviewed By: lukaspiatkowski

Differential Revision: D6722202

fbshipit-source-id: 1df45071709f4a425374a87a29553830071b5d2d
2018-01-16 07:57:25 -08:00
Xiaotian Wu
92c0528b1f modify manifestid related code
Summary: nodehash -> manifestid

Reviewed By: lukaspiatkowski

Differential Revision: D6719378

fbshipit-source-id: 1ec59b33270e389da8e74b3864c37a86c9d89f81
2018-01-16 07:57:25 -08:00
Xiaotian Wu
ed94c6702c modify changesetid related code
Summary: modify the parameter type

Reviewed By: lukaspiatkowski

Differential Revision: D6695443

fbshipit-source-id: fafcdc83773cb86c08cdcf3a8d80c1c9a498eca5
2018-01-16 07:57:25 -08:00
Xiaotian Wu
7a3ef80526 add changesetid/manifestid/entryid structure
Summary: add wrapper for nodehash

Reviewed By: lukaspiatkowski

Differential Revision: D6694937

fbshipit-source-id: c1c79fd8fb37d40211b84341105af1d6fa155708
2018-01-16 07:57:24 -08:00
Lukas Piatkowski
70244ff1d6 hgproto: nearly end-to-end support for handling protocol in streaming fashion
Reviewed By: jsgf

Differential Revision: D6494647

fbshipit-source-id: e685b33a35f49365d2cfa89491b1566cfcc75118
2018-01-15 10:36:32 -08:00
Lukas Piatkowski
0d8cc77882 future-ext: introduce ByteStream for efficient processing stream of bytes
Reviewed By: jsgf

Differential Revision: D6494542

fbshipit-source-id: d069137326697105a402261e4fbe69ab95ade67e
2018-01-15 10:36:32 -08:00
Lukas Piatkowski
5185252a8b mercurial_bundles: make Bundle2Stream sendable across threads
Reviewed By: farnz

Differential Revision: D6612214

fbshipit-source-id: 4dc672f2f1f31c516e4e2c7c58de5cbade61db61
2018-01-15 10:36:32 -08:00
Lukas Piatkowski
8244a3c4b5 mercurial_bundle: return remaining data as last item of stream
Reviewed By: jsgf

Differential Revision: D6601718

fbshipit-source-id: 34019701bda3e187ce77a85ef04fef5d726d2286
2018-01-15 10:36:31 -08:00
Lukas Piatkowski
2e25098dc0 async-compression: add support for gzip format
Reviewed By: jsgf

Differential Revision: D6567611

fbshipit-source-id: 5aad3e11659c0f2cd135496f627180a1e7cce41c
2018-01-15 10:36:31 -08:00
Lukas Piatkowski
533cad062f futures-ext: remove FramedStream and replace it's usages with tokio_io::codec::Framed
Summary: The Framed and FramedParts duet fits following diffs a bit better than FramedStream and ReadLeadingBuffer.

Reviewed By: jsgf

Differential Revision: D6567554

fbshipit-source-id: 88d117ad9e8227f9de278037b333da7ffc4fdf1f
2018-01-15 10:36:31 -08:00
Lukas Piatkowski
f59d6a1c8b async-compression: make sure decompression is framed and won't overread it's input
Summary:
- Added test for checking if decompressing isn't overreading it's input
  - As a result removed ZSTD decompression which is overreading input
- Changes in decompression code propagated usage of BufRead in bundle2 parsing code
  - As a result a bug in OuterDecoder was found where the buf was not consumed if the header value is "0"

Reviewed By: jsgf

Differential Revision: D6557440

fbshipit-source-id: 89a9f4c8790017c5b86d28d467e45f687d7323f6
2018-01-15 10:36:31 -08:00
Lukas Piatkowski
35e3c19f1c async-compression: remove the no-compression compressor/decompressor
Summary:
The no-compression decompressor cann't provide framing as other decompressors, so a safe approach would be not to have it at all.
I replaced occurances of no-compression with `Either` reader that seem to be a pattern present in the community (f.e. `futures::future::Either` or `itertools::Either`)

Reviewed By: jsgf

Differential Revision: D6555922

fbshipit-source-id: 998dafab8d9b2f00d058ce2f9e0aced76cf15b4e
2018-01-15 10:36:31 -08:00
Simon Farnsworth
ebafde00b0 Remove Repo trait completely
Summary:
We're never going to serve RevlogRepo in production, and we're down to
a single BlobRepo type that will have different backing stores. Remove the
unused trait, and use BlobRepo everywhere bar blobimport and repo_config
(because we previously hardcoded revlog here - we want to change to a BlobRepo
once blobimport is full-fidelity).

Reviewed By: jsgf

Differential Revision: D6596164

fbshipit-source-id: ba6e76e78c495720792cbe77ae6037f7802ec126
2018-01-15 06:37:27 -08:00
Siddharth Agarwal
df1590c586 updates for rustfmt 0.3.4
Summary:
One config option is now obsolete, and the other one got renamed.

(Note: this ignores all push blocking failures!)

Reviewed By: farnz

Differential Revision: D6668021

fbshipit-source-id: aff949662a9584b7aead3f571512787aa1e9a260
2018-01-05 12:07:01 -08:00
Stanislau Hlebik
1417398de8 mononoke: move ssl config options to the separate toml config section
Summary: It removes a bit of copy-pastes code

Reviewed By: sid0

Differential Revision: D6627250

fbshipit-source-id: b110dcad998a240b6da60bc3347c7c5c0370aae0
2018-01-04 07:36:34 -08:00
Stanislau Hlebik
15d23af540 mononoke: get rid of filesblob state
Summary:
It won't be used in prod anyway, and for local use rocksdb blob state is still
preferable

Reviewed By: sid0

Differential Revision: D6627197

fbshipit-source-id: d9ca55b0221c050e8e8e35914aff22906198874a
2018-01-04 07:36:34 -08:00
Siddharth Agarwal
886e67bad2 integration: allow running a subset of tests
Summary: integration_runner.py now takes test arguments.

Reviewed By: jsgf

Differential Revision: D6607064

fbshipit-source-id: ed8271b67e76bebe92bca3931fc3620aaf577b51
2018-01-01 17:52:36 -08:00
Siddharth Agarwal
64e5182680 fix test-init.t
Summary:
The test wasn't waiting for the Mononoke server to be available. Also
improve the error message slightly.

Reviewed By: jsgf

Differential Revision: D6606102

fbshipit-source-id: d0fde39aef8b3423fd1a8996a01f12e8a9661597
2018-01-01 17:52:36 -08:00
Siddharth Agarwal
c6d65b47b0 wirepack: support for encoding data entries
Summary:
This is very similar to the support for encoding history entries in the
previous patch. The NULL_HASH wart makes it a little annoying to deal with.

We need to be able to compute how many bytes a delta has efficiently -- add a
function and tests for that as well.

Reviewed By: jsgf

Differential Revision: D6589117

fbshipit-source-id: e3a05672e1e8f455a2e95b30418468d1e3254407
2018-01-01 17:52:36 -08:00
Siddharth Agarwal
f6610ae558 thrift: extract SizeCounter to a separate crate
Summary:
This counter is generally quite useful, so extract it into a location
where Mononoke can also use it.

Also add ShipIt and corresponding license linter rules for this.

Reviewed By: jsgf

Differential Revision: D6600409

fbshipit-source-id: ce63d718ca259ac30d2ed77e72004fb83158f818
2018-01-01 17:52:35 -08:00
Stanislau Hlebik
45f1fbdd4e asyncmemo: use spawn() in tests
Summary:
In the next diff we'll `task::current()` inside MemoFuture. It fails if no
task exists. Let's use spawn to create a Task for each future.

Reviewed By: jsgf

Differential Revision: D6611510

fbshipit-source-id: 95a825dff9714579e9b16e74f355c54d8fa83a24
2017-12-22 03:41:22 -08:00
Stanislau Hlebik
79c6006853 rust: asyncmemo rustfmt
Summary: rustfmt

Reviewed By: jsgf

Differential Revision: D6611512

fbshipit-source-id: 84c8306015e961ea283341fc1a52c153f3db2a49
2017-12-22 03:41:22 -08:00
Stanislau Hlebik
e734b3f9be asyncmemo: fix hash size calculation
Summary: Previously inserting the same key twice will add size of this key twice.  This diff fixes it.

Reviewed By: jsgf

Differential Revision: D6602501

fbshipit-source-id: eb8f785296945bca1df4b6cd33bd3050a48e2174
2017-12-22 03:41:22 -08:00
Siddharth Agarwal
0616b6ec4c wirepack: support for encoding history entries
Summary:
This is the opposite of decode. Encode -> decode trips are also easily
testable, which is nice.

Reviewed By: jsgf

Differential Revision: D6586165

fbshipit-source-id: 9300844da5c3210cfbe4b6a3c98c6429d33ccbcb
2017-12-18 22:08:38 -08:00
Siddharth Agarwal
17a6667058 wirepack: represent entry counts as u32, not usize
Summary:
This is what we get or send over the wire, so while encoding we don't have to
check whether the value is in bounds.

Reviewed By: jsgf

Differential Revision: D6596025

fbshipit-source-id: 57fcefbe3545a1af4c4c4ea24350e636860d2392
2017-12-18 22:08:38 -08:00
Siddharth Agarwal
006b974208 wirepack: initial quickcheck support
Summary:
This just adds a basic verification test for now. Roundtrip tests are coming up
in future diffs.

Reviewed By: jsgf

Differential Revision: D6585421

fbshipit-source-id: 1f38366f658324447dbe5634afb04080aad91cd3
2017-12-18 22:08:37 -08:00
Siddharth Agarwal
af8e56d459 wirepack: support for verifying data entries
Summary:
The only verification that needs to be done is for if the delta base
is null.

Also move a rustfmt_skip attribute to the smallest piece of code that it needs to
apply to.

Reviewed By: jsgf

Differential Revision: D6589118

fbshipit-source-id: 287c94871ed30d196c9eaa673cfd7c7f0dd6ed93
2017-12-18 22:08:37 -08:00
Siddharth Agarwal
06f88ad102 wirepack: support for verifying history entries
Summary:
The encoding code is going to use this to ensure that it isn't getting invalid
data.

Reviewed By: jsgf

Differential Revision: D6585201

fbshipit-source-id: f7ca749d9d0a8862621816e362add7546ca413c5
2017-12-18 22:08:37 -08:00
Siddharth Agarwal
e46ec63724 mercurial-types: allow converting strs to MPaths and RepoPaths
Summary:
This allows (actually forces) us to drop a bunch of `as_ref` calls. It also
makes upcoming diffs look cleaner.

Reviewed By: jsgf

Differential Revision: D6585202

fbshipit-source-id: a53902696cf12050a851c30b557aeefe09c41903
2017-12-18 22:08:37 -08:00
Siddharth Agarwal
b19c342737 mercurial-types: add a way to generate non-empty paths
Summary:
Add an intrinsic method that acts as an `Arbitrary::arbitrary` implementation
with parameters. The one parameter we have for now is `empty_allowed`, which stands
for whether empty components can be generated.

Reviewed By: jsgf

Differential Revision: D6584040

fbshipit-source-id: 2005e1a77b1bd53294c4386259847a3a113f8f8f
2017-12-18 22:08:37 -08:00
Siddharth Agarwal
961a7d5876 wirepack: return history metadata as a separate stream entry
Summary:
While encoding a wirepack, the entry count for a single filename needs to be
encoded upfront. To avoid buffering in the packer (upcoming diffs), turn this into a stream
entry. The packer will verify that the actual items on the stream match the
entry count provided upfront.

Also remove the path since the caller can now keep track of the current path,
and in that way avoid a path clone for each entry.

Reviewed By: jsgf

Differential Revision: D6577181

fbshipit-source-id: 577bdb9b5fc1a3fadb9b5f7ab4b312afce823ed8
2017-12-18 22:08:37 -08:00
Siddharth Agarwal
2c4674595c wirepack: move code to decode history and data entries into module
Summary:
This will let us write roundtrip tests once encoding is done in an upcoming
diff.

Reviewed By: StanislavGlebik

Differential Revision: D6576990

fbshipit-source-id: 46cbaf4654bc1fd6d1f90351bbbdfd41234a00c7
2017-12-15 12:27:03 -08:00
Stanislau Hlebik
a095cc23da mononoke: add treenode_simple method
Summary:
Fetching file sizes is very expensive - it's one more round-trip to the
blobstore.
Add method that returns tree content, but doesn't fetch blob sizes.

Reviewed By: jsgf

Differential Revision: D6545108

fbshipit-source-id: 3d335eafa9dc367fb9e607f5c147b7e5c37cf133
2017-12-15 10:37:42 -08:00
Stanislau Hlebik
5b262b5db2 mononoke: fix eden-server scuba logging
Summary:
1) Use correct column for elapsed time
2) Add reponame column
3) Add hostname column

Reviewed By: jsgf

Differential Revision: D6534594

fbshipit-source-id: a6aebcb2b5a4080090e45a65303e43eba6ffbe37
2017-12-13 07:51:00 -08:00
Stanislau Hlebik
5c43ec42c7 mononoke: add --inmemory-logs-capacity option
Summary:
Adds an option that sets the number of filelogs and revlogs that will be loaded
in memory. That let's us use blobimporting in memory constrained
enviroments.

Reviewed By: jsgf

Differential Revision: D6532734

fbshipit-source-id: b748478ec80e75f56a8e07ae1532b0d69c4a5e16
2017-12-13 06:58:24 -08:00
Lukas Piatkowski
db7b41429f mercurial_bundle: bugfix for prematurely closing Compression AsyncRead
Summary:
When using forward/send_all on a Sink it is being flushed and closed, this means that if we call forward multiple times on a Sink it might fail if the underlying IO is already closed.
For ZSTD compression it didn't mattered, because it doesn't use the close/finish, but for other compressions it does.

Reviewed By: jsgf

Differential Revision: D6545343

fbshipit-source-id: 079d950f34716d621dd1fabda4f97d58d0e1d02d
2017-12-13 04:51:43 -08:00
Simon Farnsworth
4d6f3fa51b Remove generics from Linknode
Summary:
Like the other  BlobState components, Linknode was too generic -
reduce down to a practical set for live implementations.

Error handling is not great here or in Bookmarks, but I'm going to await the
decision on moving to Failure before I improve it.

Reviewed By: jsgf

Differential Revision: D6459012

fbshipit-source-id: 00314309f62ba070b5908a28f5174a31b6dd0d84
2017-12-11 07:05:53 -08:00
Simon Farnsworth
28caf3f938 Remove Error, GetBlob and PutBlob from BlobStore
Summary:
Remove the last associated types from BlobStore - this means that
BlobStore now has an associated trait object type.

Reviewed By: jsgf

Differential Revision: D6425414

fbshipit-source-id: 7186dab9b56593dd1d70be732d4ad56d1e7b3c63
2017-12-11 07:05:53 -08:00
Jeremy Fitzhardinge
771841cc96 mononoke: convert hgcli to failure
Summary: hgcli got overlooked on the first pass

Reviewed By: kulshrax

Differential Revision: D6507716

fbshipit-source-id: 7750000d9f11d4616185eccdaaf978b629ce1733
2017-12-07 14:10:17 -08:00
Jeremy Fitzhardinge
ac31713c84 rust: failure cleanup pass
Summary:
Don't use failure's bail!() and ensure!() macros.

Instead, failure_ext provides:
- bail_err!(err) - Converts its single parameter to the expected error and returns; ie `return Err(From::from(err));`
- bail_msg!(fmt, ...) - takes format string parameters and returns a `failure::err_msg()` error
- ensure_err!(), ensure_msg!() - corresponding changes

Also:
- remove all stray references to error-chain
- remove direct references to failure_derive (it's reexported via failure and failure_ext)
- replace uses of `Err(foo)?;` with `bail_err!()` (since `bail_err` unconditionally returns, but `Err(x)?` does not in principle, which can affect type inference)

Reviewed By: kulshrax

Differential Revision: D6507717

fbshipit-source-id: 635fb6f8c96d185b195dff171ea9c8db9e83af10
2017-12-07 14:10:17 -08:00
Arun Kulshreshtha
05f7f59787 Add diesel to rust-crates-io
Summary: Add diesel (a SQL ORM crate) to rust-crates-io in tp2.

Reviewed By: farnz

Differential Revision: D6506059

fbshipit-source-id: b132a075aa8eefee9f7d66584ee787e075361835
2017-12-07 11:22:18 -08:00
Simon Farnsworth
6ed57cea63 Learn about the treedirstate requires
Summary:
We don't read the dirstate, but treedirstate has a new repo requires
as it changes dirstate format. Learn to ignore it.

Reviewed By: jsgf

Differential Revision: D6509774

fbshipit-source-id: 46faedcece308e2ebc34d87a62d2391a68eeea38
2017-12-07 10:37:17 -08:00
Lukas Piatkowski
d75a7f1a18 hgproto: make a clear distinction between Batch and other requests
Summary: This diff also moves parsing of Batch subcommands inside sshproto where it belongs

Reviewed By: farnz

Differential Revision: D6492001

fbshipit-source-id: a31864f50e9468f360f9a30fc75fc2cfdee56169
2017-12-07 05:32:24 -08:00
Stanislau Hlebik
0cceb35e49 mononoke: select free port in the test
Summary:
Two tests can't be run simultaneously because they use the same port. This diff
fixes it.

Reviewed By: farnz

Differential Revision: D6457855

fbshipit-source-id: 3e5f82211bcd87abc608bdeab239fe680976316d
2017-12-06 07:37:23 -08:00
Stanislau Hlebik
2bf9290758 mononoke: add skip parameter to blobimport
Summary:
Make it possible to skip a number of commits.
Also change type from usize to u64, to make sure it works the same on 32-bit
platforms (although that shouldn't matter much).

Reviewed By: jsgf

Differential Revision: D6395743

fbshipit-source-id: 88a12583de2b23d4f55115d696c5398f6814c2da
2017-12-06 01:21:11 -08:00
Arun Kulshreshtha
40339c1f89 Upgrade to Rust 1.22.1
Summary:
This diff upgrades the version of rustc in fbcode to version 1.22.1,
including the requisite third-party2 symlink updates for  the `rust` and
`rust-crates-io` projects, config.py changes in the third-party2 and
third-party-buck directories, and code fixes for Rust targets in common/rust
and scm/mononoke.

Reviewed By: jsgf

Differential Revision: D6489808

fbshipit-source-id: 48377ea937916beb7dae7a3806de1fce1e29dd24
2017-12-05 18:57:32 -08:00
Jeremy Fitzhardinge
dc5e78c1c1 rust: mass convert scm/mononoke/... to use failure
Summary:
Convert scm/mononoke to use failure, and update common/rust crates it depends on as well.

What it looks like is a lot of deleted code...

General strategy:
- common/rust/failure_ext adds some things that are in git failure that aren't yet in crates.io (`bail!` and `ensure!`, `Result<T, Error>`)
- everything returns `Result<T, failure::Error>`
- crates with real error get an error type, with a derived Fail implementation
  - replicate error-chain by defining an `enum ErrorKind` where the fields match the declared errors in the error! macro
- crates with dummy error-chain (no local errors) lose it
- `.chain_err()` -> `.context()` or `.with_context()`

So far the only place I've needed to extract an error is in a unit test.
Having a single unified error type has simplified a lot of things, and removed a lot of error type parameters, error conversion, etc, etc.

Reviewed By: sid0

Differential Revision: D6446584

fbshipit-source-id: 744640ca2997d4a85513c4519017f2e2e78a73f5
2017-12-05 18:11:13 -08:00
Simon Farnsworth
b38dd81782 Make known protocol check that the commit is fully present
Summary: `changeset_exists` only checks that the changeset is in the blob store. Once we start accepting pushes, we'll also want to check that the changeset is reachable from a head. Use revsets to check this. Once we have a notion of "completeness" for changesets, we'll switch `known` to use that instead - this code is still useful as a way to go from `changeset_exists` to `changeset_complete` in bulk.

Reviewed By: jsgf

Differential Revision: D6205695

fbshipit-source-id: 7e3b5c30bc5e459feb95a20913d8a04f3fda7469
2017-12-04 11:54:53 -08:00
Simon Farnsworth
16da012250 Remove ValueIn/ValueOut from the BlobStore generic arguments.
Summary:
BlobStore is entirely generic, and puts no limits on its
implementations. Remove ValueIn and ValueOut type parameters, and insist that
all blobs are Bytes (as per production setups)

Reviewed By: StanislavGlebik

Differential Revision: D6425413

fbshipit-source-id: 455e526d8baebd0d0f1906941648acca89be4881
2017-12-04 10:22:09 -08:00