Commit Graph

212 Commits

Author SHA1 Message Date
Stanislau Hlebik
f9cdae09c6 mononoke: replace PerFile hook with PerAddedOrModified
Summary:
That's a bit controversial, however I think it's worth it. Many file hooks
should be run only on files that exist in the repo (for example,
https://fburl.com/1cj8wm3p, https://fburl.com/t06fjwak). If you want to do
anything on deleted files then just write a changeset hook.

Reviewed By: jsgf

Differential Revision: D10239186

fbshipit-source-id: 3cb563b81ec51298623cecaf976b5a8fe50dc71c
2018-10-09 02:05:55 -07:00
Anastasiya Zhyrkevich
c4f7fae0bb LFS test from hg client to Mononoke server, with large files through
Summary:
Test is failing, as Mononoke server lfs support is not implemented yet.
Integration test for commands from hg client to Mononoke server.

\s(re) lines are added as after auto-save, the test script is formatted, and delete spaces at the empty lines.
In order to keep such lines, \s(re) could be added
In comparison of such line, pattern \s(re) is deleted and not compared.
See to mononoke/tests/integration/third_party/hg_run_tests.py for more information about comparison of the output lines.

Reviewed By: StanislavGlebik

Differential Revision: D10089289

fbshipit-source-id: 2962e80d919c21801d08990be190f2574c48646d
2018-10-08 16:05:59 -07:00
Stanislau Hlebik
c3b5ee6854 mononoke: add (re) for lines ending with whitespace in integration tests
Summary:
Many editors remove trailing whitespaces on save. That makes modifying these
files annoying. Adding ` (re)` mitigates the issue

Reviewed By: farnz

Differential Revision: D10237590

fbshipit-source-id: 1473f35023b878f21ff22bd5a5ccb5f11884cef3
2018-10-08 09:06:26 -07:00
Simon Farnsworth
6e2455a12e Hook up (untested) support for streaming clones
Summary:
We now have a way for a MySQL database to tell us how to send
streaming clones to the client. Hook it all up, so that (with any luck), once
we have data in MySQL and the blobstore, we'll see working streaming clones.

Reviewed By: StanislavGlebik

Differential Revision: D10130774

fbshipit-source-id: b22ffb642d0a54b09545889779f79e7a0f81acd7
2018-10-04 11:37:46 -07:00
Stanislau Hlebik
836414034d mononoke: speed up integration tests
Summary: cachelib takes a lot of times to init, and it's not used in the tests.

Reviewed By: farnz

Differential Revision: D10123692

fbshipit-source-id: bce82af3f56aa8829127bf4c605a1d472735126a
2018-10-01 03:38:19 -07:00
Stanislau Hlebik
d924fc849d mononoke: print error message in tests if blobimport fails in tests
Summary:
It makes it clear why blobimport failed. Before it required modification to the
tests to run `cat FILENAME`, now it's done automatically

Reviewed By: farnz

Differential Revision: D9850279

fbshipit-source-id: b9a252f50b6dcf4906c24aca70fa37a2cec84e46
2018-10-01 03:38:19 -07:00
Stanislau Hlebik
54b1af68e4 mononoke: fix integration tests
Summary: Because of D9926967

Reviewed By: farnz

Differential Revision: D10108576

fbshipit-source-id: 6fa68db1f955bc8edfd12da0e7924f51ae8a9513
2018-09-28 11:06:56 -07:00
Anastasiya Zhyrkevich
0f6bba1de0 PUT request upload to mononoke API
Summary:
PUT request upload to mononoke API
hg client sends a PUT request to store a file into blobstore during push supporting LFS

Upload file by alias is divied into 2 parts:
- Put alias : blobstore key
- Put blobstore_key: contents

Keep in mind, that file content is thrift encoded

host_address for batch request is from command line flags -H for host, -p for port

Reviewed By: StanislavGlebik

Differential Revision: D10026683

fbshipit-source-id: 6c2726c7fee2fb171582bdcf7ce86b22b0130660
2018-09-27 11:20:46 -07:00
Anastasiya Zhyrkevich
617d750703 LFS Api test
Summary:
Integration test for check connection hg client < - > API batch
Checks objects/batch/
Checks lfs/upload/{SHA}

Reviewed By: StanislavGlebik

Differential Revision: D9975015

fbshipit-source-id: 464ca4a2f9f53c1d0a6aa39ada519e598b5974ef
2018-09-24 11:07:13 -07:00
Anastasiya Zhyrkevich
f33ea55653 download mononoke api
Summary:
WIP

Mononoke API download  for lfs
support get request
curl http://127.0.0.1:8000/{repo_name}/lfs/download/{sha256}

Reviewed By: StanislavGlebik

Differential Revision: D9850413

fbshipit-source-id: 4d756679716893b2b9c8ee877433cd443df52285
2018-09-20 01:37:00 -07:00
Simon Farnsworth
0aaa4577bc Add minimal support to trigger streaming clones in Mercurial client
Summary:
Streaming clones are a neat hack; we get to send files down to the
Mercurial client, which it then writes out as-is. Usefully, we can send no
files, and the protocol still works.

Set up the capabilities etc needed so that we send streaming clones to
Mercurial clients, even if they're rather useless so far.

Reviewed By: StanislavGlebik

Differential Revision: D9926967

fbshipit-source-id: b543e802adac38c8bc318081eec364aed87b0231
2018-09-19 06:36:56 -07:00
Stanislau Hlebik
a9f6be975c mononoke: fix test-bookmark-race.t
Summary:
It was broken because of D9849883.

The problem was in the following. repo-pull was created using
`hginit_treemanifest` which creates treemanifest server repo. This repo was
backfilling flat manifests, and this backfilling sends a getbunde request with
empty common heads.

The problem was fixed by using `hgclone_treemanifest`.

Reviewed By: farnz

Differential Revision: D9940386

fbshipit-source-id: 837be6fd27c8e5ee81634d223aa1a88101926961
2018-09-19 06:36:56 -07:00
Simon Farnsworth
0e12d49b5f actix-web isn't doing HTTP/2 at the moment - amend tests to match
Summary:
We've upgraded crates.io, and somehow broke Actix so that HTTP/2 is no
longer supported. For now, update the test to run with HTTP/1.1

Reviewed By: StanislavGlebik

Differential Revision: D9934777

fbshipit-source-id: c41aa5ad376dc7b07700f1d1d1b30ff9ff694f68
2018-09-19 05:06:26 -07:00
Stanislau Hlebik
cab68edc75 mononoke: return bundle to the client in pushrebase
Summary:
Pushrebase should send back the newly created commits. This diff adds this
functionality.

Note that it fetches both pushrebased commit and current "onto" bookmark.
Normally they should be the same, however they maybe different if bookmark
suddenly moved before current pushrebase finished.

Reviewed By: lukaspiatkowski

Differential Revision: D9635433

fbshipit-source-id: 12a076cc95f55b1af49690d236cee567429aef93
2018-09-06 06:53:57 -07:00
Pavel Aslanov
57d5ddcaf8 added pushrebase configuration options
Summary:
- added `PushrebaseParams` to `RepoConfig`
- configurable recursion_depth and rewritedates

Reviewed By: StanislavGlebik

Differential Revision: D9578661

fbshipit-source-id: df26be4f0f54a54ab6a82fc89d6733099469ce98
2018-08-31 08:55:19 -07:00
Pavel Aslanov
cf9cd619c1 compute changed files and find conflicts
Summary:
This diff fills missing parts of push-rebase implementation
- `find_closest_root` - find closest root to specified bookmark
- `find_changed_files` - find file affected by changesets between provided `ancestor` and `descendant`
- `intersect_changed_files` - rejects push rebase if any conflicts have been found
- `create_rebased_changes` - support for merges
- `do_pushrebase` - returns updated bookmark value

Reviewed By: StanislavGlebik

Differential Revision: D9458416

fbshipit-source-id: c0cb53773eba6e966f1a5928c43ebdec761a78d3
2018-08-29 06:52:11 -07:00
Harvey Hunt
b582d26357 Add lookup support for bookmarks
Summary:
Modify the lookup() RPC function to be able to accept either a
bookmark or commit hash. A commit hash lookup is attempted first, falling
back to a bookmark lookup if it fails.

Reviewed By: StanislavGlebik

Differential Revision: D9457349

fbshipit-source-id: 78db21c01c498b045f5781097cb12f7220a40999
2018-08-28 09:53:24 -07:00
Stanislau Hlebik
60150b9488 mononoke: stack pushrebase
Summary: Now pushrebasing stacks as well. Again, still no conflicts checks

Reviewed By: aslpavel

Differential Revision: D9359807

fbshipit-source-id: 9f6e7a05b45fb80b40faaaaa4fe2434b7a591a7c
2018-08-17 07:21:31 -07:00
Stanislau Hlebik
9e24fff2fd mononoke: pushrebase for 1 commit
Summary:
Initial implementation of pushrebase. At the moment it processes just one commit, but after implementing stub function it should work for every case.

Note that there is a special PushrebaseError. This is necessary to distinguish between infra error (i.e. mysql is unavailable) and expected errors like conflicts.

Reviewed By: aslpavel

Differential Revision: D9306815

fbshipit-source-id: 7c3f91b17c6270537d63e8c9dba8116f96840ece
2018-08-17 06:51:52 -07:00
Stanislau Hlebik
6bb09bbb98 mononoke: stub for pushrebase implementation
Summary: Just failing for now, next diffs will add an actual functionality

Reviewed By: farnz

Differential Revision: D9306814

fbshipit-source-id: c515f2e742833833d73bce08dbea1ddbb7e2ae79
2018-08-17 06:51:52 -07:00
Stanislau Hlebik
74e32f9ea7 mononoke: save pushrebase commits
Summary:
First step of implementing pushrebase algorithm. Save the commits that client
has sent us. The parts that client sends us are the same as in normal push
except for the names and parameters.

Reviewed By: farnz

Differential Revision: D9304750

fbshipit-source-id: d5be6635c0cf1a14a66a5fed5ba13f344195e8bc
2018-08-17 05:21:56 -07:00
Rain ⁣
2b4c0f14a1 bonsai_verify: init cachelib before opening repo
Summary: ugh, yet another case of a hidden dependency.

Reviewed By: StanislavGlebik

Differential Revision: D9318498

fbshipit-source-id: 5fcd25081b5033cbef9c5f137e616348c5d6ced9
2018-08-15 23:36:18 -07:00
Matthew Dippel
a3b9887ac6 Encoded url handling for is_ancestor queries
Summary: Adds proper url decoding for is_ancestor, so that special characters can be encoded in the url.

Reviewed By: kulshrax

Differential Revision: D9325467

fbshipit-source-id: d3ff60e004be8d254ea6f7288188adf54ab7ff5f
2018-08-15 11:31:55 -07:00
Simon Farnsworth
bd3cbdb295 Increase max apiserver startup time to 10 seconds
Summary:
I was seeing this test fail intermittently - increasing the loop from
40 iterations (4 seconds) to 100 iterations (10 seconds) makes it reliably pass

Reviewed By: StanislavGlebik

Differential Revision: D9333501

fbshipit-source-id: 31d842e2ec9a5bfd2e6d5d31ada85a6a891ff037
2018-08-15 07:52:40 -07:00
Lukas Piatkowski
71b4200204 integration test: remove check for mononoke log output in test-gettreepack.t
Summary: Mononoke stopped logging such a fine graned logs per commit because they are noisy, the remainder of the gettreepack test should be good enough to verify that the thing in test works

Reviewed By: sunshowers

Differential Revision: D9318050

fbshipit-source-id: 141a673731ceff0092f8f3e4209efb69cf481640
2018-08-14 11:47:57 -07:00
Jeremy Fitzhardinge
7bb36ed4d1 mononoke: use panichandler
Summary:
Set a panichandler by default in cmdlib::get_logger to make sure
everyone gets one set. It configures itself to exit the process so that we
don't leave it in a half-broken state.

The Mononoke server was already using a panic hook, but this replaces it with
one that prints more detail about what was going on at the time.

Reviewed By: StanislavGlebik

Differential Revision: D9234587

fbshipit-source-id: bb51790a60b1ee545a364b4b92e09ec950788684
2018-08-09 10:21:14 -07:00
Zeyi Fan
2db6597e81 add get_changeset operation
Summary: This commit adds support for changeset information retriving at `/<repo>/changeset/<commit hash>`.

Reviewed By: StanislavGlebik

Differential Revision: D8880547

fbshipit-source-id: ed68c577316693e0c685c347405b5d344d1bc87e
2018-07-26 10:09:32 -07:00
Zeyi Fan
cc169fd7b0 add get_tree operation
Summary: This commit adds support for `/<repo>/tree/<treehash>` (retrieving tree content by hash) .

Reviewed By: StanislavGlebik

Differential Revision: D8870870

fbshipit-source-id: 8b3271c819e47d112a8b44097f626360a05540d1
2018-07-26 10:09:32 -07:00
Zeyi Fan
993ffb4d3f add get_blob_content support
Summary: This commit implements the `<repo>/blob/<blobhash>` API that Eden needs.

Reviewed By: StanislavGlebik

Differential Revision: D8870300

fbshipit-source-id: eca9dc434c8fb584dfba1542c5242fbee18e6619
2018-07-26 10:09:32 -07:00
Zeyi Fan
3bc3cecfe3 support ls operation
Summary: This commit adds support to ls operation that lists files in a folder at some commit.

Reviewed By: StanislavGlebik

Differential Revision: D8729389

fbshipit-source-id: cad6d02da075e94b5269cc18052a5a3916ddac86
2018-07-26 10:09:32 -07:00
Zeyi Fan
8ab482ea68 refactor error handling in apiserver
Summary: Refactor the error handling process. Stop using `.context` for adding context. Uses cause instead.

Reviewed By: StanislavGlebik

Differential Revision: D8963269

fbshipit-source-id: d7f18467f5dfa510beaa33657620c2856b45fd1f
2018-07-26 10:09:32 -07:00
Matthew Dippel
5485cbd867 Bookmark support for is_ancestor queries in the API server
Summary:
Added support for queries which use bookmark names in place of node hashes. This involved:
* Creating a method `string_to_bookmark_changeset_id`, which takes a string, treats it as a bookmark, and tries to find the corresponding changeset id in the repo.
* Modifying the `is_ancestor call` in `MononokeRepoActor` to try to interpret the query strings as bookmarks if they can't be interpretted as node hashes.
* Introducing the `cloned` crate from `//common/rust` into the API server to make the above methods cleaner.
* Modifying the integration test to add a bookmark to the test repo and attempt querying using the bookmark name.

Reviewed By: fanzeyi

Differential Revision: D8976793

fbshipit-source-id: 3a2b58cac0fb80ee18fad8529bd58af5b54f85ef
2018-07-26 10:09:31 -07:00
Stanislau Hlebik
13f45ee98e mononoke: fix tests
Summary: There was a change in hg replycaps in D8958866, let's update the tests

Reviewed By: farnz

Differential Revision: D8966069

fbshipit-source-id: 72606943d9751b66705b36fbf39ad7dc0702627c
2018-07-24 02:37:00 -07:00
Matthew Dippel
3fdda29376 Adding support for is_ancestor queries to the Mononoke API server
Summary:
Adding support to the Mononoke API server for naive is_ancestor queries using a BFS.

The API server now supports queries as:
Request URL: "{repo}/is_ancestor/{proposed_ancestor}/{proposed_descendent}"
 where the arguments in the URL are:
    - repo: the name of the repo to query reachability in
    - proposed_ancestor: a 20 byte hex encoded string representing a node hash
    - proposed_descendent: a 20 byte hex encoded string representing a node hash

Response: One of:
    - the string, "true", if 'proposed_ancestor' is an ancestor of 'proposed_descendent' in 'repo'.
    - the string, "false", if the above condition isn't satisfied.
    - an error if the query couldn't be performed

This involved adding:
- new enum values for the MononokeRepoQuery and MononokeRepoResponse structs for 'IsAncestor' queries and responses.
- a dependency on the 'mononoke/reachabilityindex' crate.
- a 'is_ancestor' function to the MononokeRepoActor struct, which delegates queries to a GenerationNumberBFS index.
- appropriate url handling to the server object in main
- New enums to the API server ErrorKind, and appropriate down casting from the ReachabilityIndex ErrorKind.
- Integration tests which made the test repo in test-apiserver.t have a few branches, and queries the API server for reachability of pairs of commits.

Reviewed By: fanzeyi

Differential Revision: D8844221

fbshipit-source-id: 1ba102fede378688243827850ff67aabc587a748
2018-07-23 09:23:07 -07:00
Zeyi Fan
32a0dec031 + [scmquery] renaming blob entrypoint
Summary: This commit renames `/blob/` to `/raw/`. This helps users to distinguish the proposed "get file content by hash" API from the original "get file content by path".

Reviewed By: kulshrax

Differential Revision: D8869635

fbshipit-source-id: 79d9cdaeb7e4e55b3d804d4530fb17835104cc32
2018-07-17 14:09:56 -07:00
Stanislau Hlebik
084994190f mononoke: add test-pushrebase.t
Summary:
Add the integration test for (at the moment) missing pushrebase functionality.
At the moment it doesn't do anything because pushrebase is not implemented yet

Reviewed By: farnz

Differential Revision: D8858185

fbshipit-source-id: c200c9fbfeb3d28d27dd5ab3c4d6bd1145fd9f0b
2018-07-17 13:08:49 -07:00
Zeyi Fan
07f201f93b implement TLS & HTTP2 support
Summary:
This commit added three options to specify locations to SSL certificates so the API server will accept encrypted traffic.

Currently this only works in HTTP/1.1 due to a bug in HTTP/2 parsing in actix-web. Once they fixed the bug upstream we will be able to serve HTTP/2 traffic as well.

Reviewed By: jsgf

Differential Revision: D8703861

fbshipit-source-id: 0d4e68276013a8aeb6ee006e5175b8caeba767cb
2018-07-16 17:07:46 -07:00
Lukas Piatkowski
a274c622b8 blobimport: replace usage of tokio_core with tokio::run
Summary:
There seems to be a deadlock in the internals of the now outdated tokio_core.
After applying the modern tokio::run the deadlock is not being triggered.

Reviewed By: farnz

Differential Revision: D8783183

fbshipit-source-id: 47a7d1d8e2756ea4d40812d0b8a6c850d7f7e9f8
2018-07-16 07:36:54 -07:00
Rain ⁣
5a29953c59 cmds: move creating blobrepo to cmdlib
Summary: This will be useful for the bonsai verification tool.

Reviewed By: StanislavGlebik

Differential Revision: D8792562

fbshipit-source-id: f409d0fa042528b04462a1539fd3c2a8064a4f6e
2018-07-11 18:36:50 -07:00
Pavel Aslanov
2d3f584e65 fix integration tests if proxy is set
Summary: - integration test of were failing on my devserver as `{http|https}_proxy` environment variables

Reviewed By: StanislavGlebik

Differential Revision: D8804505

fbshipit-source-id: fafea55ed80897b24ad816bc26b241e64cd8b913
2018-07-11 08:52:10 -07:00
Lukas Piatkowski
221d51465b hgcli/server: move session_uuid creation to hgcli and log more information
Summary:
hgcli will start logging stuff as well and it will use the same session_uuid as the server.
This also includes logging the user and source hostname.

Reviewed By: farnz

Differential Revision: D8750663

fbshipit-source-id: 7ebc8b6c10b7560d985fd23e9e3f2645f3bd0a1c
2018-07-09 15:39:09 -07:00
Lukas Piatkowski
38b66202cb server: print the session_uuid on the client side
Summary: Session UUID will help identify the issues on Mononoke side whenever the client encounters problems

Reviewed By: StanislavGlebik

Differential Revision: D8732396

fbshipit-source-id: 35d04b0d56be0cfc2c608f08287a2b1d236a96e3
2018-07-04 11:49:54 -07:00
Tim Fox
02ce67d40e Refactor repoconfig to support loading of hooks, and directory per repo
Summary:
This diff refactors the server config repository to support storing and loading of hooks. In the new structure each repo lives in its own directory and the config file for the server is called "server.toml".
Hooks can be referenced by relative or absolute paths allowing either local or common hooks to be loaded.

Reviewed By: StanislavGlebik

Differential Revision: D8625178

fbshipit-source-id: 62c8c515a0fbbf7a38cfc68317300d8f42eb4d7a
2018-07-04 07:07:02 -07:00
Stanislau Hlebik
18d3345c71 mononoke: fix test-gettreepack.t
Summary:
New parameter depth was added. Mononoke just ignores, which if correct, but can
be less efficient. However test-gettreepack.t was failing because it didn't
supply the parameter. This diff fixes it by sending a big depth to the server

P. S.
Attached task tracks the support of depth parameter on Mononoke server-side

Reviewed By: lukaspiatkowski

Differential Revision: D8712906

fbshipit-source-id: 8246344b3fa39f00eb39f2262b4aa5aa74834be2
2018-07-02 05:07:06 -07:00
Stanislau Hlebik
680c1b4fbd mononoke: fix some integration tests
Summary:
They were broken since 2646d41a64917d3e50f662b0b4b628ccfdbb05a8.
It added enabled_repo repository to config, however, no enabled_repo has ever been
blobimported. Since we don't really need enabled_repo, let's remove it

Reviewed By: farnz

Differential Revision: D8712891

fbshipit-source-id: 360f2c9564087d3a8411871335aa40fa81e38c0c
2018-07-02 04:06:06 -07:00
Jeremy Fitzhardinge
1a7ae3ed36 mononoke: add per-repo "enabled" flag
Summary:
Add a per-repo config flag to repos to be configed without being
enabled. Setting "enabled = false" will make Mononoke completely ignore the
repo config. If not present, "enabled" is assumed to be true.

Reviewed By: farnz

Differential Revision: D8647161

fbshipit-source-id: 2646d41a64917d3e50f662b0b4b628ccfdbb05a8
2018-06-29 20:21:36 -07:00
Stanislau Hlebik
d787921c35 mononoke: tls for hgcli and Mononoke server
Summary:
Use tls for connection between hgcli and Mononoke server always, even for
localhost connections[1]

The setup is similar to tls setup of Eden server.

[1] This is not necessary of course, but adding an option to bypass tls
connection may result in accidental use of it in prod. However if it turns out
to be too unusable, we can add such option in the future

Reviewed By: jsgf

Differential Revision: D8644299

fbshipit-source-id: 0898e30e33b718e13a766763479f3adf9323ffe7
2018-06-29 14:37:44 -07:00
Zeyi Fan
8f4e63cc50 Upgrade openssl, enable alpn for actix-web, add tokio-codec
Summary: This commit upgraded openssl, enabled alpn for actix-web and added tokio-codec with fixes due to the upgrade.

Reviewed By: StanislavGlebik

Differential Revision: D8682673

fbshipit-source-id: 8c7cadfd6c0c7b016202f6cb038eb4951d0f9333
2018-06-29 10:57:36 -07:00
Zeyi Fan
e924f7f105 Change file content retrieval API to /<changeset>/<path>
Summary: This commit changes the API from directly asking for NodeHash to changeset id and path of the file.

Reviewed By: StanislavGlebik

Differential Revision: D8628826

fbshipit-source-id: 1fa37cf36db0ca00530f3a60de78da1d1d232398
2018-06-27 17:52:35 -07:00
Zeyi Fan
6ef23f3646 Add /status for Tupperware health check
Summary: This commit adds /status to return ok for Tupperware health check.

Reviewed By: kulshrax

Differential Revision: D8629282

fbshipit-source-id: 8f36bf73d4d9399721c68649e6b475362770889b
2018-06-27 16:47:50 -07:00
Zeyi Fan
528b2bf36f Read filecontent from blobstore
Summary: This commit implements the retrieving logic for the api server.

Reviewed By: StanislavGlebik

Differential Revision: D8507784

fbshipit-source-id: 109b7fad35c5fefca593d04ac63d57534f9bd12b
2018-06-27 13:05:55 -07:00
Stanislau Hlebik
6545e0ee34 mononoke: rename test self-signed certs
Summary:
In the next diffs I'm going to use them in other tests, so the name is no
longer correct. Let's rename it

Reviewed By: jsgf

Differential Revision: D8644295

fbshipit-source-id: 455133b2bfcdfb98f69ae737e1d5f23e9e898c92
2018-06-27 07:52:53 -07:00
Stanislau Hlebik
51ab84156e mononoke: add a simple test for cache warmup
Summary:
Previously this code was completely untested. This diff adds a simple test that
checks that warmup has at least finished

Reviewed By: farnz

Differential Revision: D8611295

fbshipit-source-id: bf55d3b8953660040b4f9a934094fb688683c7ba
2018-06-25 07:36:01 -07:00
Zeyi Fan
eba437040d let apiserver read mononoke config
Summary: This commit lets apiserver reads Mononoke's config repository and creates MononokeRepo based on it.

Reviewed By: kulshrax

Differential Revision: D8465574

fbshipit-source-id: 0af1ad5f62499f83261e21bac605725156fc22d0
2018-06-22 15:36:44 -07:00
Lukas Piatkowski
8cc5514d41 server: refactor the code that reports success of failure of entire request
Summary: With this changes we will always get a sample representing result of handling a request written in scuba, regardless if it was success, failure or timeout.

Reviewed By: StanislavGlebik

Differential Revision: D8579277

fbshipit-source-id: 6c7943bb26c8880e4f3df988dcebd12fd57ed062
2018-06-21 16:53:11 -07:00
Rain ⁣
8b05fd5c16 blobrepo: use thrift blobs for manifests
Summary:
Store manifests as Thrift blobs instead. Required fixing up a lot of
different places, but they should all be pretty clear now.

Reviewed By: farnz

Differential Revision: D8416238

fbshipit-source-id: 523e3054e467e54d180df5ba78445c9b1ccc3b5c
2018-06-20 13:24:56 -07:00
Zeyi Fan
1c4af3bda8 Create initial binary for Mononoke API Server
Summary: This revision adds an initial binary target for Mononoke API Server as well as a few basic options and logging.

Reviewed By: kulshrax

Differential Revision: D8413745

fbshipit-source-id: 65523433284e970348efcafd724ae28102d85671
2018-06-18 10:09:43 -07:00
Stanislau Hlebik
ca15bc472a mononoke: use SinkAsyncWrite in gettreepack
Summary:
Use SinkAsyncWrite that was added in the previous diff.
The main motivation is to make sure that we do not buffer bundle2 response in
memory. For more details look at the summary from the previous diff.

Note that this diff still buffers results in memory, but it prepares the code
for the next diffs, in which we'll finally remove the buffering.

Reviewed By: farnz

Differential Revision: D8379586

fbshipit-source-id: 5985ddb157f7066732ef47a04919eb1fba68c74e
2018-06-14 02:50:18 -07:00
Rain ⁣
388474e1bf rename new_blobimport to blobimport
Summary: The old blobimport is dead.

Reviewed By: farnz

Differential Revision: D8372593

fbshipit-source-id: 63595dbcd3ac6da1cad3c5ae6761ef01be6619ed
2018-06-12 15:40:10 -07:00
Rain ⁣
02c2187851 tests: fix a couple of integration tests
Summary:
`hg pushbackup` got moved to the `infinitepushbackup` extension.

Also fix some minor output changes.

Reviewed By: StanislavGlebik

Differential Revision: D8310862

fbshipit-source-id: ae8d5579dd4082bd91e80beef4a4b675af9a8986
2018-06-07 09:51:31 -07:00
Rain ⁣
26356e4e3d increase the wait timeout in integration tests to 15 seconds
Summary: Unfortunately even 10 seems to be too little for stress runs.

Reviewed By: StanislavGlebik

Differential Revision: D8310639

fbshipit-source-id: 280824a7c2ec2283d2ef3acfb968e336ca13c93b
2018-06-07 09:51:31 -07:00
Rain ⁣
c18bbfa396 fix race with bookmark updates during pulls
Summary: See the comment for a full explanation.

Reviewed By: jsgf

Differential Revision: D8274912

fbshipit-source-id: 936baa60925fff5ddf1e903c8408410c0a429e77
2018-06-05 13:03:04 -07:00
Stanislau Hlebik
171a456691 mononoke: use visited_pruner
Summary: See previous diff for the movitvation

Reviewed By: jsgf

Differential Revision: D8207273

fbshipit-source-id: 527c1d97546afedf36f84059ccb7c740bd412907
2018-06-04 10:28:47 -07:00
Lukas Piatkowski
d0b695406a new_blobimport: buffer_unordered the changesets in main.rs
Summary:
Instead of writing changesets one-by-one run mutiple of them at once.
The size `100` for the buffer is arbitrary, but it shouldn't matter much since we already have backpressure on the database writes.

Reviewed By: farnz

Differential Revision: D8057268

fbshipit-source-id: ca3766505395dcb6be6684323462f1bb23222435
2018-05-21 06:24:12 -07:00
Lukas Piatkowski
1f58bd7060 new_blobimport: print number of uploaded CS every 5000
Summary: printing every CS is too verbose, but we still want to see progress in non-debug mode

Reviewed By: kulshrax

Differential Revision: D7925747

fbshipit-source-id: c3ed92ef8c8fbf7714779a2bf011d31c94aefa37
2018-05-11 12:54:46 -07:00
Stanislau Hlebik
7e540c6dbc mononoke: use tcp instead of unix socket for hgcli
Summary: This allows us to put hgcli on the different host

Reviewed By: jsgf

Differential Revision: D7910980

fbshipit-source-id: 45bdd1ee42b54f8f1a425ed6950e785cdf85bfc3
2018-05-10 02:02:40 -07:00
Stanislau Hlebik
a4e7962ffc mononoke: add a separate connection acceptor thread
Summary:
Curently hgcli can connect to Mononoke only if they are on the same host,
because unix domain socket are used. Also Mononoke has to use separate unix
domain socket for different repos.
The goal of this stack of diffs is to remove these limitations:
1 Make it possible to have hgcli and Mononoke server on different hosts
2 Make it possible to use one port/unix domain socket to connect to many repos.

This diff adds a separate thread that parses the Preamble, extracts the
reponame and sends request to a thread responsible for this repo.

Also hgcli now has a new cmd line option that specifies path to connect to.

Reviewed By: jsgf

Differential Revision: D7845156

fbshipit-source-id: a48bcfeec4755b2d5b3dfcf8e0383e6945178018
2018-05-10 02:02:38 -07:00
Stanislau Hlebik
12968b1b9e mononoke: make it possible to fetch config repo by bookmark
Summary: It will make deploying mononoke considerably easier

Reviewed By: farnz

Differential Revision: D7831620

fbshipit-source-id: 77db867f5ce03975eadea7a8693bc88c1d1122cd
2018-05-03 10:31:32 -07:00
Lukas Piatkowski
346183fa8c blobrepo: fix delta application by applying it on raw content of filenode
Summary: The deltas are meant to be applied on raw filenode content that has incorporated copy/move information. Make it so

Reviewed By: jsgf

Differential Revision: D7777329

fbshipit-source-id: 23ce90269cdf5dbb8a16aab026c031c2af68fccb
2018-04-28 16:33:03 -07:00
Lukas Piatkowski
35656a1e7d blobrepo: use all server side bookmarks as heads for the sake of discovery
Summary: Although this change is breaking with the traditional definition of heads in Mercurial, we decided that using bookmarks as heads is sufficient for fbsource use case as well as it matches the git model where every unnamed branch is garbage collected.

Reviewed By: jsgf

Differential Revision: D7745541

fbshipit-source-id: 2ec716db7799bf7bab8b2b77a85d1521a880f3df
2018-04-25 04:22:19 -07:00
Lukas Piatkowski
800b605a35 bundle2-resolver: multiple pushkey parts for pushing multiple bookmarks
Summary: Being able to push multiple bookmarks in a single hg push is required for using hg push as tailing of fbsource which contains few remote bookmarks

Reviewed By: StanislavGlebik

Differential Revision: D7743737

fbshipit-source-id: ba24445762baafbaa5b3295dc8995fe871f97872
2018-04-24 11:17:06 -07:00
Lukas Piatkowski
5f43055821 integration tests: remove blobimport from integration tests
Summary: new blobimport has taken over integration tests

Reviewed By: StanislavGlebik

Differential Revision: D7710186

fbshipit-source-id: 7d61f3239d8edbb1f458dfde0abf59914a912aeb
2018-04-24 11:17:06 -07:00
Lukas Piatkowski
f28ce26504 blobrepo: handle changesets with null root manifests
Summary: The eden integration test contains a commit with no content which new_blobimport couldn't import. With this changes the commit API is capable of handling such commits.

Reviewed By: jsgf

Differential Revision: D7709243

fbshipit-source-id: 7d55eb2ec421820d189ab05b0f8cb4411f850a7b
2018-04-24 11:17:06 -07:00
Lukas Piatkowski
2187aa38ef blobrepo: fix compute_changed_files bug - use intersection instead of symmetric difference
Summary: The problem in compute_changed_files is that for 2 parents given instead of producing a list of files that were changed in the merge commit from perspective of both parents it produced the opposite of that. This should fix it

Reviewed By: jsgf

Differential Revision: D7708215

fbshipit-source-id: d58457054625beb853f61cb060d25b09279ecceb
2018-04-24 11:17:06 -07:00
Lukas Piatkowski
928356bfc8 integration test: use new blobimport for importing config repo
Reviewed By: StanislavGlebik

Differential Revision: D7708480

fbshipit-source-id: c658ab59356f2e76c4f84a87ddc55c453e8a6413
2018-04-20 12:17:49 -07:00
Lukas Piatkowski
040c1a2b4d integration tests: use newblobimport in integration tests where possible
Summary: After ceasing recomputation of NodeHashes the newblobimport is working in many of our tests as a replacement of blobimport

Reviewed By: sid0

Differential Revision: D7707684

fbshipit-source-id: e7b4391916cd4a37968afd828f456a7b49ecabf9
2018-04-20 12:17:40 -07:00
Siddharth Agarwal
e9854e9d3c tests: increase server start timeout to 10 seconds
Summary:
5 seconds appears to still not be enough for stress test runs,
unfortunately. Try bumping it up a bit more.

Reviewed By: StanislavGlebik

Differential Revision: D7663231

fbshipit-source-id: 8dc82afd64185c12fd98138b96b981b7f0e9173e
2018-04-18 19:53:34 -07:00
Stanislau Hlebik
89befdb26d mononoke: avoid using linknodes
Summary: They are replaced by filenodes

Reviewed By: farnz

Differential Revision: D7443320

fbshipit-source-id: 13c7d07bc00dcbaa991663c8da8a07fcb0de1332
2018-04-13 02:47:24 -07:00
Lukas Piatkowski
d1859f8222 Fix the test that require config metarepo
Reviewed By: farnz

Differential Revision: D7552656

fbshipit-source-id: 89da8c11535fee049ae72a5ed875f7bb994d22e9
2018-04-09 15:07:57 -07:00
Siddharth Agarwal
5faab09fc7 integration tests: drop run_as_bundle mode
Summary:
The current "run_as_bundle" mode is suboptimal because it causes all
the tests to be run within the same integration runner run. This means that
testpilot can't do things like limit the number of tests run in parallel.

With this change, each test will be run as a separate `integration_runner`
instance.

Thanks to DragonMinded for help figuring this out.

Reviewed By: DragonMinded

Differential Revision: D7493887

fbshipit-source-id: 8d55c2a64573b6bc213dac3daf0d78aa3432d430
2018-04-04 13:33:21 -07:00
Siddharth Agarwal
a827e956b8 test-large-path-and-content.t: the data file is sometimes 156 bytes
Summary:
Seems to flap around between 152 and 156 bytes. Not sure why, but it
isn't very relevant for the test anyway.

Reviewed By: farnz

Differential Revision: D7380504

fbshipit-source-id: 91cacb39ed0d67f1df6ac4138f4250c757b5aec3
2018-03-23 08:47:44 -07:00
Lukas Piatkowski
d0e66cc5f7 mercurial: distinguish between NodeHash used in mercurial Revlogs and in Mononoke Blobstore
Summary:
This codemod tries not to change the existing behavior of system, only introduce new types specific to Mercurial Revlogs.
It introduces a lot of copypasta intentionally and it will be cleaned in following diffs.

Reviewed By: farnz

Differential Revision: D7367191

fbshipit-source-id: 0a915f427dff431065e903b5f6fbd3cba6bc22a7
2018-03-22 12:24:35 -07:00
Stanislau Hlebik
296fff8b60 mononoke: support bookmark deletion
Summary:
To do this we have to make changegroup part optional, because `hg push --delete
BOOK` doesn't actually send changegroup at all.

This also fixes the issue with `hg pushbackup` that sends only infinitepush
bookmarks part (see test for details)

Reviewed By: farnz

Differential Revision: D7271596

fbshipit-source-id: 77fa26e176fd4e31f62e0412249a934ee1176ee0
2018-03-21 14:25:08 -07:00
Stanislau Hlebik
6c2bb328aa mononoke: update bookmarks in pushkey part
Summary:
Actually update the bookmarks using pushkey part. Note that bookmark deletion
doesn't currently work. It will be fixed in the next diffs

Reviewed By: farnz

Differential Revision: D7271600

fbshipit-source-id: fd13d1adfd3ea490174c31e23289e8560dc2b737
2018-03-21 14:25:00 -07:00
Stanislau Hlebik
12c9f55b9a mononoke: add listkeys wireproto
Summary:
This wireproto method is used by remotenames to update the list of
remotebookmarks. Implementation is the same as for listkeys bundle2 part.

Reviewed By: farnz

Differential Revision: D7271597

fbshipit-source-id: 8a75a93cae0e571d86d657e1c1d718a7fa0ab4ea
2018-03-21 14:24:55 -07:00
Simon Farnsworth
49ae5d3621 Add a perf test script
Summary:
I want to be able to get perf numbers for the commit API, and to avoid
human error contaminating the numbers I get. Script the test, to be run
manually.

Reviewed By: kulshrax

Differential Revision: D7261639

fbshipit-source-id: d8a39f79fd2362e4ca5e3aac652a4bf2f3cb45c9
2018-03-21 10:06:19 -07:00
Lukas Piatkowski
67dbc75f9d mononoke: add new_blobimport that uses BlobRepo API for importing data
Summary:
The new_blobimport as opposed to the old one do two things differently:
1. It uses a better structured API of RevlogRepo. The old one reads the Revlogs directly and does not verify if the data it has read is correct or it does not let us fix it into canonical form easily (once we have a canonical form different from Revlog's).
2. It uses BlobRepo's Commit API instead of writing directly to storage. This ensures consistency in our code and let's us leverage the validation that is incorporated in Commit API.

Reviewed By: farnz

Differential Revision: D7041976

fbshipit-source-id: fe592524533955f364f1b037109b3b5b5bab6b02
2018-03-20 11:53:09 -07:00
Shannon Zhu
8d850b8a15 Codemod imports from libfb to use full path /scm
Summary:
Codemoding imports from libfb.py of the format "from libfb import X".
This is part of a larger codemod to remove the mapping from libfb/py to libfb,
in the interest of enabling static typechecking in fbcode.

Reviewed By: dark

Differential Revision: D7335696

fbshipit-source-id: f1a1c3b11bec15610ef2bb24cd1c2941f9409b49
2018-03-20 09:46:55 -07:00
Lukas Piatkowski
4d4d90928f integration tests: use RocksDb based blobs rather than File based for testing
Summary: just to excersise our RocksDb blobstore which might come in handy more often than file based as it should be more efficient

Reviewed By: StanislavGlebik

Differential Revision: D7290069

fbshipit-source-id: ce776cfa14e43dc45cca796ef187655ba665d177
2018-03-16 13:41:55 -07:00
Lukas Piatkowski
6462c757bb integration test: add test with file of large length and content
Summary: This test should excercise the situation when a path to a file is hashed when stored in revlog and for a large file the index revlog is split into index and data revlog

Reviewed By: StanislavGlebik

Differential Revision: D7299332

fbshipit-source-id: 6b0f0385e391c8396d5a3702ced5feb1aba2163c
2018-03-16 13:41:55 -07:00
Stanislau Hlebik
b35bd5dd9d mononoke: pushkey part parsing
Summary:
Pushkey part is used to send bookmark updates from hg client to the server.
This diff does all the wireproto parsing, but doesn't actually apply bookmark
updates on the server.

Also this diff "implements" branchmap method. We have no plans to support it,
but currently remotenames extension calls it. So this diff adds a fake
implementation that always returns empty response.

Reviewed By: farnz

Differential Revision: D7150973

fbshipit-source-id: 6889c02a1105127b1805ef1fafa6fbe9c2d57e7d
2018-03-16 04:21:32 -07:00
Stanislau Hlebik
f25bc15119 mononoke: mask the flakiness of test-infinitepush.t
Summary:
I've spent quite some time but wasn't able to get to the bottom of why
test-infinitepush.t has been flaky. For some reason error message

```
Expected Bundle2 Changegroup
```

hasn't made it's way to the hg client. Adding a multisecond delay before
sending the error "fixes" the problem, but I haven't found the actual reason
behind the problem. So since that's not a #1 priority now I suggest to postpone
fixing it for now.

Reviewed By: farnz

Differential Revision: D7246511

fbshipit-source-id: a385130e6bdc978765e04f44c6a536405ee12e02
2018-03-14 03:49:35 -07:00
Stanislau Hlebik
4b22e44847 mononoke: fix flakiness of test-gettreepack.t
Summary:
The reason for flakiness was in unpredictable order of the tree items from
Mononoke. In the first gettreepack call we request two different revisions, and
Mononoke can return them in any order. hg handles it just fine (see updated
test with `hgmn up ...`), but hashes of the tree packs may change.

To remove flakiness let's not rely on the treepack files hash

Reviewed By: farnz

Differential Revision: D7237559

fbshipit-source-id: c04e9d45c41f1d288a90706d0ecc27ede36f8008
2018-03-14 03:49:35 -07:00
Stanislau Hlebik
f4a8559f13 mononoke: fix flakiness of test-eden-server.t
Summary:
It was flaky because server may not yet be ready to accept connections when we
send first request. Sometimes delay needs to be > 1 sec.
Let's query eden server in a loop until it responds.

Reviewed By: farnz

Differential Revision: D7233069

fbshipit-source-id: 8bcb5b2b8ebdc52d2447b33e18580e50c1e27031
2018-03-12 08:45:18 -07:00
Stanislau Hlebik
739933697c mononoke: fix infinitepush test one more time
Reviewed By: lukaspiatkowski

Differential Revision: D7138708

fbshipit-source-id: 700355071ce6dfa677d62d1a45ee9b2698727ed3
2018-03-02 10:45:34 -08:00
Stanislau Hlebik
676762bfea mononoke: fix test
Reviewed By: simonwhitaker

Differential Revision: D7135635

fbshipit-source-id: 75a65b3709fa399bde2ad6ee1ec3ebe620d705b7
2018-03-02 03:00:40 -08:00
Stanislau Hlebik
04e471e453 mononoke: handle infinitepushscratchbookmarks part
Summary:
This is the part that sends client bookmarks to the server. Quite likely we are
not going to process it, so we are just reading the part and ignoring it.

Reviewed By: farnz

Differential Revision: D7123758

fbshipit-source-id: 7ad39bde77b6f77cf6e440e726ac3bdb9f340cea
2018-03-01 08:21:10 -08:00
Stanislau Hlebik
0c4f5bf3f8 mononoke: basic infinitepush implementation
Summary:
Support b2x:infinitepush part. It contains changegroup v2, so just reuse the
normal push path for it.
Note that pushbackup still fails because we don't support
b2x:infinitepushscratchbookmarks part. Also all wireproto params are ignored
for b2x:infinitepush.

Reviewed By: farnz

Differential Revision: D7086120

fbshipit-source-id: 2f98e5d59059ca3c2b82842c98e6dc771c70c6f0
2018-03-01 03:23:46 -08:00
Lukas Piatkowski
d24a501e9e blobrepo: write commit to HeadStore
Summary:
This is a hacky way of getting the push/pull working. We should instead remove the commits that are no longer heads from HeadStore and add those that are the new heads.
In this diff though we add all the commits as heads, just because this does not break the client

Reviewed By: farnz

Differential Revision: D7112279

fbshipit-source-id: 036f0fd230de52e96cbf4168c2cda7c2a1c5bd89
2018-02-28 14:15:13 -08:00
Lukas Piatkowski
995e15697e bundle2-resolver: use (NodeHash, RepoPath) as id for uploaded blobs
Summary:
From upload_entry perspective NodeHash is not unique for uploaded entry, but when combined with RepoPath it is. An example are two files with the same content, but different paths.

Additionally in this diff the requirement for uploaded blobs to be unique is loosened for Manifests, because the b2xtreegroup might contain duplicates of Manifests

Reviewed By: farnz

Differential Revision: D7087863

fbshipit-source-id: 7e9c2438db037fa171f1e65b6882b445e8c09f7a
2018-02-28 11:15:01 -08:00