Commit Graph

1144 Commits

Author SHA1 Message Date
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
Stanislau Hlebik
045623e7c7 mononoke: move getbundle response creation in bundle2resolver
Summary: We are going to use it in pushrebase as well

Reviewed By: lukaspiatkowski

Differential Revision: D9635432

fbshipit-source-id: 5cbe0879d002d9b6c21431b0938562357347a67f
2018-09-06 06:53:57 -07:00
Stanislau Hlebik
7a5b393f88 mononoke: replace Arc<BlobRepo> with BlobRepo
Summary: Arc<BlobRepo> is useless, because BlobRepo is cloneable.

Reviewed By: farnz

Differential Revision: D9654256

fbshipit-source-id: ec54d7669c17732112bee2ba4202b6eafd31bfae
2018-09-06 05:23:35 -07:00
Simon Farnsworth
0ad8dcc0da Split asynchronize into useful components
Summary:
`asynchronize` does two conceptually separate things:

1. Given a closure that can do blocking I/O or is CPU heavy, create a future
that runs that closure inside a Tokio task.
2. Given a future, run it on a new Tokio task and shuffle the result back to
the caller via a channel.

Split these two things out into their own functions - one to make the future,
one to spawn it and recover the result. For now, this is no net change - but
`spawn_future` is likely to come in useful once we need more parallelism than
we get from I/O alone, and `closure_to_blocking_future` at least signals intent
when we allow a long-running function to take over a Tokio task.

Reviewed By: jsgf

Differential Revision: D9635812

fbshipit-source-id: e15aeeb305c8499219b89a542962cb7c4b740354
2018-09-05 12:23:49 -07:00
Simon Farnsworth
7fd5851f1e Use blocking in asynchronize as well as spawning a task
Summary:
`asynchronize` currently does not warn the event loop that it's
running blocking code, so we can end up starving the thread pool of threads.

We can't use `blocking` directly, because it won't spawn a synchronous task
onto a fresh Tokio task, so your "parallel" futures end up running in series.
Instead, use it inside `asynchronize` so that we can pick up extra threads in
the thread pool as and when we need them due to heavy load.

While in here, fix up `asynchronize` to only work on synchronous tasks and
push the boxing out one layer. Filenodes needs a specific change that's
worth extra eyes.

Reviewed By: jsgf

Differential Revision: D9631141

fbshipit-source-id: 06f79c4cb697288d3fadc96448a9173e38df425f
2018-09-05 12:23:49 -07:00
Simon Farnsworth
6eb6e4543d Add a test for asynchronize
Summary:
We have suspect timings in Mononoke where `asynchronize` is used to
turn a blocking function into a future. Add a test case to ensure that
`asynchronize` itself cannot be causing accidental serialization.

Reviewed By: jsgf

Differential Revision: D9561367

fbshipit-source-id: 14f03e3f003f258450bb897498001050dee0b40d
2018-09-05 12:23:49 -07:00
Sebastian Lund
ee92a7f421 mononoke: return root asap in get_change_manifests_stream if max_depth=1
Summary: In case `max_depth=1` we should only return the topmost entry, which in this case always is the root-entry. This fixes it so that we always return-fast in case `max_depth=1`.

Reviewed By: StanislavGlebik

Differential Revision: D9614259

fbshipit-source-id: a6b82bd5aac74d004f61a07bc24f5d26e5c56412
2018-09-03 11:36:57 -07:00
Stanislau Hlebik
0403dba05c mononoke: remove unused options
Reviewed By: lukaspiatkowski

Differential Revision: D9627883

fbshipit-source-id: b235cb272f93178c942ebf662d77ca73c3790a40
2018-09-03 04:06:14 -07:00
Arun Kulshreshtha
d9a491b1d8 Use tokio::timer::Timeout
Summary: The latest release of `tokio` updates `tokio::timer` to include a new `Timeout` type and a `.timeout()` method on `Future`s. As such, our internal implementation of `.timeout()` in `FutureExt` is no longer needed.

Reviewed By: jsgf

Differential Revision: D9617519

fbshipit-source-id: b84fd47a3ee4fc1f7c0a52e308317b93f28f04da
2018-08-31 15:37:30 -07:00
Arun Kulshreshtha
2dc93d6a5f refactor actors to simple struct
Summary: While I was working on `actix-srserver`, I realized the current design of the API server is quite unnecessary. The "MononokeActor" and "MononokeRepoActor" are only returning futures without much CPU computation cost. So it don't need to be placed in a separate thread.

Reviewed By: jsgf

Differential Revision: D9472848

fbshipit-source-id: 618ec39c42d90717fa6985fee7d6308420962d3f
2018-08-31 14:07:17 -07:00
Jeremy Fitzhardinge
ed34b17e1a mononoke: hgproto: make encoding response take ownership of the response
Summary: It avoids a heap of copies

Reviewed By: StanislavGlebik

Differential Revision: D9595689

fbshipit-source-id: a64f0a383acd517830d08cf0be9fc0a1b6903382
2018-08-31 10:23:49 -07:00
Jeremy Fitzhardinge
d8ad00442d mononoke: hgproto: little cleanups
Reviewed By: StanislavGlebik

Differential Revision: D9595691

fbshipit-source-id: eaf8223253ebdc6828758041b1126745aa58d462
2018-08-31 10:23:48 -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
Stanislau Hlebik
904e4ee900 mononoke: decrease getfiles buffer
Summary:
Looks like we shouldn't have raised in the first place. Big getfiles buffer
causes OOMs on the servers. Also memory profiling shows that quite often most
of the Mononoke server's memory is used for serving remotefilelog requests.

Reviewed By: purplefox

Differential Revision: D9601990

fbshipit-source-id: 356a65d0749b064486436fb737bd5a47b3beecfa
2018-08-31 01:36:23 -07:00
Jeremy Fitzhardinge
4021018efc tp2: rust: update rust-crates-io
Summary: Need new version of tokio.

Reviewed By: kulshrax

Differential Revision: D9598352

fbshipit-source-id: e2e217e6b7d18354cf9725cb59e9e32ed153a124
2018-08-30 17:37:32 -07:00
Sebastian Lund
8d3b5bfb19 mononoke: add bookmark get support to admin tool
Summary:
Add the ability to get bookmarks using the mononoke admin tool.

Usage: `mononoke_admin --repo-id <repo-id> bookmarks get --changeset-type <hg|bonsai> <BOOKMARK_NAME>`

The changeset-type defaults to HG.

Reviewed By: StanislavGlebik

Differential Revision: D9556742

fbshipit-source-id: c5e64981947aabb9059295622501bc359ed57cc6
2018-08-30 04:22:20 -07:00
Sebastian Lund
2ac12dbe08 mononoke: add bookmark set support to admin tool
Summary:
Add the ability to set bookmarks using the mononoke admin tool.

Usage: `mononoke_admin --repo-id <repo-id> bookmarks set <BOOKMARK_NAME> <HG_CHANGESET_ID>`

Reviewed By: StanislavGlebik

Differential Revision: D9539550

fbshipit-source-id: 7114a6a51711eae6784eb30d820c2ce11672679c
2018-08-30 04:22:20 -07:00
Stanislau Hlebik
14e0804798 mononoke: handle pushkeys in pushrebase
Summary:
Pushkey parts can be sent as part of pushrebase. Phases pushkeys are ignored
because we don't yet support them in Mononoke.
It's not really clear what to do with bookmark pushkey parts, since we are
already moving the `onto` bookmark. For now I suggest to ignore moves of the
`onto` bookmark, and error if there is a pushkey of another bookmark.

Reviewed By: farnz

Differential Revision: D9554385

fbshipit-source-id: 07aff1bd9034c0f2d56a2a5a66ea33c91835ef98
2018-08-29 07:07:36 -07:00
Stanislau Hlebik
181388e584 mononoke: add context to the errors
Summary:
I was debugging pushrebase bugs, and the only error I got was
'oneshot::Cancelled'. Let's add a bit more context around it

Reviewed By: farnz

Differential Revision: D9554384

fbshipit-source-id: b3111ef1b5c743d65740f7fa3fd1a92eef9ab784
2018-08-29 07:07:36 -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
Jeremy Fitzhardinge
916d8b6813 rust/failure_ext: move slogkv into submodule
Summary: Avoid cluttering top-level module.

Reviewed By: farnz

Differential Revision: D9394195

fbshipit-source-id: ae7b6e7c182eaf50cfad075cee4b0775c1df0e68
2018-08-20 12:37:04 -07:00
Zeyi Fan
300047c2fa add thrift client
Summary: Added a thrift client library and binary for Mononoke API Server that allows us to play with the API Server's thrift port.

Reviewed By: farnz

Differential Revision: D9110899

fbshipit-source-id: 603cc5e2b5e0419a73c9eccb35f8c95455ada9ce
2018-08-19 16:07:12 -07:00
Zeyi Fan
dcf0665484 add cat_file in thrift
Summary: Add `get_raw` in thrift part.

Reviewed By: StanislavGlebik

Differential Revision: D9094301

fbshipit-source-id: 23bbfa6fb653e07ca687ff8e21da8ae5fca3333e
2018-08-19 16:07:12 -07:00
Zeyi Fan
0fcfbda8b1 add fb303 thrift server
Summary: This commit adds a basic thrift server that responds to fb303 status check queries to Mononoke API Server.

Reviewed By: farnz

Differential Revision: D9092291

fbshipit-source-id: d1e4ddb280c252f549d40a0bb03d05afccbf73b8
2018-08-19 16:07:12 -07:00
Zeyi Fan
c1b1005d91 clean up HgBlob and HgBlobHash
Summary: This commits change `HgBlob` from an enum into a struct that only contains one Bytes field, completely removes `HgBlobHash` and changes the methods of `HgBlob` from returning `Option`s into directly returning results.

Reviewed By: farnz

Differential Revision: D9317851

fbshipit-source-id: 48030a621874d628602b1c5d3327e635d721facf
2018-08-19 15:52:34 -07:00
Alex Maloney
1496846903 Futures split Stats into FutureStats and TimedStats
Summary: Since this data is specific to TimedStream and not TimedFuture I split the Stats struct into FutureStats and StreamStats

Reviewed By: StanislavGlebik

Differential Revision: D9355421

fbshipit-source-id: cc2055706574756e2e53f3ccc57abfc50c3a02ba
2018-08-17 13:07:24 -07:00
Lukas Piatkowski
09a8d9430f manifest utils: use structure rather than closure to represent pruner and implement DeletedPruner
Summary: gettreepack doesn't care for deleted entries, only about added or modified ones

Reviewed By: StanislavGlebik

Differential Revision: D9378909

fbshipit-source-id: 2935e6b74fbb0208f7cf89ab4b1e761bb9c6000b
2018-08-17 09:07:27 -07:00
Lukas Piatkowski
2d92742e38 gettreepack: handle the depth parameter being send by client
Reviewed By: StanislavGlebik

Differential Revision: D9378908

fbshipit-source-id: 980e625765803c7cac9a272f3e701a3b2fa8da28
2018-08-17 09:07:26 -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
8bba54d313 mononoke: change RangeNodeStream to use ChangesetId
Summary:
Revsets must use ChangesetId, not HgNodeHash. I'm going to use
`RangeNodeStream` in pushrebase so I thought it was a good time to change it

Reviewed By: farnz

Differential Revision: D9338827

fbshipit-source-id: 50bbe8f73dba3526d70d3f816ddd93507db99be5
2018-08-17 06:51:52 -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
Jeremy Fitzhardinge
24526e8396 mononoke/repo_client: fix typo
Summary: Fix spelling of Inconsistent

Reviewed By: StanislavGlebik

Differential Revision: D9357204

fbshipit-source-id: 4cc5d8d99c28dce9b25f0d334e1820709b3ccc4c
2018-08-16 10:37:02 -07:00
Jeremy Fitzhardinge
4578755d8b mononoke: ignore errors on logview slog drain
Summary:
Sometimes the scribe writes can fail due to backpressure, so just drop
them while still logging to stdout.

Reviewed By: StanislavGlebik

Differential Revision: D9355416

fbshipit-source-id: 8cebe61b1ccfe802fcff686102096d1c9291aa1a
2018-08-16 10:37:02 -07:00
Jeremy Fitzhardinge
3c7533ae33 mononoke: small cleanups in repo_listener
Summary:
Added some comments and fixed a couple of little style issues.
Log when warmup prefetching starts and ends.

Reviewed By: StanislavGlebik

Differential Revision: D9355414

fbshipit-source-id: b16ac267cc0abda01ab445ca3e5de34c17f680a7
2018-08-16 10:37:02 -07:00
Jeremy Fitzhardinge
56e65f252c mononoke: remove redundant error module
Summary: No need for a whole file for a single use statement.

Reviewed By: StanislavGlebik

Differential Revision: D9349613

fbshipit-source-id: 511985201e0799a0c4f0847d14a7c439fa249687
2018-08-16 10:37:02 -07:00
Simon Farnsworth
046fc8c019 Use select_all instead of a chain of select statements
Summary:
Caught by inspection - this builds up a long linked list of streams
to evaluate, where `select_all` has a vector and uses `FuturesUnordered` to
optimize which stream to check next.

Reviewed By: lukaspiatkowski

Differential Revision: D9359932

fbshipit-source-id: 83e645cc5f17a6376d0f0925b88cb390caf3dc4f
2018-08-16 08:36:53 -07:00
Simon Farnsworth
5fbc6ddf66 Rebalance cachelib less frequently
Summary:
Rebalancing causes cachelib to do early eviction of a slab in order to
increase hit rate in the cache as a whole. Now that we have much larger caches,
doing this infrequently makes sense - increase from every 10 seconds to every 5
minutes.

This will decrease the frequency of rebalancing logs

Reviewed By: StanislavGlebik

Differential Revision: D9343958

fbshipit-source-id: 42a33ac310083585318c1fc503bf0b1717b9fb61
2018-08-16 04:36:46 -07:00
Stanislau Hlebik
2c8d98447d mononoke: revert D8959535
Summary:
It makes startup unbearably slow, and doesn't add any benefits at all. Revert
it

Reviewed By: purplefox

Differential Revision: D9358741

fbshipit-source-id: 26469941304f737c856a6ffca5e577848ad30955
2018-08-16 03:06:14 -07:00
Stanislau Hlebik
b4ebd9f8ac mononoke: fix blobimporting of bookmarks
Summary:
We need to look for bonsai changeset only if it exists, otherwise blobimport
will just fail

Reviewed By: aslpavel, farnz

Differential Revision: D9358689

fbshipit-source-id: fc42fbe161670d46e1fb46ef2bea98ad9faea0a2
2018-08-16 02:51:56 -07:00
Rain ⁣
2203a158e1 cmdlib: switch from BlobRepo to MononokeRepo
Summary: This is more general, and allows one to call `RepoClient` methods.

Reviewed By: farnz

Differential Revision: D9318658

fbshipit-source-id: 09b2e64bc0d423eafcb381902e03f349fc666a41
2018-08-15 23:36:19 -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
Rain ⁣
7f039b5c63 repo_client: Arc<BlobRepo> -> BlobRepo
Summary: Remove `Arc<BlobRepo>` from more places since `BlobRepo` will do its own internal `Arc`ing.

Reviewed By: StanislavGlebik

Differential Revision: D9317987

fbshipit-source-id: 899e8b2ede278e62a83e64c144eb18c8cc7e57c6
2018-08-15 23:36:18 -07:00
Zeyi Fan
6a27deae88 remove fetch_file_content_and_renames_from_blobstore
Summary: This function is unnecessary.

Reviewed By: farnz

Differential Revision: D9308779

fbshipit-source-id: a8d0520f8c815a22690af054d938c1f58cf90715
2018-08-15 11:31:56 -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
Jeremy Fitzhardinge
3a28aeef53 mononoke: start passing CoreContext around.
Summary: Introduce CoreContext to replace separate log/scuba/trace things.

Reviewed By: StanislavGlebik

Differential Revision: D9322150

fbshipit-source-id: fe65c8e0c601ba0fe00ef7e6bfa226f0d9c78dd0
2018-08-15 11:31:54 -07:00
Jeremy Fitzhardinge
368318b006 mononoke: define CoreContext
Summary: Beginnings of a container with various essential bits.

Reviewed By: StanislavGlebik

Differential Revision: D9322148

fbshipit-source-id: b69bd17aa88acd69e81b90e9a1efb672247dc887
2018-08-15 11:31:54 -07:00
Jeremy Fitzhardinge
65972b99b3 mononoke: move repo_listener into server
Summary:
It's really part of the server, and isn't likely to be useful
elsewhere.

Reviewed By: StanislavGlebik

Differential Revision: D9322149

fbshipit-source-id: 0dc3ca41f2779b3cc9e1c32f8e09e369038c3d53
2018-08-15 11:31:54 -07:00