Commit Graph

1478 Commits

Author SHA1 Message Date
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
Stanislau Hlebik
936a31a0e0 mononoke: fix warnings and enable deny(warnings) for revsets
Reviewed By: lukaspiatkowski

Differential Revision: D13710072

fbshipit-source-id: cdc0a4abd1133b1510158fdf8f3d99e4bd7d969d
2019-01-17 04:33:49 -08:00
Stanislau Hlebik
67d0e81000 mononoke: fix typo in the test name
Reviewed By: lukaspiatkowski

Differential Revision: D13710070

fbshipit-source-id: 3af3a6ac1cdfb80d0b7866164693f0bda131296b
2019-01-17 02:43:19 -08:00
Stanislau Hlebik
432138ac93 mononoke: remove CachingChangesets
Summary:
There is no much point in keeping since we have skiplist which should solve the
same problems in a better way.

The only way where CachingChangesets maybe useful is when many users fetch a
lot of commits simultaneously. It may happen when we merge a new big repository.
However current implementation of CachingChangesets won't help with it since we
do not update its indexes.

Reviewed By: lukaspiatkowski

Differential Revision: D13695201

fbshipit-source-id: 2a4600eccf8224453ca13047e5a2ef3a0af650e3
2019-01-17 02:33:35 -08:00
Stanislau Hlebik
5dbdffdfe7 mononoke: fix sharded filenodes
Summary:
Previously to get copy/move source we had to join `paths` and `fixedcopyinfo`
table. That worked fine when we had just one shard. However now we have many
shards, and join no longer works. The reason is that move source path is in a
different shard compared to move destination path, and join returns no data.

Consider this situation. shardA contains all the data for pathA, shardB
contains all the data for pathB. That means that sharded `paths` table will
have pathA in shardA and pathB in shardB. Then if file pathA was copied form
pathB, then `fixedcopyinfo` table in shardA contains a path_hash of pathB.
However joining shardA's `fixedcopyinfo` with shardA's `paths` to convert
path_hash to path fails because pathB is in shardB.

The only possible fix is to split fetching path_hash from `fixedcopyinfo` and
converting path_hash to path.

I don't think we'll be able to keep the logic with join that we have at the
moment. It would require us to have all paths on all shards which is
unfeasible because it'll make writes much slower.

Reviewed By: aslpavel

Differential Revision: D13690141

fbshipit-source-id: 16b5cae6f23c162bb502b65c208f3ca9e443fb04
2019-01-17 02:33:35 -08:00
Stanislau Hlebik
712bab10f9 mononoke: rustfmt
Summary:
Going to change these files in the next diff. To make next diff smaller
splitting format changes to this diff.

Reviewed By: aslpavel

Differential Revision: D13690143

fbshipit-source-id: 124232b832d8c67ee7fe931ef174230cb09ff564
2019-01-17 02:33:35 -08:00
Stanislau Hlebik
8ef5d4ba64 mononoke: change the way file content blobs are hashed
Summary:
File content blobs are thrift encoded in Mononoke. This is done so
that we can change the encoding of content blobs easily. For example, we can
add compression or we can add split the blobs in chunks.

However there is a problem. At the moment file content blob key is a hash of
the actual data that's written to blobstore i.e. of a thrift encoded data. That
means that if we add compression or change thrift encoding in any way, then the
file content blob key changes and it changes the commit hashes.

This is wrong. To fix it let's use hash of the actual file content as the key.

Reviewed By: farnz

Differential Revision: D12884898

fbshipit-source-id: e60a7b326c39dad86e2b26c6f637defcb0acc8e8
2019-01-17 02:33:35 -08:00
Stanislau Hlebik
b64f2a7136 mononoke: change how copy information is found
Summary:
Mercurial has a hack to determine if a file was renamed. If p1 is None then
copy metadata is checked. Note that this hack is purely to make finding renames
faster and we don't need it in Mononoke. So let's just read copy metadata.

This diff also removes `maybe_copied()` method and unused code like `Symlink`

Reviewed By: farnz

Differential Revision: D12826409

fbshipit-source-id: 53792218cb61fcba96144765790278d17eecdbb1
2019-01-17 02:33:35 -08:00
Liubov Dmitrieva
022b9164ab make bulk select query code safer
Summary:
as you can test the query like this:

```
select * from demo WHERE `name` IN ()
```

is fine for sqlite but **invalid syntax** in MySql (empty list of value)

the error will be similar to this:

```
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 10000' at line 1; 'select * from phases WHERE repo_id IN () LIMIT 10000'
```

So, such errors are usually shoot in production.

It is better to have the empty check right before calling queries with lists

Reviewed By: lukaspiatkowski

Differential Revision: D13704726

fbshipit-source-id: a9fb3a2e21e88b3af14f57917c2004454eb42531
2019-01-17 02:28:10 -08:00
Adam Simpkins
d7eaf4e8d1 reformat several files
Summary:
Reformat several rust files with the current rustfmt, to make the linter
happy.

Reviewed By: yfeldblum

Differential Revision: D13683205

fbshipit-source-id: f7a02dae0fbe095b6acde4de380aca2acfedf39d
2019-01-16 11:47:37 -08:00
Fatih Aydin
0c8adaa4c4 Replacing HgNodeHash with Changesetid - Without formatting changes
Differential Revision: D13692998

Reviewed By: lukaspiatkowski

fbshipit-source-id: 0ba0d30a96b0a4d4d84f64b410036e9e58cf64b9
2019-01-16 11:08:41 -08:00
Fatih Aydin
b43b908a4b Lint Formatting Changes for Revsets
Summary: This diff is created to separate the lint formatting work from the rest of the code changes in D13632296

Reviewed By: lukaspiatkowski

Differential Revision: D13691680

fbshipit-source-id: 8e12016534d2e6066d803b51b5f12cbf6e89a822
2019-01-16 11:08:41 -08:00
Liubov Dmitrieva
21a03d27ec rustfmt (arc lint) for the file
Summary: running arc lint for this file

Reviewed By: StanislavGlebik

Differential Revision: D13695410

fbshipit-source-id: ea1af839f409501c5b599b2cea294cd7fdc7caab
2019-01-16 10:43:14 -08:00
Stanislau Hlebik
1d1e08b267 mononoke: avoid copies in encode_single
Summary:
It showed up in our profiles because it does unnecessary copies. And for big
request like getfiles it matters a bit. So let's fix it.

Reviewed By: aslpavel

Differential Revision: D13634952

fbshipit-source-id: 98be8bf7236eb12a4009b4b174ffac258f46e0f4
2019-01-16 09:21:44 -08:00
Harvey Hunt
1a89f74d8d mononoke: Add extra wireproto logging for getbundle() and unbundle()
Summary:
Add data to the extra_context scuba field that includes the number of commits in the bundle
as well as certain stats from the changesetfetcher (such as cache misses).

Reviewed By: aslpavel

Differential Revision: D13528646

fbshipit-source-id: 4603d7e95182f4e36b5ef325651ec80997742ea0
2019-01-16 09:11:18 -08:00
Harvey Hunt
1f6a4a0b10 mononoke: Add more scuba logging for gettreepack wireproto command
Summary:
Update the wireproto command gettreepack to log the total size of the returned
treepacks, as well as the number that are returned.

Reviewed By: StanislavGlebik

Differential Revision: D13278254

fbshipit-source-id: aab9b6f42b11240a7b84bfda07bf99f15508043d
2019-01-16 09:11:18 -08:00
Harvey Hunt
c49184a026 mononoke: Log summary for getfiles wireproto method
Summary:
Update the wireproto logging to log a summary of the getfile requests, rather than
logging every individual request. This should reduce our logging to scuba.

This diff includes logging of:

- Number of returned files
- Maximum file size
- Total size of files
- Maximum file request latency

Reviewed By: aslpavel

Differential Revision: D13278256

fbshipit-source-id: 069318a718fe915995c7bbe25aa8ccb02c2372f8
2019-01-16 09:11:18 -08:00
Harvey Hunt
d68f13c037 mononoke: Add perf counters to wireproto logger
Summary:
Some wireproto commands use WireProtoLogger to record information to
both scuba and scribe (for replay). Modify this struct to also allow
a PerfCounter struct to be logged to scuba but _not_ scribe.

This allows for logging of command specific information to scuba, such as
number of files requested.

Reviewed By: StanislavGlebik

Differential Revision: D13278255

fbshipit-source-id: 0ed364c8264ba3ae439746387126a7778712b860
2019-01-16 09:11:18 -08:00
Harvey Hunt
9e12a9b943 mononoke: Add PerfCounters struct to CoreContext
Summary:
PerfCounters is a small wrapper around a concurrent hashmap
that can be used to store performance metrics in. Include it in CoreContext
so that it can be used throughout the codebase.

Reviewed By: aslpavel

Differential Revision: D13528647

fbshipit-source-id: 7c3f26ab8c0c7ba5ee619e85a069af7e7721037f
2019-01-16 09:11:17 -08:00
Liubov Dmitrieva
fd7345bc58 calculate phases using bulk API
Summary:
The bulk api makes less queries to mysql and therefore is more efficient.

This is especially important for `hg pull` requests where the list of heads is very large.

Reviewed By: lukaspiatkowski

Differential Revision: D13677298

fbshipit-source-id: 3dec1b3462c520c11481325e82523ef7a6ae6516
2019-01-16 08:22:54 -08:00
Lukas Piatkowski
eba422a209 blobstore healer: minimalistic implementation
Summary:
This version still misses:
- proper production-ready logging
- smarter handling of case where the queue entries related to each other do not fit in the limit or `older_than` limit, so the healer will heal much more entries without realizing it shouldn't do so.

Reviewed By: aslpavel

Differential Revision: D13528686

fbshipit-source-id: 0245becea7e4f0ac69383a7885ff3746d81c4add
2019-01-15 10:41:07 -08:00
Liubov Dmitrieva
74ed84b7c3 implement bulk phases fetch and set: part2
Summary:
the remaining part to implement bulk phases fetch and update

this is required to optimize number of MySql queries we are using to look up at the db for phases and bookmarks.

the single get api has been removed and reimplemented by calling bulk ones

Reviewed By: aslpavel

Differential Revision: D13664900

fbshipit-source-id: 29342e86c057b92e331fadcebe51f452d9569e09
2019-01-15 09:47:04 -08:00
Lukas Piatkowski
59a2812744 sqlblob: add counters for internal data and chunk memcache hit
Reviewed By: aslpavel

Differential Revision: D13487718

fbshipit-source-id: 27a4b46a8d024a2151e8f7203017a0853cc87ab1
2019-01-15 09:38:26 -08:00
Lukas Piatkowski
7730f59df9 sqlblob: add direct Memcache cache for data and chunk
Summary: as opposed to other blobstores, this one is using memcache directly, because it even stores chunks in the cache

Reviewed By: aslpavel

Differential Revision: D13487613

fbshipit-source-id: bf9eeaef4d795e4f2322f128fb8501ace619d8f1
2019-01-15 09:38:26 -08:00
Lukas Piatkowski
ceda67a78a blobstore: extract CacheOpsUtil for direct access for blobstores
Summary: refactor CacheOps to prepare for next diff

Reviewed By: aslpavel

Differential Revision: D13487500

fbshipit-source-id: f9023938d7c2c7573a7957bf38ec6b8641441b75
2019-01-15 09:38:26 -08:00
Lukas Piatkowski
b9ecb39676 sqlblob: add support for MyRouter
Reviewed By: StanislavGlebik

Differential Revision: D13465323

fbshipit-source-id: a9d6b7626617fcd85d91b4118b22ad9a7db3aa32
2019-01-15 09:38:26 -08:00
Lukas Piatkowski
1fc999ed61 sql_ext: add PoolSizeConfig to enable easy configuring of MyRouter pool sizes
Reviewed By: StanislavGlebik

Differential Revision: D13465182

fbshipit-source-id: c6c1b788c698bd853a9c26c1b1c1c2b7199e05e9
2019-01-15 09:38:26 -08:00
Liubov Dmitrieva
be4f3857b1 implement bulk phases fetch and set: part1
Summary:
this is required to optimize number of MySql queries we are using to look up at the db for phases and bookmarks.

the next step is to add the same with Memcache to caching.rs

implementations for the single get is replaced with just calling the implementation for multiple get

Reviewed By: aslpavel

Differential Revision: D13658610

fbshipit-source-id: e3876044e2cbbefb156175c51ab7051db3885eb8
2019-01-15 09:11:21 -08:00
David Budischek
1d74d6da43 Fix healthcheck for apiserver thrift
Summary: Healthcheck broke because getStatusDetails wasnt implemented

Reviewed By: HarveyHunt

Differential Revision: D13671087

fbshipit-source-id: cc1182f16bbc719cbb95c3619e593a3514b02969
2019-01-15 07:52:50 -08:00
Lukas Piatkowski
e785b92bf0 mononoke sql: use from_value_opt instead of parsing numbers from sql manually
Summary: the from_value_opt already knows how to properly parse an integer from sql response, no need to reinvent the wheel and introduce bugs

Reviewed By: aslpavel

Differential Revision: D13651328

fbshipit-source-id: 55af810c99b93bd2f9c67c721a9d0be6034ee466
2019-01-15 07:16:13 -08:00
Lukas Piatkowski
b36dd037ad sqlblob: initial implementation of the sql based blobstore
Summary: MyRouter and cache support will come in next diffs

Reviewed By: StanislavGlebik

Differential Revision: D13465146

fbshipit-source-id: 0ede0e875d4a49794ff71173bd0d1563abb3ff08
2019-01-15 07:05:33 -08:00
David Budischek
1558f571c1 Add JSON printing of 'mononoke_admin bonsai-fetch', j...
Reviewed By: StanislavGlebik

Differential Revision: D13622701

fbshipit-source-id: b0b61c23966f9485b99ead7196e276efa8e1e267
2019-01-15 04:02:05 -08:00
David Budischek
7fbfb4ad1d rustfmt mononoke_admin
Reviewed By: StanislavGlebik

Differential Revision: D13634949

fbshipit-source-id: ae97ecba84aa835ad141e4895d1861ad537abfdb
2019-01-15 04:02:05 -08:00
David Budischek
d94fe79b7f Prettify printing of mononoke_admin bonsai-fetch
Summary: Instead of dumping the debug output we print the most important information: Changeset id, author, message and file changes.

Reviewed By: StanislavGlebik

Differential Revision: D13621492

fbshipit-source-id: ea0f93f58516cc759d0dc9aac14545b1827ea136
2019-01-15 04:02:05 -08:00
Pavel Aslanov
1eea4fdb09 asynchronous blobrepo constructor
Summary:
- Support for gluster blubstore
- Asynchronous blobrepo constructor

Reviewed By: StanislavGlebik

Differential Revision: D13630033

fbshipit-source-id: 3e7f5a7be4451063dca3df2f5a7f70d30a2def58
2019-01-14 09:31:58 -08:00
Pavel Aslanov
2efacff245 rustfmt effected files
Summary: Format files effected by next commit in a stack

Reviewed By: StanislavGlebik

Differential Revision: D13650639

fbshipit-source-id: d4e37acd2bcd29b291968a529543c202f6944e1a
2019-01-14 09:31:58 -08:00
Stanislau Hlebik
5dfab1ed2b mononoke: make sure we don't have stackoverflows in reachability_query
Summary:
reachability_query uses recursion so we can run out of stack. However getting
rid of recursion is easy because it was already implemented for `lca_hint`
method.

I also used this diff as an opportunity to rename `src_hash` and `dst_hash` to
`maybe_descendant_hash` and `maybe_ancestor_hash` respectively to make code
clearer.

Reviewed By: lukaspiatkowski

Differential Revision: D13650422

fbshipit-source-id: 0e52ae592992208a03691b1a5c24021a4fb94313
2019-01-14 08:56:46 -08:00
David Budischek
9044d4d4d8 Fix apiserver thrift TARGETS file and add python exports
Summary:
We need to add python exports to our TARGETS file to enable scmquery
to create a ServiceRouter Client for mononoke-api

Reviewed By: StanislavGlebik

Differential Revision: D13651275

fbshipit-source-id: ba5a4eb3665dae1ea127f4ceb96c1ce62e1e4563
2019-01-14 08:31:35 -08:00
Kostia Balytskyi
ede7fd7185 mononoke: back out shared-future-based bookmark cache
Summary:
It breaks the pushrebase test.

Original commit: 4e084bee13ff4941d1a42d1f75fe501575858a63
Original diff: D13573105

Reviewed By: StanislavGlebik

Differential Revision: D13651039

fbshipit-source-id: b67c32e0fc4acc953265a089e746ede3d4426b6f
2019-01-14 07:09:23 -08:00
Liubov Dmitrieva
eeb303f932 using not the default skip index for phases calculations
Summary:
use the correct skip index

sorry for some rustfmt.

Reviewed By: StanislavGlebik

Differential Revision: D13636059

fbshipit-source-id: 2815d82b63b86bda053f5a3a9a1b8a3b72abbf82
2019-01-14 06:27:47 -08:00
Stanislau Hlebik
6fc5c58810 mononoke: rustfmt
Summary: Format skiplist.rs file before we make changes to it.

Reviewed By: aslpavel

Differential Revision: D13650420

fbshipit-source-id: 394e07d94b57814fc9b7b345ffc81e06f95446d7
2019-01-14 06:10:30 -08:00
Stanislau Hlebik
57e8af2582 mononoke: fix tests
Summary:
These tests constantly fail because people add new logging from C++. Overriding
XLOG is not that easy, so let's just grep for lines we are interested in.

Reviewed By: HarveyHunt

Differential Revision: D13650651

fbshipit-source-id: 419ad55b1087212debb7aaba652b49ba24763fc4
2019-01-14 04:41:24 -08:00
Kostia Balytskyi
013318ee87 mononoke: shared future bookmarks cache
Summary:
After some discussion with Pavel Aslanov, Lukas Piatkowski and Stanislau Hlebik, it was evident that shared future is the best approach for the bookmarks cache.

The cache in this implementation maintains a shared future for each repo, fetching the full list of bookmarks. When a list of bookmarks with a  given prefix is required, a filter is applied to a full list future.

Two locks are used in this implementation: one for adding new repos to the hashtable and one for updating the cache. In both cases the optimistic strategy: "let's first first grab a read  lock and try checking if it is good enough" is applied.

Reviewed By: StanislavGlebik

Differential Revision: D13573105

fbshipit-source-id: 4e084bee13ff4941d1a42d1f75fe501575858a63
2019-01-11 10:20:34 -08:00
Johan Schuijt-Li
a481dd093e Avoid blocking our thread pool with a blocking network call
Summary: .

Reviewed By: lukaspiatkowski

Differential Revision: D13611875

fbshipit-source-id: eeeb84ba7f4f9daa7c982dfc0bc0bc42ae16d7bb
2019-01-10 08:36:48 -08:00
Lukas Piatkowski
5155134d0d blobrepo: generalize methods creating Blobrepo over any remote blobstore
Reviewed By: aslpavel

Differential Revision: D13464953

fbshipit-source-id: cb732204bea571788e5b45cee718e8ddf496dd0d
2019-01-10 02:57:36 -08:00
Jeremy Fitzhardinge
1d142a6ae8 Back out D13589633 "revert D13584553, D13175922, D13166085 to fix rust builds"
Summary:
Rust thrift code generation now uses the right rustfmt.

Original commit changeset: 78c68068ddcb

Reviewed By: zertosh

Differential Revision: D13599740

fbshipit-source-id: be0ae80d36302be3f6f3532ab327c60ba4d460ef
2019-01-09 13:31:19 -08:00