Commit Graph

178 Commits

Author SHA1 Message Date
Stanislau Hlebik
43e7e847bb mononoke: modernize bookmarks_validator tests
Summary: Let's use fbinit::compat_test, it makes the tests a bit shorter

Reviewed By: ikostia

Differential Revision: D25196759

fbshipit-source-id: bd8aca4b676a71158269195fd35153a0934b0cbc
2020-11-27 09:45:13 -08:00
Pavel Aslanov
938af42e9c convert BlobRepo::get_bonsai.*bookmarks to new futures
Summary: convert `BlobRepo::get_bonsai.*bookmarks` to new futures

Reviewed By: StanislavGlebik

Differential Revision: D25188208

fbshipit-source-id: f071d38cbc74002e7a631d4590137418b1b07a22
2020-11-27 06:49:06 -08:00
Pavel Aslanov
beaca55a40 convert BlobRepo::get_bonsai_heads_maybe_stale to new futures
Summary: convert BlobRepo::get_bonsai_heads_maybe_stale to new futures

Reviewed By: StanislavGlebik

Differential Revision: D25187883

fbshipit-source-id: 78b8202a1e8d101ec69740fee2a8665ccc8334c8
2020-11-27 06:49:06 -08:00
Lukas Piatkowski
fa1a195fd0 mononoke/blobstore: pass CoreContext via borrowed instead of owned value
Summary: Follow up after removing 'static from blobstore.

Reviewed By: StanislavGlebik

Differential Revision: D25182106

fbshipit-source-id: e13a7a31d71b4674425123268e655ae66127f1b7
2020-11-27 03:31:07 -08:00
Lukas Piatkowski
0f54cc3d63 mononoke/blobstore: make Blobstore generic over lifetime
Summary: Remove 'static requirement for async methods of Blobstore, propagate this change and fixup low hanging fruits where the code can become 'static free easily.

Reviewed By: ahornby, farnz

Differential Revision: D24839054

fbshipit-source-id: 5d5daa04c23c4c9ae902b669b0a71fe41ee6dee6
2020-11-20 05:51:52 -08:00
Stanislau Hlebik
dec791e015 mononoke: do not report bookmark validation error if we get an infra error
Summary:
We got a few ubns because one bookmark validator in a single region wasn't able
to connect to mysql and was reporting errors.

This diff fixes by separating logical and infra errors

Reviewed By: ikostia

Differential Revision: D25092364

fbshipit-source-id: 93f4be1a7e0467051b7b8d927eef9b4f5cd6a983
2020-11-19 12:57:50 -08:00
Mark Juggurnauth-Thomas
2a76d65847 derived_data: rename BonsaiDerived::derive03 to derive
Summary: Now that `derive03` is the only version available, rename it to `derive`.

Reviewed By: krallin

Differential Revision: D24900106

fbshipit-source-id: c7fbf9a00baca7d52da64f2b5c17e3fe1ddc179e
2020-11-13 01:48:03 -08:00
Mark Juggurnauth-Thomas
13f119ca89 commit_rewriting: switch to BonsaiDerived::derive03
Reviewed By: krallin

Differential Revision: D24900118

fbshipit-source-id: 68ad4edd051cec76794bbd880fc5f9e0c3716fcd
2020-11-13 01:48:02 -08:00
Thomas Orozco
184310158b mononoke/filestore: update fetch external API to 0.3 futures
Summary:
Like it says in the title. This required quite a lot of changes at callsites,
as you'd expect.

Reviewed By: StanislavGlebik

Differential Revision: D24731299

fbshipit-source-id: e58447e88dcc3ba1ab3c951f87f7042e2b03eb2c
2020-11-06 07:26:03 -08:00
Lukas Piatkowski
a3c2ea6fa0 mononoke/commit_rewriting: fix doc generation
Reviewed By: ahornby

Differential Revision: D24780398

fbshipit-source-id: 79570f6b6959362bcdbc20f425378b7ec460e480
2020-11-06 03:24:20 -08:00
Lukas Piatkowski
3c3de9e954 rust-shed/futures_01_ext: rename futures_ext to futures_01_ext
Summary: As part of the effort to deprecate futures 0.1 in favor of 0.3 I want to create a new futures_ext crate that will contain some of the extensions that are applicable from the futures_01_ext. But first I need to reclame this crate name by renaming the old futures_ext crate. This will also make it easier to track which parts of codebase still use the old futures.

Reviewed By: farnz

Differential Revision: D24725776

fbshipit-source-id: 3574d2a0790f8212f6fad4106655cd41836ff74d
2020-11-05 06:07:16 -08:00
Thomas Orozco
eb8156f8c8 mononoke: flag comment text as text
Summary:
This seems to trip up Cargo builds

```
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `with`
 --> src/lib.rs:365:3
  |
7 | S with version V1
  |   ^^^^ expected one of 8 possible tokens

error: aborting due to previous error
```

Reviewed By: StanislavGlebik

Differential Revision: D24754708

fbshipit-source-id: 0dc5539acf340ac409bf7b6158313c8fec16a275
2020-11-05 03:43:50 -08:00
Stanislau Hlebik
b65c8a15eb mononoke: do not backsync commits if no version is found
Reviewed By: ikostia

Differential Revision: D24648254

fbshipit-source-id: ad00dfd096ec5644d48ebd6593101fa5a8e3e04c
2020-11-04 11:33:22 -08:00
Stanislau Hlebik
14e80fdd77 mononoke: disallow syncing commit with no parents without specifying a version
Summary:
This diff changes semantic of `sync_commit()` function to return an error when
trying to sync a commit with no parents. This is a small code change which has big change
in semantics, and because of that I had to change how backsyncer and
mononoke_x_repo_sync job.

Instead of using `unsafe_sync_commit()/sync_commit()` functions both backsyncer and
`x_repo_sync_job` now use `unsafe_sync_commit_with_expected_version()`
which forces them to specify which version to use for commit with no parents.
And in order to find this version I changed find_toposorted_unsynced_ancestors
to not only return unsynced ancestors but also return mapping versions of their
(i.e. of unsynced ancestors) parents. Given this mapping we can figure out what
version is supposed to be used in `unsafe_sync_commit_with_expected_version()`.

The question raises what to do when a commit doesn't have any synced ancestor and hence we can't decide
which version to use to remap it. At the moment we are using current version (i.e. preserving the existing behaviour).
However this behaviour is incorrect, and so it will be changed in the next diffs

Reviewed By: ikostia

Differential Revision: D24617936

fbshipit-source-id: 6de26c50e4dde0d054ed2cba3508e6e8568f9222
2020-11-04 11:33:22 -08:00
Stanislau Hlebik
58224708fa mononoke: select version for pushrebase commit
Summary:
Previously we were always choosing the current version for remapping via
pushrebase, but this is incorrect. Let's instead select the version based on
what version parent commits used to remap with.

Reviewed By: ikostia

Differential Revision: D24621128

fbshipit-source-id: 2fedc34b706f090266cd43eaf3439f8fb0360d0d
2020-11-04 11:33:22 -08:00
Kostia Balytskyi
6f9d9c5c91 cross_repo_sync reporting: start passing contexts to sync fns
Summary: This is to be able to see in Scuba why a given sync function was called.

Reviewed By: StanislavGlebik

Differential Revision: D24689366

fbshipit-source-id: f868fc1b6fcbf6c692e1373cbe8da8cd4a230780
2020-11-03 05:18:38 -08:00
Simon Farnsworth
fb9283c378 Remove old-style futures from cmdlib::args and fix up build failures
Summary: The more we remove, the easier it'll be to remove the last few problem cases.

Reviewed By: StanislavGlebik

Differential Revision: D24592052

fbshipit-source-id: de6371305991d54bf2802fd904850b49aeb11bbd
2020-10-30 11:55:15 -07:00
Stanislau Hlebik
4b734eaa1d mononoke: return an error if a parent hasn't been remapped
Summary:
This didn't matter much in practice because we've never pushrebased a rewritten
commit where one of the parents rewrites to nothing. Nevertheless I think it's
cleaner to return an error in this case

Reviewed By: ikostia

Differential Revision: D24621105

fbshipit-source-id: 8cf62efd28e0c9aed945f727b1872db6922cfeb3
2020-10-30 10:26:45 -07:00
Stanislau Hlebik
cda77b42c4 mononoke: add unsafe_sync_commit_with_expected_version
Summary:
This stack has a goal of cleaning up how commits with no parents and
consequently merges are treated in CommitSyncer. At the moment it always uses current version
to rewrite them, and this is incorrect. See example below (here N means "new
commits" i.e. commits that weren't remapped yet but we need to remap them now)

```
large repo

O <- uses current version
|
O
|
O  N
|/ |
O  | <-  uses old version
|  N
|  |
O  N <- this commit should be rewritten with old version!
```

With current logic all N commits will use current version for remapping, but
this is incorrect, and instead "old version" should be used. The goal is to fix
it and make it so that backsyncer and x-repo sync job pick the correct version
to use for remapping.

-----

As it was noted in the previous diff we need a function that overrides a
version for a commit with no parents. We need this function because for a
commit with no parents CommitSyncer can't decide which mapping version to use
because, well, there are no parents which could have hinted about the version.

So let's add this function and cleanup unsafe_sync_commit_impl function to
apply version override only to a commit with no parents. If commit has parents then we'd verify that the version from parents matches the expected version.

In the next diffs I'll make it so that if a version for commit with no parents is not specified then
unsafe_sync_commit_impl fails rather than uses current version.

Reviewed By: ikostia

Differential Revision: D24617953

fbshipit-source-id: a68f837da9d90bb18034f628b7880482a2e548b7
2020-10-30 10:26:45 -07:00
Kostia Balytskyi
608bd5a40f remove redundant clones
Reviewed By: farnz

Differential Revision: D24647186

fbshipit-source-id: 91d888bbc706886e011d04c9fa2758794f5f7cfa
2020-10-30 05:56:40 -07:00
Kostia Balytskyi
8540105a10 cross_repo_sync: log commit syncs
Summary:
This adds some basic Scuba logging to commit sync logic in Mononoke. This can be disabled via a tunable.

Note: of course, the wrapping of logging functions would have been pretty cool to do in a macro, but I don't have time atm to figure it out, so have just code.

Reviewed By: StanislavGlebik

Differential Revision: D24571702

fbshipit-source-id: f8830fc675a2a62d2204671e86ab2c819372c5cc
2020-10-30 05:56:40 -07:00
Kostia Balytskyi
9d09b815c1 CommitSyncer: add wiring for Scuba reporing support
Summary: This adds a `ScubaSampleBuilder` field to the `CommitSyncer` and ensures this field is instantiated with correct values (real vs discarding sample) depending on circumstances.

Reviewed By: StanislavGlebik

Differential Revision: D24539732

fbshipit-source-id: 37aedcff9aefcfcd6b740a0491ab35f9e5ce7c77
2020-10-30 05:56:40 -07:00
Stanislau Hlebik
80b25797d8 mononoke: remove test_unsafe_sync_commit function
Summary:
Functionality of this function can be replaced with
unsafe_always_rewrite_sync_commit, so let's do that.

However in the next diff we'll need a function similar to
test_unsafe_sync_commit but with a slightly different semantics - instead of
forcing override for every commit we'll just force it for a commit with no
parents. Because of that let's not remove unsafe_sync_commit_impl function.

Reviewed By: ikostia

Differential Revision: D24616824

fbshipit-source-id: 6969145d98cd23604920a6b490bf7ffe47938c08
2020-10-30 04:06:47 -07:00
Kostia Balytskyi
3ff917ad64 remove get_current_reverse_mover_DEPRECATED
Reviewed By: farnz

Differential Revision: D24563248

fbshipit-source-id: cabcf29e2874e9a46b82bc118a1f08633ae46443
2020-10-29 07:48:37 -07:00
Kostia Balytskyi
e606572eb3 cross_repo_sync: get rid of CommitSyncerArgs
Summary:
`CommitSyncerArgs` was useful when `CommitSyncer` did not have a way to query
existing configs from the configerator. Now that `SyncDataProvider` is part of
`CommitSyncer`, we can get rid of `CommitSyncerArgs`, which will also make
further improvements more convenient.

Reviewed By: StanislavGlebik

Differential Revision: D24565773

fbshipit-source-id: 4dd507b06d946c6018a4a4e8d5e77c6b27abe195
2020-10-27 17:00:08 -07:00
Kostia Balytskyi
e23991ca4a SyncedCommitMappingEntry: make constructor take ..Version instead of Option<..Version>
Summary: A better fix would be to also get rid of `Option` in the struct itself, but I don't want to spend any more time on this atm, and this change is a clear improvement.

Reviewed By: StanislavGlebik

Differential Revision: D24538309

fbshipit-source-id: 6190c6936dc34d996ecd3d700e5f71282d45f651
2020-10-27 11:45:02 -07:00
Stanislau Hlebik
e76fa7ff9d mononoke: remove unused clone
Reviewed By: krallin

Differential Revision: D24564862

fbshipit-source-id: a03a0c5ba677bb11dce11bf06f259f6bd43dd54f
2020-10-27 09:13:43 -07:00
Alex Hornby
a2ded99cf2 mononoke: update Phases::add_reachable_as_public to futures03
Summary:
update Phases::add_reachable_as_public to futures03

With this change all the Phases methods are futures03

Reviewed By: krallin

Differential Revision: D24531552

fbshipit-source-id: e9201621b798739d4d7dd197f15188103e9d359a
2020-10-27 08:06:12 -07:00
Kostia Balytskyi
7f5fb3c574 cross_repo_sync: start borrowing more instead of cloning
Summary:
Fewer clones, better code.

Note that in some cases we would previously have a fn that takes `ctx` by
ownership and just passes it through to some other fn outside of the
`cross_repo_sync`. I triead to make all such functions borrow and clone instead
in order to push cloning to the leaf fns of `cross_repo_sync`.

Reviewed By: StanislavGlebik

Differential Revision: D24538028

fbshipit-source-id: 8a3e78d4076b34d8b1767cdee1db3fdbb7acb4f7
2020-10-27 04:19:51 -07:00
Alex Hornby
7b278b8bed mononoke: update Phases::get_public to futures03
Summary: update Phases::get_public to futures03

Reviewed By: krallin

Differential Revision: D24531550

fbshipit-source-id: ff60e178a58be6cc2a156b4a3685035c6a372785
2020-10-27 03:50:41 -07:00
Simon Farnsworth
7e06175e61 Make config store always explicit
Summary: In D24447404, I provided some utility functions that allowed me to avoid constructing and/or passing around a ConfigStore. Remove those functions and fix up the code to run.

Reviewed By: krallin

Differential Revision: D24502692

fbshipit-source-id: 742dbc54fbcf735895d6829745b9317af14dfa0b
2020-10-24 06:23:49 -07:00
Simon Farnsworth
00871310a7 Ensure we have only one ConfigStore for the application
Summary: It's designed as a singleton store for normal use - rather than have lots of ways to get different config stores, let's use one global store

Reviewed By: krallin

Differential Revision: D24447404

fbshipit-source-id: 6ecc46351b14794471f654cec98527a11a93d3ef
2020-10-24 06:23:49 -07:00
Pavel Aslanov
23fc168668 convert ManifestOps to new style futures
Summary:
- convert ManifestOps to new style futures
- at this point `//eden/manifest:manifest` crate is completely free from old style futures

Reviewed By: krallin

Differential Revision: D24502214

fbshipit-source-id: f1cdb11bd8234f22af5c905243f71e1e9fca11f1
2020-10-23 06:42:35 -07:00
Kostia Balytskyi
0f104b8b00 commit_rewriting: make CommitSyncConfigVersion serializable into mysql
Summary: Somewhat more convenient to work with, no need to look inside.

Reviewed By: StanislavGlebik

Differential Revision: D24474898

fbshipit-source-id: 7ee0920e7d0d5a2102c68695a5cc0d9e237d958d
2020-10-23 04:59:49 -07:00
Kostia Balytskyi
65f806fa2a cross_repo_sync: don't expect Option<CommitSyncConfigVersion>
Summary: We know it's there.

Reviewed By: StanislavGlebik

Differential Revision: D24449015

fbshipit-source-id: 3ce402b21ce1b8bd4f28980d42f86651bf77c68f
2020-10-22 02:44:09 -07:00
Stanislau Hlebik
d4326273a7 mononoke: change debug logging to info
Summary:
I removed --debug flag for bookmarks validator on tw because it was too spammy,
but now we get no output at all. Let's make it info so that we can see it in tw
output

Reviewed By: ikostia

Differential Revision: D24445829

fbshipit-source-id: d37c41be46794867f91ecf66f0318e7b2d660d85
2020-10-21 05:53:09 -07:00
Stanislau Hlebik
aa743595ad mononoke: fix ordering in the error message
Summary: As we saw today it was showing entries in incorrect order

Reviewed By: ikostia

Differential Revision: D24418800

fbshipit-source-id: c926c7904338ae40b26fe08cb1ac973e384bad28
2020-10-20 07:41:48 -07:00
Stanislau Hlebik
01a41013e1 mononoke: remove noisy logging
Summary: It's very spammy

Reviewed By: ikostia

Differential Revision: D24418801

fbshipit-source-id: 35c804764e9f65a49ba73a0d983636665dae1841
2020-10-20 07:41:48 -07:00
Kostia Balytskyi
2da4ec1801 x-repo validation: make it work in both directions
Summary:
Prior to this diff, validation logic did not work when target repo was a large
one (although this limitation wasn't advertised). This was becase we explicitly
never apply a `Mover` to the target repo paths and therefore expect every
single target repo path to have an equivalent in the source repo. This is true
when the target repo is small, but not true when it is large.

It is pretty easy to make this logic direction-agnostic: just proactively check
whether target repo paths rewrite into nothingness or not.

Reviewed By: StanislavGlebik

Differential Revision: D24399029

fbshipit-source-id: 9ca5bb03760e662ff6756c27c0c77204abdb38de
2020-10-20 02:13:39 -07:00
Kostia Balytskyi
65c55d0038 megarepotool: add check-push-redirection-prereqs subcommand
Summary: This command will help us understand if it is safe to enable push-redirection with a certain CommitSyncConfigVersion,

Reviewed By: StanislavGlebik

Differential Revision: D24345898

fbshipit-source-id: c2a4c034a9203025ce3534986b3bb986784ff2b1
2020-10-19 15:16:27 -07:00
Stanislau Hlebik
9ec52564c7 mononoke: force users to specify mapping version in
Summary:
Previously it was just taking the current version. Instead of guessing let's
allow users to specify whatever version they want to rewrite it with.

Reviewed By: ikostia

Differential Revision: D24360918

fbshipit-source-id: d9f4c55cd66931a9f2ab7da3474d2152d77525d0
2020-10-19 09:46:29 -07:00
Stanislau Hlebik
631d1da786 mononoke: remove update_mapping method
Summary:
update_mapping method was silently setting current mapping version. This was
very error-prone and we had a replacement update_mapping_with_version. This
diff removes update_mapping completely.

Reviewed By: krallin

Differential Revision: D24360105

fbshipit-source-id: 57761f4279f75032e9d4ec88a45e5199e250247a
2020-10-19 09:46:29 -07:00
Kostia Balytskyi
0ae6fcbddb cross_repo_sync: tweak validation logging
Summary: Log more stuff at `debug!`.

Reviewed By: StanislavGlebik

Differential Revision: D24361631

fbshipit-source-id: fb4d46eac11ef70a9a1ee8645ed0efcc4035b594
2020-10-16 10:45:45 -07:00
generatedunixname89002005325677
3bd11a5817 Daily arc lint --take RUSTFMT
Reviewed By: zertosh

Differential Revision: D24357892

fbshipit-source-id: dec7969a8bb9302689e4a10656a60e1a38daef80
2020-10-16 10:41:29 -07:00
Stanislau Hlebik
4931e6654b mononoke: add a tool that backfills noop mapping
Summary:
The x-repo usually have "noop" mapping i.e. mapping that doesn't change the
paths (it might have arbitrary name though)

It's useful for commits that are identical between small and large repo to be
able to backfill this mapping. This diff adds a command to do that.

Reviewed By: krallin

Differential Revision: D24337281

fbshipit-source-id: 89a058f95677e4a5c8686122a317eadf8b1bb995
2020-10-16 08:47:04 -07:00
Stanislau Hlebik
4e0280a42e mononoke: refactor waiting for replication from run_mark_not_synced
Summary: It will be used in the next diff, so let's move it to a separate function.

Reviewed By: krallin

Differential Revision: D24334717

fbshipit-source-id: e50d13d45c633397504cf08954f2ced9ace8f570
2020-10-16 08:47:04 -07:00
Stanislau Hlebik
9810413295 mononoke: use sync_commit_and_ancestors in mononoke_x_repo_sync_job once
Summary:
Except for the tail mode of x_repo_sync_job which we use normally there's also
"once" mode which means "sync a single commit". Previously it did just that -
synced a single commit and failed if parents of this commit weren't synced.

However this is very unpleasant to use - instead let's change the semantics to
sync the commit and all of its ancestors.

also I made target_bookmark an optional parameter - sometimes we just want to sync a commit without any bookmarks at all.

Reviewed By: mitrandir77

Differential Revision: D24135771

fbshipit-source-id: 341c1808a44c58f89536b8c07394b77d8ced3f37
2020-10-16 02:37:45 -07:00
Kostia Balytskyi
8a98c4aefc megarepotool: add run-mover subcommand
Summary: This allows the user to see how the mover of a particular version operates on any given path.

Reviewed By: StanislavGlebik

Differential Revision: D24335975

fbshipit-source-id: f67847112eb0d3c8c49584604e2f9d93579cdde4
2020-10-15 12:12:13 -07:00
Kostia Balytskyi
6df7c71340 commit_rewriting: remove confusing log
Reviewed By: StanislavGlebik

Differential Revision: D24305253

fbshipit-source-id: a246ebb32e433cdc3a5587d78a0b59022d34e4c5
2020-10-15 09:41:33 -07:00
Stanislau Hlebik
f3da887700 mononoke: fix movers behaviour when we have preserved paths
Summary:
Current large to small movers do not cover some of the edge cases, and this
diff attempts to fix them. More details are in the comment

Reviewed By: aslpavel, ikostia

Differential Revision: D24328574

fbshipit-source-id: 35cceff61f21603baf446d83e8daa4bda2f17d2a
2020-10-15 06:20:33 -07:00