Commit Graph

1523 Commits

Author SHA1 Message Date
Lukas Piatkowski
9ff11fa3ef config: add HookConfig to pass configs in hashmap into hooks code
Summary: In this diff the configs are parsed from toml and passed around to hook's execution context. The actual usage of configs will be introduced in separate diff.

Reviewed By: StanislavGlebik

Differential Revision: D13862837

fbshipit-source-id: 60ac10aa9c25d224e703e1e55bef13dc481ba07e
2019-01-30 05:04:22 -08:00
Jun Wu
7532a39624 codemod: import from the edenscm package
Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.

Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.

Reviewed By: phillco

Differential Revision: D13868981

fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
2019-01-29 17:25:00 -08:00
Stanislau Hlebik
1f1206be3f mononoke: do not use HgNodeHash in revsets
Summary: Use bonsai changesets instead

Reviewed By: aslpavel

Differential Revision: D13860075

fbshipit-source-id: b9f48f5b01e838746b3383e0e3bb6b319a865578
2019-01-29 08:40:12 -08:00
Lukas Piatkowski
cc1568938b hooks: move them outside of the test directory to a better place
Reviewed By: StanislavGlebik

Differential Revision: D13817338

fbshipit-source-id: 866971b6631d121f4c85087db425e908a5308367
2019-01-29 08:23:04 -08:00
David Budischek
6f68946a61 Implement UnionType for Revision in Thrift parameters
Summary: This is to take the guesswork out of revisions. MononokeRevision now states explicitely whether the value is a hash or bookmark. To roll this out I will prepare an updated scmquery-proxy version, test everything on shadow. Then use the sitevar to disable mononoke usage for a short time while both apisever and scmquery-proxy are rolled out simultaneously

Reviewed By: StanislavGlebik

Differential Revision: D13817040

fbshipit-source-id: d5eee7cf9ac972fb1313a10a17bf60c4545054af
2019-01-29 03:42:28 -08:00
David Budischek
ecc1d57b46 Add thrift implementation for list_directory
Summary: Corresponds to ls_v2 on scmquery

Reviewed By: StanislavGlebik

Differential Revision: D13817075

fbshipit-source-id: 56857076c85d7592d34a20a5fa303b33be2b4a20
2019-01-29 03:42:28 -08:00
David Budischek
1945a8aa6c Fetch HgChangesets asynchronously
Summary: The first request was way too slow as the cache was not yet warm. This speeds up the initial request substentially.

Reviewed By: StanislavGlebik

Differential Revision: D13817064

fbshipit-source-id: 0f2a01395743ef848e6bc4a5e71c0562b268c0cf
2019-01-29 03:42:28 -08:00
David Budischek
2c40be3222 Add thrift endpoint for get_branches
Reviewed By: StanislavGlebik

Differential Revision: D13765974

fbshipit-source-id: 8c554ca85cde4838673fa6900a6b5643ee9a4973
2019-01-29 03:42:28 -08:00
David Budischek
da847be133 rustfmt apiserver
Summary: Ran rustfmt on the complete folder

Reviewed By: HarveyHunt

Differential Revision: D13803235

fbshipit-source-id: ccb41d7be8099055b8ea8dec57ce5e04b38b9461
2019-01-29 03:42:27 -08:00
Stanislau Hlebik
eaa5af3bc6 mononoke: remove unused Cargo.toml file
Reviewed By: ikostia

Differential Revision: D13849898

fbshipit-source-id: b787d0c8b44f35c4c58e44ec782183bdd0bdd995
2019-01-28 15:11:10 -08:00
Stanislau Hlebik
57931e59ac mononoke: remove Arc<BlobRepo> + rustfmt
Reviewed By: lukaspiatkowski

Differential Revision: D13818633

fbshipit-source-id: 98a18877ca82afb4ac38981ca2ee59cff12b99d0
2019-01-28 14:40:40 -08:00
Stanislau Hlebik
67f220c89c mononoke: fix pushrebasing an empty commit
Summary:
Previously pushrebasing an empty commit failed because we assumed that root
manifest of a commit is always sent in a bundle. This diff removes this
assumption

Reviewed By: lukaspiatkowski

Differential Revision: D13818556

fbshipit-source-id: 44e96374ae343074f48e42a90c691b21e3c41386
2019-01-28 14:40:40 -08:00
Stanislau Hlebik
4973890d63 mononoke: fix hgcli connection error in case of failures
Summary:
We've had this problem for almost a year now, and I've finally made some
progress.

The problem was in tests failing randomly with error like

```
-  remote: * pushrebase failed * (glob)
-  remote:     msg: "pushrebase failed Conflicts([PushrebaseConflict { left: MPath(\"1\"), right: MPath(\"1\") }])"
+  remote: Jan 25 08:46:24.067 ERRO Error in hgcli proxy, error: Connection reset by peer (os error 104), root_cause: Os {
+  remote:     code: 104,
+  remote:     kind: ConnectionReset,
+  remote:     message: "Connection reset by peer"
   remote: * backtrace* (glob)
```

or

```
   remote: * pushrebase failed * (glob)
   remote:     msg: "pushrebase failed Conflicts([PushrebaseConflict { left: MPath(\"1\"), right: MPath(\"1\") }])"
+  remote: Jan 25 08:47:59.966 ERRO Error in hgcli proxy, error: Connection reset by peer (os error 104), root_cause: Os {
+  remote:     code: 104,
+  remote:     kind: ConnectionReset,
+  remote:     message: "Connection reset by peer"
+  remote: }, backtrace:
```

note that the problem are slightly different. In the first case the actual error message is completely lost + we get unnecessary
ConnectionReset problem message. In the second case it's just `ConnectionReset`.

This diff fixes the problem of the lost error message (problem #1) and hides `ConnectionReset` problem (problem #2).

Problem #1 was due to a bug in streamfork. Before this diff if streamfork hit
an error, then it might have not sent already received input to one of the
outputs. This diff fixes it.

This diff just hides Problem #2. If we see a ConnectionReset then an error
won't be reported. That's a hack which should be fixed, but at the moment
a) The bug is not easily debuggable
b) The problem is not urgent and shouldn't cause problems

In some cases server actually sends Connection reset, but in that case
mercurial stil gives us self-explanatory message

```
abort: stream ended unexpectedly (got 0 bytes, expected 4
``

Reviewed By: lukaspiatkowski

Differential Revision: D13818558

fbshipit-source-id: 7a2cba8cd0fcef8211451df3dea558fe2d60fa60
2019-01-28 14:40:40 -08:00
Stanislau Hlebik
c950025387 mononoke: fix tests
Reviewed By: ikostia

Differential Revision: D13845830

fbshipit-source-id: 2423939ef02d094a2f24dbfa189e8dc4a7ee6dbd
2019-01-28 14:40:40 -08:00
Stanislau Hlebik
b9c4dadad6 mononoke: use HgChangesetId instead of HgNodeHash in bundle2-resolver
Reviewed By: aslpavel

Differential Revision: D13781547

fbshipit-source-id: 4c9cfc878518ff05551aad0bc15c9df100e2c884
2019-01-28 06:56:52 -08:00
Stanislau Hlebik
dac741fb1a mononoke: do not ignore pushrebase update
Summary:
Pushrebase wasn't returning a response to a pushkey part, and we get `server
ignored bookmark ... update` messages. This diff fixes it by returning the
reply to a pushkey part.

Note that behaviour is different from mercurial. In mercurial many pushkey
parts are allowed, while we allow only which moves `onto` bookmark. That
shouldn't be restrictive, however we can change this behaviour later if needed.

Reviewed By: aslpavel

Differential Revision: D13781546

fbshipit-source-id: edb0fdc7dc10c7a5cf4c49157fce0887e71fcf8a
2019-01-28 06:56:52 -08:00
Stanislau Hlebik
8c6bd83bfa mononoke: rustfmt
Reviewed By: HarveyHunt

Differential Revision: D13818557

fbshipit-source-id: 51e1d431036511f625f9826e85cd4c445c68b747
2019-01-25 12:26:54 -08:00
Liubov Dmitrieva
4be4e90187 optimization: add new api for phasing that allows to reuse bookmarks
Summary:
This will reduce max potential number of fetching bookmarks from O(len(longest stack)) to O(1) (with is 0 or 1) if there are draft commits.

Previously, the refetching could happen on every iteration while we are
searching for public roots.

This diff allows us to reuse the bookmarks from the first time they were needed
and has been fetched in the whole phases calculation process. Fetch just once!

If there are no draft commits bookmarks were fetched only once already (and only if needed).

Reviewed By: StanislavGlebik

Differential Revision: D13753520

fbshipit-source-id: d96a6cf434cb4a1fe95e51ae734afb1671124336
2019-01-25 10:14:42 -08:00
Liubov Dmitrieva
c7d0239bbc fix tests which were broken by changing in the order of parsing bundle2
Summary:
Resolving pushvars before commonheads breaks hooks tests (they were disabled, so didn't come up)

The order was changed in D13802402,  So, this diff changes the order as it was before and keep the remaining logic.

Reviewed By: StanislavGlebik

Differential Revision: D13817434

fbshipit-source-id: 1443b18ade7161304f8b5359e7d49dab13b022cc
2019-01-25 06:26:36 -08:00
Liubov Dmitrieva
5ff6db64ef add special pushvar to push Commit Cloud commits to Mononoke
Summary: This allows us to run pushbackup and cloud sync commands for Read Only Mononoke repos.

Reviewed By: ikostia

Differential Revision: D13804545

fbshipit-source-id: 8026fc4668afc8bb5c2c0a9587ca024e3c6920da
2019-01-25 05:26:58 -08:00
Jeremy Fitzhardinge
55c76466f3 mononoke: glusterblob: add super-simple round-trip test
Summary:
The test is ignored by default because it would probably be
flakey/slowThe test is ignored by default because it would probably be
flakey/slow.

Reviewed By: aslpavel

Differential Revision: D13795070

fbshipit-source-id: 8459d34126917e0fce3151ec2f4e68e639d2e7e6
2019-01-24 11:54:43 -08:00
Liubov Dmitrieva
610671e486 implement bypass readonly option (to be used for Commit Cloud in
Summary:
Next step is to change infinitepush / cloud sync to pass this pushvar to
Mononoke

Reviewed By: StanislavGlebik

Differential Revision: D13802402

fbshipit-source-id: 25e3d699bd934e3e015b9784040bd2dc4b43188d
2019-01-24 08:50:27 -08:00
Liubov Dmitrieva
abe70d4324 move Send + Sync to the trait for LeastCommonAncestorsHint
Summary: This hint is passed to many places, so it reduces the code.

Reviewed By: StanislavGlebik

Differential Revision: D13802159

fbshipit-source-id: 891eef00c236b2241571e24c50dc82b9862872cc
2019-01-24 07:59:46 -08:00
Lukas Piatkowski
6466a8806e blobstore healer: join related data in GetRangeOfEntries
Reviewed By: StanislavGlebik

Differential Revision: D13671621

fbshipit-source-id: 7e4e643e6bff83ed88c616d4bf659a3dce69f3a4
2019-01-24 04:32:37 -08:00
Pavel Aslanov
8232ba03da added: tw_handle to logged scuba samples
Summary: Added tw_handle to be able to distinguish source of samples

Reviewed By: ikostia

Differential Revision: D13800968

fbshipit-source-id: 6c8528fc69302b2d5c5fbd40ccdf729c9379a101
2019-01-24 04:03:39 -08:00
Jeremy Fitzhardinge
23c154fcd4 mononoke: add stats to glusterblob
Summary: Simple stats for put/get/is_present so we can monitor basic functionality.

Reviewed By: StanislavGlebik

Differential Revision: D13736062

fbshipit-source-id: 1fd6def0d98d9d29dfbbf11430006b91936d35dc
2019-01-23 22:28:57 -08:00
Jeremy Fitzhardinge
91d83f2b19 mononoke: convert glusterblob to Rust 2018
Summary:
Use rustfix and some hand-editing to convert to Rust 2018 - main
benefit is the elimination of a lot of `extern crate` lines.

Reviewed By: HarveyHunt

Differential Revision: D13736087

fbshipit-source-id: 50e4edfdff3e8ceea94b2beed36399681871a436
2019-01-23 22:28:57 -08:00
Andrey Malevich
0c8edd40f5 Revert D13575719: [tp2] Update zstd to 1.3.8 as 1.3.x
Differential Revision:
D13575719

Original commit changeset: eb7961078ad1

fbshipit-source-id: 844414e83f8a05df89a21dc1c2a6b9e60bad5dcc
2019-01-23 18:18:55 -08:00
Stanislau Hlebik
a83bc8fee3 mononoke: decrease the number of connections for sharded db
Reviewed By: HarveyHunt

Differential Revision: D13784695

fbshipit-source-id: 0afaac5357776119f88fc3f466e4cd799a63c9c9
2019-01-23 12:15:38 -08:00
Nick Terrell
422784684e Update zstd to 1.3.8 as 1.3.x
Summary: Update zstd in TP2 to zstd-1.3.8.

Reviewed By: pixelb

Differential Revision: D13575719

fbshipit-source-id: eb7961078ad161eb633b08b7e80e87f1c63ccca5
2019-01-23 11:15:45 -08:00
Johan Schuijt-Li
25df607aed do not init cachelib for aliasverify during integration tests
Reviewed By: StanislavGlebik

Differential Revision: D13781478

fbshipit-source-id: 03396ca0987e84c78583b3c5445429efa15be64e
2019-01-23 08:00:55 -08:00
Johan Schuijt-Li
3d1463231a disable authorization verification hook for import
Reviewed By: StanislavGlebik

Differential Revision: D13770727

fbshipit-source-id: 8830c63124bc12a40ffe624110d23a3713cad680
2019-01-23 08:00:55 -08:00
Liubov Dmitrieva
dbade135c8 add initial simple integration test for hgmn cloud sync
Summary: This is the cloud sync test with local (on disk) commit cloud backend and mononoke backend.

Reviewed By: markbt

Differential Revision: D13762527

fbshipit-source-id: c454dbf67999333e37a54e5e6ac84c3cebcf8c3b
2019-01-22 08:53:43 -08:00
Liubov Dmitrieva
7e377f952a extra test for phases (more sophisticated)
Summary: This test covers corner case (partially public stacks)

Reviewed By: StanislavGlebik

Differential Revision: D13750852

fbshipit-source-id: cd1a5a84dfb62951cb37f1fbdd6c510d825adb41
2019-01-22 05:58:46 -08:00
Liubov Dmitrieva
23b3931529 add phases calculation for public roots
Summary:
this is required to cover corner cases when client has some stacks and part of those became public

calculation for public roots happen for draft heads only, it doesn't change performance of hg pull

Reviewed By: StanislavGlebik

Differential Revision: D13742685

fbshipit-source-id: d8c8bc357628b9b513bbfad4a82a7220d143f364
2019-01-22 05:58:46 -08:00
David Budischek
bb4284e428 Add thrift support for get_commit_v2
Summary: Create the corresponding endpoint for thrift calls to get_commit_v2. For now this only supports the non optional fields.

Reviewed By: StanislavGlebik

Differential Revision: D13730602

fbshipit-source-id: fd9d845620c864bf7dade13d810e98270425ea00
2019-01-22 03:32:48 -08:00
Stanislau Hlebik
bacf9f2d64 mononoke: update skiplist building
Summary:
Previously we rely on CachingChangesetFetcher to quickly fetch all commits into
memory, but CachingChangesetFetcher was deleted in D13695201. Instead let's use
`get_many()` method from Changesets trait to quickly fetch many changesets at
once into memory.

Reviewed By: lukaspiatkowski

Differential Revision: D13712783

fbshipit-source-id: 12e8fa148f7989028547ac8d374438e23b44b6d1
2019-01-21 12:58:44 -08:00
Stanislau Hlebik
3072d0ea6a changesets: add get_many method
Summary:
The primary motivation for this method is to quickly build skiplist indexes
(see next diff). Building skiplists is much faster if all the data is in
memory.

Reviewed By: lukaspiatkowski

Differential Revision: D13712784

fbshipit-source-id: 716dc020a49cbffac273eb466e474ed86887927d
2019-01-21 12:58:44 -08:00
Pavel Aslanov
3a44162690 added: multiplexed blobstore scuba logging
Summary:
- Added scuba logging for put/get operation of `MultiplexedBlobstore`
- Added `blobstore_scuba_table` configuration field

Reviewed By: StanislavGlebik

Differential Revision: D13732064

fbshipit-source-id: 9ac0e31f9e1773321b2a7a4d8d561cce9289944b
2019-01-21 10:04:41 -08:00
Arthur Kushka
aa4a1deb0a Back out "Improved internal representation of GetbundleArgs.bundlecaps"
Summary: mononoke: Original commit changeset: 6cb5124c7893

Reviewed By: StanislavGlebik

Differential Revision: D13751021

fbshipit-source-id: b80da7ebbaaca3324078efda15704c185050b35f
2019-01-21 07:43:26 -08:00
Liubov Dmitrieva
234c33a241 populate phases table in blobimport
Summary:
We decided to populate phases table in 2 places: blobimport and push-rebase
(alredy done).

This diff is for blobimport. We know the commits are public.

Reviewed By: lukaspiatkowski

Differential Revision: D13731900

fbshipit-source-id: b64e5643e7cffd9e8fb842e9929f4c1ee7a66197
2019-01-21 07:02:15 -08:00
Arthur Kushka
21048bd300 Improved internal representation of GetbundleArgs.bundlecaps
Summary: Implemented advanced parser to parse bundlecaps json object into more suitable to work datastructure.

Reviewed By: aslpavel

Differential Revision: D13602738

fbshipit-source-id: 9a2f8e78d55a21e80229aae23e5a38f6cc14c7e8
2019-01-21 02:39:04 -08:00
David Budischek
58d812ec0f Enable logging for thrift calls to apiserver
Summary: Log all thrift calls to scuba. Since the params are in thrift format we log them both in json and human readable format (e.g. path is binary thus not really readable in json format). In addition both http and thrift now log the request type.

Reviewed By: StanislavGlebik

Differential Revision: D13730245

fbshipit-source-id: 3419ec067a9066e181210d184195fbd02980c1e0
2019-01-21 01:09:18 -08:00
Arun Kulshreshtha
6810d7d835 Change Arc<BlobRepo> to BlobRepo
Summary: `BlobRepo` is cheaply clonable and doesn't need to be `Arc`'d.

Reviewed By: StanislavGlebik

Differential Revision: D13726727

fbshipit-source-id: 0b983c7c4625f47df8a11da5781b7777cc38d72f
2019-01-18 11:37:37 -08:00
Arun Kulshreshtha
32de06a0be Convert to Rust 2018
Summary: Convert this crate to Rust 2018 Edition.

Reviewed By: StanislavGlebik

Differential Revision: D13726726

fbshipit-source-id: 28670ef543ee18635b3cfca7e6fb8e4ed4f0832f
2019-01-18 11:37:37 -08:00
Stanislau Hlebik
b909f2bc9c mononoke: per wireproto command timeout
Summary:
Previously we had a timeout per session i.e. multiple wireproto command will
share the same timeout. It had a few disadvantages:

1) The main disadvantage was that if connection had timed out we didn't log
stats such as number of files, response size etc and we didn't log parameters
to scribe. The latter is even a bigger problem, because we usually want to
replay requests that were slow and timed out and not the requests that finished
quickly.

2) The less important disadvantage is that we have clients that do small
request from the server and then keep the connection open for a long time.
Eventually we kill the connection and log it as an error. With this change
the connection will be open until client closes it. That might potentially be
a problem, and if that's the case then we can reintroduce perconnection
timeout.

Initially I was planning to use tokio::util::timer to implement all the
timeouts, but it has different behaviour for stream - it only allows to set
per-item timeout, while we want timeout for the whole stream.
(https://docs.rs/tokio/0.1/tokio/timer/struct.Timeout.html#futures-and-streams)
To overcome it I implemented simple combinator StreamWithTimeout which does
exactly what I want.

Reviewed By: HarveyHunt

Differential Revision: D13731966

fbshipit-source-id: 211240267c7568cedd18af08155d94bf9246ecc3
2019-01-18 08:35:52 -08:00
Stanislau Hlebik
cf3b9b55eb mononoke: rustfmt
Reviewed By: HarveyHunt

Differential Revision: D13731965

fbshipit-source-id: 670f633baebed1d508a55d57e46f3ae4cd42b7d2
2019-01-18 08:35:52 -08:00
Stanislau Hlebik
b595edc7b7 mononoke: record Mononoke session UUID to wireproto
Reviewed By: HarveyHunt

Differential Revision: D13716732

fbshipit-source-id: d629ae09be0f708586f2a576e1fc11db9f276f93
2019-01-18 08:35:52 -08:00
Stanislau Hlebik
ca189b4865 mononoke: rustfmt
Reviewed By: HarveyHunt

Differential Revision: D13730321

fbshipit-source-id: 706f2723f1156b730f10ba819c41a983a41655d6
2019-01-18 03:15:58 -08:00
Liubov Dmitrieva
f1f34171f2 infinitepush test: enable extension for both repo push and repo pull
Summary:
the extension was not enabled for repo pull (the second repo)

hg pull -r was still working but other things like hg up <commit cloud hash> were not working.

it caused a bit of confusion

It is cleaner to enable the extension for both sides.

Reviewed By: StanislavGlebik

Differential Revision: D13710518

fbshipit-source-id: 231aec1a71a5c13d707c2b361ce77158573b93f0
2019-01-17 10:49:02 -08:00