Commit Graph

1433 Commits

Author SHA1 Message Date
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
Liubov Dmitrieva
a539b90a0c write phases for public commit in pushrebase
Summary:
Lazy way of filling the db may cause multiple mononoke hosts
writing the same phases data to the db, which is not good

Reviewed By: aslpavel

Differential Revision: D13598328

fbshipit-source-id: 9fc76adc71929cf37d8144844770f6a964173787
2019-01-09 09:42:56 -08:00
Liubov Dmitrieva
3dfa6058fb add time stats to phases calculation
Reviewed By: aslpavel

Differential Revision: D13597912

fbshipit-source-id: a7831a3d286884d88a7abfe315c28021ebfdd446
2019-01-09 09:23:41 -08:00
Liubov Dmitrieva
4f229d1802 add "phases" ("heads") cap for bundle2
Summary: initial implementation of phases using "phases" ("heads") transport

Reviewed By: aslpavel

Differential Revision: D13591652

fbshipit-source-id: 16ae8337a20cf326733a2f0255cc12ef4bfccd18
2019-01-09 09:23:41 -08:00
David Budischek
30fb184a2f Use BlobRepo instead of Arc<BlobRepo> in remotefilelog.rs
Summary: BlobRepo is cloneable and there is no reason to use Arc<BlobRepo>

Reviewed By: StanislavGlebik

Differential Revision: D13607918

fbshipit-source-id: 454778cb02ada87082de78e0d29ebf49e1b38d56
2019-01-09 07:17:32 -08:00
Lukas Piatkowski
2f8ddd0cfa mononoke admin: rustfmt main.rs for easier reviewing of next diffs
Reviewed By: HarveyHunt

Differential Revision: D13606992

fbshipit-source-id: 08600da1c390a552f80bf8b7c160daab78d16f9a
2019-01-09 04:27:33 -08:00
Stanislau Hlebik
29d1b9e5a0 mononoke: remove Arc<BlobRepo> from hook tailer
Summary: Fix TODO, BlobRepo is cloneable and there is no reason to use Arc<BlobRepo>

Reviewed By: ikostia

Differential Revision: D13607214

fbshipit-source-id: ba280823e8b232d4bf6e62ac2ce8d8cd3ee64c96
2019-01-09 03:52:21 -08:00
Stanislau Hlebik
be6d9bf347 mononoke: log common server data to scribe
Summary:
At the moment it's very hard to understand where the request came from. Let's
log useful information like hostname, tw task etc.

Reviewed By: aslpavel

Differential Revision: D13597544

fbshipit-source-id: 88ad837b61f1dc3d0b2e295774848128a498d9d3
2019-01-09 01:14:57 -08:00
Stanislau Hlebik
d460da7ad2 mononoke: remove unused options
Summary: These config options weren't used at all. Let's delete them from the configs

Reviewed By: aslpavel

Differential Revision: D13597545

fbshipit-source-id: 5e99b38e2e9fc4ba6d836322ceba38a8b65ad2f4
2019-01-09 01:14:57 -08:00
Lukas Piatkowski
813375d66a blobimport: add tracing and uploading traces on every blobimport run
Reviewed By: StanislavGlebik

Differential Revision: D13464745

fbshipit-source-id: 3e2ca21e70089c88a8c510cec1de2f20054a444b
2019-01-08 11:03:32 -08:00
Liubov Dmitrieva
8a138c33c8 add support for encording of phase-heads part of bundle2
Summary:
We have decided that this will be used to transport phases to the client

Hg client already supports this part.

Reviewed By: StanislavGlebik

Differential Revision: D13507921

fbshipit-source-id: 621e93bb6e1a0c87d4f4963ba7fa635b77a5b6ec
2019-01-08 05:32:36 -08:00
Liubov Dmitrieva
ad070bb4c1 getbundle request: bundlecaps param should be a set
Summary:
See representation from Mercurial.

```
gboptsmap = {
    "heads": "nodes",
    "bookmarks": "boolean",
    "common": "nodes",
    "obsmarkers": "boolean",
    "phases": "boolean",
    "bundlecaps": "scsv",
    "listkeys": "csv",
    "cg": "boolean",
    "cbattempted": "boolean",
}
```

Some logic might need to check what caps client supports. So convenient lookup is needed.

For example for phases, when we choose to transport phases via a separate bundle2 section called "phase-heads", we need to check that it is a supported on the client side.

Reviewed By: StanislavGlebik

Differential Revision: D13519888

fbshipit-source-id: 6471f2a5057cc3bb2dd72d9318a6f253a447b758
2019-01-08 01:48:06 -08:00
Abhay Bothra
b81b8b0005 Add convert subcommand to mononoke admin tool
Summary:
Added new command which looks as:
```
admin-convert
convert between bonsai and hg changeset hashes

USAGE:
    admin convert <HASH> --from <from> --to <to>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -f, --from <from>    Source hash type [possible values: hg, bonsai]
    -t, --to <to>        Target hash type [possible values: hg, bonsai]

ARGS:
    <HASH>    source hash
```

Reviewed By: StanislavGlebik

Differential Revision: D13494012

fbshipit-source-id: 1e1de7e1e28638b2001f612b9a2c9edda3979dc5
2019-01-07 11:00:48 -08:00
Stanislau Hlebik
629484f646 revert D13584553, D13175922, D13166085 to fix rust builds
Summary:
D13166085 breaks Mononoke builds. We got errors

```
rustfmt may have failed to format. See previous 119 errors.
```

These errors happen on formatting thrift files. It looks like the problem is
in the fact that rustfmt for linting is different from rustfmt we are using
while building rust thrift files - https://fburl.com/hn0g95wt. But they seem to
use the same config files, which are incompatible.

For now revert the diff to unblock the builds. Also we have to revert D13584553 and D13175922
because it depends on D13166085.

Reviewed By: lukaspiatkowski

Differential Revision: D13589633

fbshipit-source-id: 78c68068ddcb4c594fd1463e98b48f8f438e46a2
2019-01-07 06:19:27 -08:00
Jeremy Fitzhardinge
75db1ea8bf linter: use in-tree rustfmt binary for Rust formatting
Summary:
Use rustfmt binaries committed to tools/third-party/rustfmt for
formatting.

Reviewed By: zertosh

Differential Revision: D13166085

fbshipit-source-id: 2ba9568c3f463740b3e48b72196ef7c716e20784
2019-01-04 14:42:26 -08:00
Johan Schuijt-Li
8f2e32c7b8 Guard AclChecker::new and Identity::from_groupname as well from being included
Summary:
These calls make network requests which make our integration tests flaky, this
fix is a followup of D13580144

Reviewed By: StanislavGlebik

Differential Revision: D13580562

fbshipit-source-id: 110563c0360154a86cfc098a05240d7fd023f2c8
2019-01-04 08:32:29 -08:00
Johan Schuijt-Li
55fa57dbdf Disable AclChecker for integration tests
Summary:
Currently some tests are failing intermittently due to a timeout, this timeout
is caused by the integration tests making an external call to AclChecker which
is intermittently very slow.

For our integration tests we disable this call since it's not part of the test
suite to stop our tests from being flaky.

Reviewed By: StanislavGlebik

Differential Revision: D13580144

fbshipit-source-id: 0c26bb14dd222b888ca2638319071f4d99eab6df
2019-01-04 06:19:23 -08:00
Mark Thomas
20ccd1216f don't store filenodes for draft commits in the filenodes table
Summary:
When receiving and infinitepush bundle, don't store the filenodes for the
commit in the filenodes table.

When a client pulls these commits, we will reconstruct the filenode info from
the blobstore data.  However, they will receive null linknodes, and will need
to use adjustlinknode to compute the correct linknode.

Reviewed By: StanislavGlebik

Differential Revision: D13467110

fbshipit-source-id: 739b06f30a530a159352ffbf612d136c9c831aeb
2019-01-04 03:12:57 -08:00
Mark Thomas
76bce93083 return null linknodes if filenodeinfo is not available
Summary:
For draft commits we will stop storing the filenodeinfo for filenodes
introduced by that commit in the database.  This means the filenodeinfo lookup
may fail.  For these cases, reconstruct the filenodeinfo from the blob in the
blobstore, setting the missing linknode to the null changeset id.

Reviewed By: StanislavGlebik

Differential Revision: D13467112

fbshipit-source-id: 27ad406723a6affd80e7c3b2dc538b03004451ec
2019-01-04 03:12:57 -08:00
Mark Thomas
5777dc642f add test demonstrating problem with linknodes
Summary:
Adds a mononoke integration test demonstrating the problem with linknodes and
commit cloud commits, where linknodes may refer to draft commits you don't have
locally, because the filenode was first created with a draft commit that was
pushed to commit cloud.

This results in Mercurial having to do expensive adjustlinkrev operations
on public commits.

Reviewed By: StanislavGlebik

Differential Revision: D13026613

fbshipit-source-id: c2b8e5369a1ba69a175a49b57a70c3e35f92567f
2019-01-04 03:12:57 -08:00
Johan Schuijt-Li
9961d23e4f Support TLS resumption on mononoke
Summary: .

Reviewed By: StanislavGlebik

Differential Revision: D13564745

fbshipit-source-id: 04c66084984100df1073313a11493d79a839bd18
2019-01-03 08:46:15 -08:00
Stanislau Hlebik
92563375c5 mononoke: name variable correctly
Summary: Their names were mixed up

Reviewed By: ikostia

Differential Revision: D13565334

fbshipit-source-id: 1b56adb582900addf2f21ae9baa6dc4ea01c57cb
2019-01-02 10:24:12 -08:00
Liubov Dmitrieva
56dff9277a optimize phase calculation
Summary:
Basically if any of the bookmarks is reachable, all other bookmarks are not
interesting to check, so those futures should be skipped.

Reviewed By: StanislavGlebik

Differential Revision: D13538511

fbshipit-source-id: 193a7ea8d505690aeb96247a07c8f2688cd7a59f
2018-12-21 12:25:05 -08:00
Harvey Hunt
802a0933e4 mononoke: Fix integration tests
Summary:
D13494406 modified the Debug implementation for MPath, which broke the
integration tests.

Update them to fix this.

Reviewed By: rlangst

Differential Revision: D13527774

fbshipit-source-id: b86436b0fdd6653b0123e6da93a8da20e4ca65ba
2018-12-20 06:07:21 -08:00
Jeremy Fitzhardinge
65fd5bcf8f rust/futures-ext: implement StreamEither/left_stream/right_stream
Summary: Implement Either for Streams too.

Reviewed By: Imxset21

Differential Revision: D13494405

fbshipit-source-id: 8aea256b317f8d86e80eab3bfa200c59ebfdda35
2018-12-19 16:49:24 -08:00
Jeremy Fitzhardinge
b4240c995f mononoke: fix MPath Debug formatting
Summary: Fix Debug formatting for MPath - no need to include the full hex name

Reviewed By: aslpavel

Differential Revision: D13494406

fbshipit-source-id: fc2b5e8f2737f3cb5ac0a804b4e9b69ffca49553
2018-12-19 16:49:24 -08:00
Stanislau Hlebik
6989441a6e mononoke: replacing SingleNodeHash revset with SingleChangesetId
Summary:
All revsets should use bonsai changesets and not hg chnagesets.
This diff replaces usages of SingleNodeHash with SingleChangesetId.
It doesn't remove all of the usages, but it removes most of them

Reviewed By: aslpavel

Differential Revision: D13467116

fbshipit-source-id: 92c5b8f63f07e13af642a8cdb91fc77c46cdd595
2018-12-19 11:07:20 -08:00
Stanislau Hlebik
5d483c3f2f mononoke: use mock context in string_to_bonsai
Summary:
It's a test function, and passing additional parameter is annoying. Let's just
create mock context

Reviewed By: ikostia

Differential Revision: D13467118

fbshipit-source-id: fd27893d80f6b0ba59c2b7e5083d4ec7727a0e89
2018-12-19 11:07:20 -08:00
Jeremy Fitzhardinge
408e7665d9 mononoke: move RepositoryId into mononoke-types
Summary: There's nothing Mercurial-specific about identifying a repo. This also outright removes some dependencies on mercurial-types.

Reviewed By: StanislavGlebik

Differential Revision: D13512616

fbshipit-source-id: 4496a93a8d4e56cd6ca319dfd8effc71e694ff3e
2018-12-19 10:24:27 -08:00
Liubov Dmitrieva
20a017f839 add "phases" param to getbundle request and its parsing
Summary:
Some params in getbundle requests were ignored in Mononoke

we are going to use "phases" param to check if we need provide phases or not

Mercurial uses 1/0:

```
            elif keytype == "boolean":
                value = "%i" % bool(value)
```

Reviewed By: aslpavel

Differential Revision: D13517508

fbshipit-source-id: b066b335d1b972e9845be9fa3862bbf4d11817cd
2018-12-19 09:47:16 -08:00
Mark Thomas
bd0c00d4a5 run-tests: close child stdout after running test
Summary:
Tests don't close the child process stdout.  On newer versions of Python, this
can lead to ResourceWarnings when the test runner thread terminates.

Reviewed By: HarveyHunt

Differential Revision: D13517425

fbshipit-source-id: 6cedf4f39efe1299c41dbde784daf8c159309640
2018-12-19 07:52:48 -08:00
Mark Thomas
83a5782ec2 run-tests: fix escape sequences
Summary:
Some of the escape sequences in run-tests.py are invalid.  These cause
DeprecationWarnings on newer versions of Python.

In both cases, there are `\` characters that need to be escaped as `\\`.

Reviewed By: HarveyHunt

Differential Revision: D13517137

fbshipit-source-id: a899c3c28d55210f5972a515474a2fa69d051671
2018-12-19 07:52:48 -08:00
Pavel Aslanov
eb75d48a95 correctly handle configurations with multiple blobstores
Summary: Correctly handle repository with multiple blobstores

Reviewed By: StanislavGlebik

Differential Revision: D13434206

fbshipit-source-id: f4ab70ec037deba150ed5c1ee8e53d23317b8e09
2018-12-18 06:55:56 -08:00
Pavel Aslanov
b9ce779144 tie blobstore queue and multiplexer together
Summary: Integrate self-healing queue and multiplexed blobstore together

Reviewed By: StanislavGlebik

Differential Revision: D13416302

fbshipit-source-id: 0d310fdd7380ba9e17667325e37862e2b34748c3
2018-12-18 06:55:56 -08:00
Pavel Aslanov
bf005637e1 add get method to BlobstoreSyncQueue
Summary: This method is needed by `MultplexedBlobstore` to disambiguate unassigned key from not synced one

Reviewed By: StanislavGlebik

Differential Revision: D13415231

fbshipit-source-id: 9918ca255b3ed3486660e303546a897622a42950
2018-12-18 06:55:56 -08:00
Pavel Aslanov
043b374bf1 make BlobstoreId configurable from repoconfig
Summary: Make `BlobstoreId` configurable from repoconfig

Reviewed By: StanislavGlebik

Differential Revision: D13376824

fbshipit-source-id: 45e1b45fb0fcba6de91374e3621c7bbb1b465544
2018-12-18 06:55:56 -08:00
Stanislau Hlebik
ae77a7d64b mononoke: remove failing test
Reviewed By: HarveyHunt

Differential Revision: D13455632

fbshipit-source-id: b2582a985153a0a0460ef577daedf203d1bb5da4
2018-12-18 05:48:19 -08:00
Liubov Dmitrieva
1bc9d9d3c4 phases_hint: correct initialization
Summary:
As discussed RepoClient should own phases_hit. Initialize it correspondingly.

Some rustfmt is unrelated.

Reviewed By: lukaspiatkowski

Differential Revision: D13488572

fbshipit-source-id: 3d2c0169c06220bcd4b3f8845d6db7f357052e0a
2018-12-18 05:16:24 -08:00
Liubov Dmitrieva
8ed94624c9 add a test that demonstrates phases are not passed correctly
Summary: the test we will use to check phases implementation

Reviewed By: lukaspiatkowski

Differential Revision: D13467516

fbshipit-source-id: 89760b6b965e8de8ad3e4dd7ff4cf6d3216597fd
2018-12-18 05:16:24 -08:00
Stanislau Hlebik
bd52c0918d mononoke: set bookmark only for heads in fixtures repo
Summary:
This diff fixes TODO. Previously there was a bookmark on every commit in the repo. This is not necessary
and make testing harder (in particular, testing phases). Let's clean it up

Reviewed By: HarveyHunt

Differential Revision: D13454832

fbshipit-source-id: c7d545841073d2030431ef4aed2307a55785f8db
2018-12-17 14:28:55 -08:00
Stanislau Hlebik
541ec421e1 mononoke: remove duplicate commit from fixture
Summary: We have the same commit a few lines above

Reviewed By: HarveyHunt

Differential Revision: D13457024

fbshipit-source-id: 5a3262abf7d39a34c858b2bbc6c0a9ba78afe181
2018-12-17 14:28:55 -08:00
Jeremy Fitzhardinge
5f3d7307da mononoke/revset: suppress warning
Summary: PhantomData only used for test builds.

Reviewed By: StanislavGlebik

Differential Revision: D13460298

fbshipit-source-id: e712e468a4dacd6ddad3b6159c3020d49e87306f
2018-12-14 13:27:44 -08:00
Jeremy Fitzhardinge
a9817cfec1 mononoke-types: simplify Debug output for MPath
Summary: No need to print the hex.

Reviewed By: StanislavGlebik

Differential Revision: D13457386

fbshipit-source-id: f6063b94e4f095d9ffed06b9de6e302b38e29334
2018-12-14 13:27:44 -08:00
Liubov Dmitrieva
473a9ba741 add api for using PhaseHint and Db without memcache
Summary:
New HintPhases api that will be used for tests vs CachingHintPhases that will be used in prod.

The api will be owned by RepoClient.

We will check what type of BlobRepo we have (i.e. blob:rocks, blob:files, blob:remote etc) and build the phases depending on the type of the BlobRepo.

We will use either CachingHintPhases backed by real db / MyRouter or HintPhases backed by Sqlite.

Reviewed By: StanislavGlebik

Differential Revision: D13466225

fbshipit-source-id: 06ea565171d8ea8d7335fbbd91d86fbdcc01c8fc
2018-12-14 09:20:29 -08:00
Liubov Dmitrieva
776c48ca40 add logic for slow path phases calculation
Summary: Calculation is based on beeing ancestor of a public bookmark

Reviewed By: StanislavGlebik

Differential Revision: D13441622

fbshipit-source-id: e20df656847913bc124b491aaeb2660d21c85da1
2018-12-14 08:06:53 -08:00
Liubov Dmitrieva
120849c0be memcache getter/setter for phases
Summary:
This diff includes the logic on how we will receive a phase for a given commit based on memcahe / db lookup and refresh, and slow path calculation.

It has a blank place of slow path (not found in the memcache, not found in the db => we have to calculate the phase based on being ancestor of public bookmark).

Collecting the stats should be added separately.

Reviewed By: StanislavGlebik

Differential Revision: D13415481

fbshipit-source-id: 6a4cb5b8dfbb0d7b2535d903c653bbf7a088c422
2018-12-14 08:06:53 -08:00