Commit Graph

1121 Commits

Author SHA1 Message Date
Harvey Hunt
cce86abf14 mononoke: lfs_server: Enforce ACL checks on a per repo basis
Summary:
Update the LFS server to use the `enforce_lfs_acl_check` to enforce
ACL checks for specific repos and also reject clients with missing idents.

In the next diff, I will use the existing LFS server config's
`enforce_acl_check` flag as a killswitch.

Reviewed By: krallin

Differential Revision: D22762451

fbshipit-source-id: 61d26944127711f3503e04154e8c079ae75dc815
2020-07-27 11:04:59 -07:00
Stanislau Hlebik
97cc687069 mononoke: add an option to disable leases in backfill_derive_data
Summary:
Let's by default not take a lease so that derived_data_tailer can make progress even if all other services are failing to derive.

One note - we don't remove the lease completely, but rather we use another lease that's separate from the lease used by other mononoke services. The motivation here is to make sure we don't derive unodes 4 times - blame, deleted_file_manifest and fastlog all want to derive unodes, and with no lease at all they would just all derive the same data a few times. Deriving unodes a few times seems undesirable, so I suggest to use a InProcessLease instead of no lease.

Reviewed By: krallin

Differential Revision: D22761222

fbshipit-source-id: 9595705d955f3bb2fe7efd649814fc74f9f45d54
2020-07-27 07:13:30 -07:00
Mark Thomas
89bc34035b scuba: add log sequence numbers
Summary:
Add log sequence numbers to the scuba sample builder.  This provides an ordering
over the logs made by an individual instance of Mononoke, allowing them to be
sorted.

Reviewed By: krallin

Differential Revision: D22728880

fbshipit-source-id: 854bde51c7bfc469677ad08bb738e5097cb05ad5
2020-07-27 07:10:07 -07:00
Simon Farnsworth
a40a8f36b7 Asyncify MultiplexedBlobstore
Summary:
We have two deficiencies to correct in here; modernise the code without changing behaviour first to make it easier to later fix them.

Deficiency 1 is that we always call the `on_put` handler; we need a mode that doesn't do that unless a blobstore returns an error, for jobs not waiting on a human.

Deficiency 2 is that we accept a write after one blobstore accepts it; there's a risk of that being the only copy if a certain set of race conditions are met

Reviewed By: StanislavGlebik

Differential Revision: D22701961

fbshipit-source-id: 0990d3229153cec403717fcd4383abcdf7a52e58
2020-07-27 06:09:47 -07:00
Stanislau Hlebik
fd153acdef mononoke: make it possible to build sparse skiplist
Summary:
as in title.

Since we haven't tested it much yet I've added a note that this feature is
experimental

Reviewed By: krallin

Differential Revision: D22760648

fbshipit-source-id: 33f858b0021939dabbe1894b08bd495464ad0f63
2020-07-27 03:48:30 -07:00
Stanislau Hlebik
82c291010b mononoke: small refactoring of admin skiplist_subcommand
Summary:
Move changeset_fetcher building to a separate function, because
build_skiplist_index is already rather large and I'm going to make it larger in
the next diff

Reviewed By: krallin

Differential Revision: D22760556

fbshipit-source-id: 800baba052f46ed817f011f71dd28d40e98245fe
2020-07-27 03:48:30 -07:00
Lukas Piatkowski
006b80bf1b mononoke/integration tests: fix for test-security-whitelist.t - override allowed id
Reviewed By: krallin

Differential Revision: D22760347

fbshipit-source-id: 613bca3073e404b02c55c557a3835d0738c10102
2020-07-27 02:45:58 -07:00
Stanislau Hlebik
88975e359e mononoke: RFC skiplist with gaps
Summary:
Currently our skiplists store a skip edge for almost all public commits. This
is problematic for a few reasons:
1) It uses more memory
2) It increases the startup time
3) It makes startup flakier. We've noticed a few times that our backend storage
return errors more often when try to download large blobs.

Let's change the way we build skiplist. Let's not index every public changeset
we have, but rather index it smarter. See comments for more details.

Reviewed By: farnz

Differential Revision: D22500300

fbshipit-source-id: 7e9c887595ba11da80233767dad4ec177d933f72
2020-07-27 01:33:57 -07:00
Kostia Balytskyi
24b4b02df6 megarepolib: impl create delete commits
Summary:
This adds `megarepolib` support for pre-merge "delete" commits creation.
Please see `create_sharded_delete_commits` docstring for explanation of what
these "delete" commits are.

This functionality is not used anywhere yet (I intend to use it from
`megarepotool`), so I've added what I think is a reasonble test coverage.

Reviewed By: StanislavGlebik

Differential Revision: D22724946

fbshipit-source-id: a8144c47b92cb209bb1d0799f8df93450c3ef29f
2020-07-26 05:16:29 -07:00
Lukas Piatkowski
2c5cc232fc mononoke/x509 identity: add OSS parsing of x509 certificates (#32)
Summary:
Pull Request resolved: https://github.com/facebookexperimental/eden/pull/32

This parsing uses the standard "subject name" field of a x509 certificate to create MononokeIdentity.

Reviewed By: farnz

Differential Revision: D22627150

fbshipit-source-id: 7f4bfc87dc2088bed44f95dd224ea8cdecc61886
2020-07-24 09:05:52 -07:00
Stanislau Hlebik
4ddf071f7e mononoke: update walker to visit content referenced by fsnodes
Summary: If fsnodes point to non-existent content we should be able to detect that.

Reviewed By: farnz

Differential Revision: D22723866

fbshipit-source-id: 31510aada5e21109b498a26e28e0f6f3b7358ec4
2020-07-24 09:03:47 -07:00
Stanislau Hlebik
b8e68c433c mononoke: fix help message
Reviewed By: krallin

Differential Revision: D22723876

fbshipit-source-id: 68e46dcd3fe3998cca49abf5d7f11068186341ea
2020-07-24 08:52:32 -07:00
Arun Kulshreshtha
2566915fcd edenapi_server: fix comment in errors.rs
Reviewed By: StanislavGlebik

Differential Revision: D22705442

fbshipit-source-id: efa51077372ec9381c56d47f240f54fec573bc3c
2020-07-24 00:56:30 -07:00
Stefan Filip
ca09a04945 regenerate projects
Summary: A few projects out of sync between TARGETS and Cargo.toml.

Reviewed By: dtolnay

Differential Revision: D22704460

fbshipit-source-id: 3d809292d50cc42cfbc4973f7b26af38d931121f
2020-07-23 15:03:46 -07:00
Stanislau Hlebik
4e252cbf2e mononoke: add --limit to backfill_derived_data
Summary: It's nice to have this flag available

Reviewed By: krallin

Differential Revision: D22693732

fbshipit-source-id: 9d0d8f44cb0f5f7263a33e86e9c5b8a9927c0c85
2020-07-23 13:33:16 -07:00
Mateusz Kwapich
2bf5cf7ca1 add descendants_of argument to commit_path_history
Differential Revision: D22502592

fbshipit-source-id: 8e3acf00a6c4dc9b651551a6723b582d9bcaca39
2020-07-23 07:34:52 -07:00
Mateusz Kwapich
3b36868c5c add descendants_of arg to changeset_path history
Summary: Thiss turned out to be quite complex

Differential Revision: D22502591

fbshipit-source-id: 4bd9b90e9c88c234b84fbea2221036387a037ba3
2020-07-23 07:34:52 -07:00
Mateusz Kwapich
52863fa3e3 remove terminator argument
Summary: now the terminator argument is unused - we can get rid of it.

Differential Revision: D22502594

fbshipit-source-id: e8ecec01002421baee38be0c7e048d08068f2d74
2020-07-23 07:34:52 -07:00
Mateusz Kwapich
39c0b018ce migrate time filters to use visitor
Summary:
`until_timestamp` will benefit from checking each node - this will allow for
less filtering on the caller side.

Differential Revision: D22502595

fbshipit-source-id: 23c574b0a4eeb700cf7ea8c1ea29e3a6520097a9
2020-07-23 07:34:52 -07:00
Mateusz Kwapich
451c5e9827 introduce a Visitor trait
Summary:
This new trait is going to replace the `Terminator` argument to fastlog
traversal function. Insted of deciding if we should fetch or/not given fastlog
batch this trait allows us to make decisions based on each visited changeset.

Differential Revision: D22502590

fbshipit-source-id: 19f9218958604b2bcb68203c9646b3c9b433541d
2020-07-23 07:34:52 -07:00
Mateusz Kwapich
646e321d7c better public api for deleted files manifest
Summary:
The function for finding the commit where the file was deleted
in the fastlog module doesn't depend on fastlog at all.
It also seems generic enough to be a good public API for deleted files
manifests module.

Differential Revision: D22502596

fbshipit-source-id: 2e226bf14339da886668ee8e3402a08e8120266e
2020-07-23 07:34:51 -07:00
Mateusz Kwapich
b08005947a encapsulate visiting a node
Summary:
Let's centralize the logic that adds new nodes to BFS queue during fastlog
traversal, this will allow me to hook into it in the next diffs.

Differential Revision: D22502593

fbshipit-source-id: 63f4e7adb3a7e11b4a2b2dcc65cab3bb4bf6f015
2020-07-23 07:34:51 -07:00
Mateusz Kwapich
41d11ca236 introduce find_merges feature
Summary:
This new skiplist feature allows to find merges between any two related
commits.

Reviewed By: StanislavGlebik

Differential Revision: D22457894

fbshipit-source-id: 203d43588040759b89a895395058a21c9b5ca43d
2020-07-23 07:34:51 -07:00
Mateusz Kwapich
091f06f47d save the visited nodes during skiplist traversal
Summary: I'm planning to use it in my next diff to power `find_merges` functionality.

Reviewed By: StanislavGlebik

Differential Revision: D22457898

fbshipit-source-id: 76c3f107fd8b5bbef96e978037be31efca0f9841
2020-07-23 07:34:51 -07:00
Mateusz Kwapich
3f8db5fda3 extract processing non-skippable nodes into separate function
Summary:
The `process_frontier` function is THE function that powers skiplist traversal
and it's quite complex. To make the core more readable I'm moving part of the
code into separate functions.

Differential Revision: D22457896

fbshipit-source-id: e3521855ae7ab889c21d7aff0204e27dc23cf906
2020-07-23 07:34:51 -07:00
Mateusz Kwapich
08462ea85c extract single skiplist traversal step to a separate
Summary:
The `process_frontier` function is THE function that powers skiplist traversal
and it's quite complex. To make the core more readable I'm moving parts of the
code into separate functions.

I'm also planning to use the single step function to simplify lowest common
ancestor algorithm later.

Differential Revision: D22457895

fbshipit-source-id: 1234118705ca6b1b61e09fdd7867ce4366045a28
2020-07-23 07:34:51 -07:00
Kostia Balytskyi
dde78cb83e backsyncer: move under commit_rewriting
Summary: Same as a previous diff. Let's keep the top-level dir tidy.

Reviewed By: krallin

Differential Revision: D22691638

fbshipit-source-id: 7f9a21f307efd9bbe37f515f475409c89b99cd31
2020-07-23 06:32:52 -07:00
Kostia Balytskyi
d99cae1ba5 megarepolib: move under commit_rewriting
Summary:
There seems to be too many things at the top level of `Mononoke` already.
Let's make sure all x-repo thingies live under the same directory.

Reviewed By: krallin

Differential Revision: D22691539

fbshipit-source-id: 19feeb6777309b9034f8620bd211041b61b08bfc
2020-07-23 06:32:52 -07:00
Alex Hornby
6a0b614a90 mononoke: fix flaky test-walker-validate.t
Summary: Fix flaky test-walker-validate.t.   There can be more than one route to the bad filenode, so wildcard the src and via fields when matching the output.

Reviewed By: StanislavGlebik

Differential Revision: D22664371

fbshipit-source-id: f4d880187ec2b557fb5f69ad546c2486d150b337
2020-07-22 11:05:48 -07:00
Arun Kulshreshtha
edb856a77e mononoke_api: use create_getpack_v2_blob in HgFileContext
Summary: Use `create_getpack_v2_blob` instead of `create_getpack_v1_blob` for fetching file content because the former also provides metadata, which is required to support LFS.

Reviewed By: quark-zju

Differential Revision: D22564950

fbshipit-source-id: 2835160a9dfd18b80cd13e4a5dbcf6f4ce2f4579
2020-07-22 10:37:14 -07:00
Kostia Balytskyi
55cb8dba22 admin: asyncify crossrepo subcommand
Summary: This makes crossrepo subcommand not import `BoxFuture`

Reviewed By: StanislavGlebik

Differential Revision: D22647197

fbshipit-source-id: ea2dd20039a8aaf96be0483cc25f3fad38d262f5
2020-07-22 09:17:43 -07:00
Stanislau Hlebik
aaafd7a707 mononoke: allow specifying list to redact in a file
Summary:
For large lists it's much more convenient to specify them in a file - we are
not limited by cmd line size limit.

Reviewed By: krallin

Differential Revision: D22595023

fbshipit-source-id: 93035208700f981453eaf98f84341a86f2f1c04d
2020-07-22 07:37:36 -07:00
Kostia Balytskyi
1e5a0dc4db admin: add crossrepo config subcommand
Summary: This is to be able to inspect `LiveCommitSyncConfig` from our admin tooling.

Reviewed By: StanislavGlebik

Differential Revision: D22497065

fbshipit-source-id: 3070890b7dc2a4075a5c15aca703494e33ee6530
2020-07-22 07:34:59 -07:00
Stanislau Hlebik
c6ff6a0216 mononoke: add a command to verify manifests
Summary:
We have three different types of manifests that store file type and content -
hg manifests, fsnodes and unodes.

Let's add a command that verifies that these manifests are consistent.

There's some copy-paste in the code when listing manifests (e.g. list_fsnodes,
list_unodes etc are quite similar). There might be a way to have less
copy-paste, but given that each of the functions have some small differences it
doesn't really seem worth it.

Reviewed By: krallin

Differential Revision: D22663631

fbshipit-source-id: 487be8611df218472cec1899f34367906794484b
2020-07-22 07:25:31 -07:00
Lukas Piatkowski
808a00ea73 mononoke/integration tests: provide localhost certs for OSS test runs (#30)
Summary: Pull Request resolved: https://github.com/facebookexperimental/eden/pull/30

Reviewed By: johansglock

Differential Revision: D22596741

fbshipit-source-id: e8cf5da09f5c8c812b78b44aac969f52e195684f
2020-07-22 03:29:19 -07:00
Kostia Balytskyi
dd4fcd7aee commit_validator: validate according to recorded sync config version
Summary: `commit_validator` cannot just use latest `CommitSyncConfig` to validate how a commit was synced between large and small repos. Instead, when querying `synced_commit_mapping`, it needs to pay attention to `version_name` used to create the mapping. Then it needs to query `LiveCommitSyncConfig` for a config of this version and use it as a validation basis.

Reviewed By: StanislavGlebik

Differential Revision: D22525606

fbshipit-source-id: 6c32063b18461d592d931316aec7fd041bcc1ae4
2020-07-21 10:19:44 -07:00
Egor Tkachenko
661d31bd21 mononoke: check that repo is locked during unbundle process
Summary:
Currently the repo lock is checked only once at the beginnig of unbundle future. That unbundle process take some time and during that time repo can be locked by someone.
We can reduce that possibility by creating additional future, which will check the repo in the loop and poll both futures for whoever will finish first.

Reviewed By: StanislavGlebik

Differential Revision: D22560907

fbshipit-source-id: 1cba492fa101dba988e07361e4048c6e9b778197
2020-07-21 09:41:38 -07:00
Kostia Balytskyi
be29e70289 admin: report version in crossrepo map
Summary: What the title says.

Reviewed By: farnz

Differential Revision: D22476423

fbshipit-source-id: 5d6781fc09e3f89c1d555787821770d6b131c9f2
2020-07-21 09:09:23 -07:00
Kostia Balytskyi
9d607c382b commit sync config versioning: expose version in RewrittenAs
Summary:
This is the next step in exposing version, used to sync commits in read
queries. The previous step was to query this from DB, now let's also put it
into an enum payload. Further, I will add consumers of this in admin and
validation.

Note that ideally, `RewrittenAs` should always have a version associated with
it, but:
- right now this is not true in the DB (needs backfilling)
- even when I backfill everything, I would not like to error out just at
  reading time, I would prefer the consumers to deal with the absense of a
  version in rewrtitten commits.

Therefore, I decided to use `Option` here.

Reviewed By: StanislavGlebik

Differential Revision: D22476166

fbshipit-source-id: 5bc27bb21b7e59c604755ef35aa5d3d2c3df527e
2020-07-21 09:09:23 -07:00
Kostia Balytskyi
fc61c74f23 live_commit_sync_config: make scs xrepo-lookup watch live changes
Summary:
When we change `CommitSyncConfig`, we want to not have to restart `scs` servers, and instead have them pick up the new config by using `LiveCommitSyncConfig`.

This diff turned out larger than I expected, mainly due to the need to introduce various things around `TestLiveCommitSyncConfig`:
- `TestLiveCommitSyncConfig`: the trait implementer to use in `mononoke_api::Repo`
- `TestLiveCommitSyncConfigSource`: the helper struct to keep around for new values injection (very similar to how our `ConfigStore` has an inner `ConfigSource`, which can also be `TestSource`, but here injected values can be `CommitSyncConfig` instead of JSON).
- all the places in integration tests, where `setup_configerator_configs` is now needed (I plan to start setting up configerator configs always in a separate diff, as it is cheap)

Here are the explanations for a few things I think may be not immediately obvious:
- I removed the `Clone` bound from `LiveCommitSyncConfig` trait, as `Clone` traits [cannot be made into trait objects](https://doc.rust-lang.org/book/ch17-02-trait-objects.html#object-safety-is-required-for-trait-objects)
- `TestLiveCommitSyncConfigSource` vs `TestLiveCommitSyncConfigSourceInner` discrepancy is to ensure nobody should instantiate `TestLiveCommitSyncConfigSourceInner` outside of `live_commit_sync_config/src`
- I am aware of the ugly discrepancy between the main `--mononoke-config-path`, which is used to load initial configuration and can be both a file-based and a configerator-based config; and `--local-configerator-path`, used to override config sources for `Tunables` and `LiveCommitSyncConfig`. Ideally these two should just be unified somehow, but that is a little out of scope of this diff (I've already added it to the dirt doc though).
- in `mononoke_api::Repo` there are methods `new_test_xrepo` and `new_test_common`, which changed from maybe accepting just a `CommitSyncConfig` to now maybe accepting both `CommitSyncConfig` and `LiveCommitSyncConfig`. It can be made a bit cleaner: I can just query `CommitSyncConfig` from `LiveCommitSyncConfig` in `new_test_common` and avoid having two args. I was too lazy to do this, lmk if you feel strongly about it.

Reviewed By: StanislavGlebik

Differential Revision: D22443623

fbshipit-source-id: 0d6bbda2223e77b89cc59863b703db5081bcd601
2020-07-21 09:09:23 -07:00
Viet Hung Nguyen
c5e880c239 mononoke/repo_import: Add bookmark moving functionality
Summary: After we derived the bonsaichangesets (D22455297 (c315c56c05)), we want to move a bookmark in small increments to reveal the commits to the users (https://fburl.com/wiki/zp9hgd7z step 8). This diff adds this functionality to repo_import and automate this step.

Reviewed By: StanislavGlebik

Differential Revision: D22598159

fbshipit-source-id: 01db898f07a0b7be50c3f595e78931204f33bb46
2020-07-21 06:47:51 -07:00
Alex Hornby
2aaddc487e mononoke: add context to alias deserialize error handling
Summary: Add context to show the affected key if there are problems deserializing an alias.

Reviewed By: krallin

Differential Revision: D22629544

fbshipit-source-id: 1718d4187386e37038bb5c958db2659bd5b54cfd
2020-07-21 06:11:46 -07:00
Jun Wu
0562c1220f tests: enable template-new-builtin
Summary: This makes tests depend less on revision numbers.

Reviewed By: DurhamG

Differential Revision: D22468669

fbshipit-source-id: 74a06930faa3e6ee9d246ecc718c2a3740f57a54
2020-07-20 17:27:53 -07:00
Mateusz Kwapich
0a8aaa461c repo_stack_info: return queue when the limit is hit
Summary:
This allows clients to get more commits in the followup query, also it lets the
clients know that the limit was reached.

Reviewed By: markbt

Differential Revision: D22576875

fbshipit-source-id: 93de20b1033cd5d0cdf902a418d7b727b03d2d08
2020-07-20 10:39:52 -07:00
Mateusz Kwapich
3547ffd3a9 repo_stack_info: make the repo_stack_info results ordered
Summary:
We already traverse in useful order, let's preserve this order as it's natural
for clients to expect some kind of topological ordering.

Reviewed By: markbt

Differential Revision: D22576873

fbshipit-source-id: 32a6f0de1ba9cc473e57b5a69fde538dfe8a3d75
2020-07-20 10:39:52 -07:00
Mateusz Kwapich
a142790f41 repo_stack_info limit the limit
Summary: This prevents us from abuse in form of crazy big queries.

Reviewed By: markbt

Differential Revision: D22576876

fbshipit-source-id: 0e407d79ba367f1b42faa82e4757053e43001e50
2020-07-20 10:39:52 -07:00
Mateusz Kwapich
6bc6730839 repo_stack_info: limit the output size, not traversal depth.
Summary:
The customers need our queries to return a predictable amounts of output
whilist limiting the depth doesn't really do it: the output may be
theoretically exponential.

Reviewed By: markbt

Differential Revision: D22576874

fbshipit-source-id: 65c793b229889c0cf26af693537ed6dbc0d33ebd
2020-07-20 10:39:52 -07:00
Alex Hornby
5348068572 mononoke: walker: log changeset missing link nodes were reached via
Summary: log changeset missing link nodes were reached via.

Reviewed By: farnz

Differential Revision: D20124059

fbshipit-source-id: 412a88245abb3b761c2363c33c28206ab749d572
2020-07-20 04:58:16 -07:00
Alex Hornby
d07a69f71e mononoke: walker: log changeset non-public commits were reached via
Summary: Log changeset non-public commits were reached via.

Reviewed By: krallin

Differential Revision: D20115443

fbshipit-source-id: b2bed03b42c26785f845e055b984fda8d5af63e9
2020-07-20 04:58:16 -07:00
Stanislau Hlebik
3ba14b7ff1 Back out "mononoke: use batch_derive method in derived data utils"
Reviewed By: ahornby

Differential Revision: D22623587

fbshipit-source-id: 52e56e5b3ceb170ea41c58020fcd986023728ea2
2020-07-20 03:18:55 -07:00