Commit Graph

6124 Commits

Author SHA1 Message Date
Youssef Ibrahim
f9ba776ed7 derived_data_manager: add CommitGraph to DerivedDataManager
Summary: Will eventually replace Changesets

Differential Revision: D45319164

fbshipit-source-id: 98f08f40bd4fa095a201668177e254b1df51dfe0
2023-04-28 10:24:20 -07:00
Youssef Ibrahim
163620fa1e admin: delete rebase.rs and pushrebase.rs
Summary: They were migrated to newadmin.

Differential Revision: D45319166

fbshipit-source-id: 241c817efd736c0f7796c40e0e57d1ba5ab4baf3
2023-04-28 10:24:20 -07:00
Youssef Ibrahim
163ab65a21 commit_graph: add CommitGraph facet to BlobRepo
Summary: Migrating from using the Changesets facet to the CommitGraph facet would otherwise require deblobrepoifying too much stuff.

Differential Revision: D45319163

fbshipit-source-id: f93c091befc5b3419a7d1364107cc717c9d19303
2023-04-28 10:24:20 -07:00
Youssef Ibrahim
7f95c77064 pushrebase: deblobrepoify unittests
Summary: I hate blobrepo

Differential Revision: D45319165

fbshipit-source-id: 42e49f2b4255081c802682e32c40e85d97cc95a6
2023-04-28 09:46:21 -07:00
Rajiv Sharma
fbc633694f Unit tests for shard parsing
Summary:
The previous diff introduced `RepoShard` as the struct containing the parsed information from the passed in string shard-id. This diff adds relevant test cases to ensure that the logic for parsing the string based ID is accurate.

This diff also modifies the original parsing logic in response to the errors discovered during unit testing.

Reviewed By: mitrandir77

Differential Revision: D45355079

fbshipit-source-id: 78f28fa80bf4a3186ab66b08b29f20d39230094d
2023-04-28 09:05:23 -07:00
Liubov Dmitrieva
2376ee80ee streamimg support for public pulls
Summary:
streamimg support for public pulls

If all heads in the request are public, use the streaming API, so that we are not
limited to any keep alive timeouts on HTTP side, since we can return things more gradually.

This is to be used for hg pulls in not segmented changelog repos, pulling of
expensive branches, etc

Commit Cloud would still use the API where we calculate the whole graph before returning it but this is fine because:

* we need to derive filenodes and calculate phases in parallel
* that function is a little bit more optimised since better batching of hg <=> bonsai conversions, for example.

Reviewed By: mitrandir77

Differential Revision: D45352368

fbshipit-source-id: 7549396d249a50adc163b5de1586d8789776b0df
2023-04-27 10:38:13 -07:00
Liubov Dmitrieva
8a90f63486 eliminate lifetimes from ancestors_difference_stream method
Summary:
eliminate lifetimes from ancestors_difference_stream method since they
create unnecessary complexity and some consumers require a static stream.

self (arc under the hood)  and ctx is cheap to clone there

Reviewed By: markbt

Differential Revision: D45352367

fbshipit-source-id: 6eca62838d1e31ff046ce987c52afced84227a6c
2023-04-27 08:24:00 -07:00
Rajiv Sharma
d8ae6f2027 Implement native chunking support in sharding library
Summary: This diff introduces the `RepoShard` type which will serve as the holder of shard-level state information. Currently, we keep the information encoded in the shard_id (e.g. `fbsource_TO_ovrsource_CHUNK_1-11_SIZE_1000`) and expose it directly to the clients who then have to parse it themselves to get the relevant pieces of information. To avoid this duplication and to centralize the parsing and error handling logic, we will use the `RepoShard` struct. I have added it in `sharding_ext` crate so the type itself can be used independently of the sharding framework (for lightweight dependencies).

Reviewed By: markbt

Differential Revision: D45277195

fbshipit-source-id: 6ae9717fdcf312f0546e7b75d530e8dec8f69d32
2023-04-27 08:18:19 -07:00
Rajiv Sharma
3d8acc265a Move sharding_lib_ext under cmdlib
Summary:
The `sharding_lib_ext` crate was created to contain the add-on logic that is used by `ShardedProcessManager` but also by other components (e.g. encoding, decoding repo-name for shard-aware routing). I plan to use this crate further for adding chunking support. Before I do that, I decided to clean things up a bit. Particularly,
- Move `sharding_lib_ext` crate under `cmdlib` instead of keeping it under `mononoke` since its a library
- Renamed the crate to `sharding_ext` removing the `lib` since all crates under `cmdlib` are libraries anyway

Reviewed By: markbt

Differential Revision: D45272976

fbshipit-source-id: 90be4f1f4659a03a591a8acbb04fdcbf06234a74
2023-04-27 08:18:19 -07:00
Mateusz Kwapich
705e1c9e8b fix new clippy problems
Summary: clippy_spell_check

Reviewed By: markbt

Differential Revision: D45326580

fbshipit-source-id: e7f57df3c50a7eff8c3080421dccc2f9cf9ff48b
2023-04-27 03:27:30 -07:00
Rajiv Sharma
8c72e77a47 Upload raw git tags during repo import
Summary: Similar to direct `gitimport`, this diff adds support in `remote-gitimport` to upload raw git annotated tags when pushed to the remote git server. Note that this only uploads annotated tags since basic tags get directly converted into branches while annotated tags need a corresponding changeset to be represented in the Mononoke data model. This diff doesn't delete existing tags when deletions are pushed to the server and modifications of the raw git tag are prevented by the no-update model in Mononoke blobstores.

Reviewed By: markbt

Differential Revision: D45271703

fbshipit-source-id: f7cdbed7fb665c9d32b08e26d7e9f404175b6eb9
2023-04-27 02:19:25 -07:00
Muir Manders
c516db84d0 megarepo: support transparent hash translation
Summary:
Add a new commit resolution step that checks if unknown hashes are from another repo, and if so translates to corresponding hash of current repo.

This behavior is enabled by configuring the other repo name under the megarepo.transparent-lookup config.

Reviewed By: sggutier

Differential Revision: D45092192

fbshipit-source-id: 9434a21d258cdfda153eb81e2d1eb0149f8a063e
2023-04-26 16:51:14 -07:00
Muir Manders
f8190d9be0 translate_id: add support for xrepo lookups
Summary:
Respect the optional "from" and/or "to" repo names to convert the commit ids from and/or to different repos. Only applies for repos that are megarepo'd together.

I added a get_repo method to the EdenApiContext object to facilitate the xrepo behavior.

I thought about disallowing requests where both "from" and "to" are different from the "subject" repo in the path, but it seems harmless.

Reviewed By: quark-zju

Differential Revision: D45019173

fbshipit-source-id: 8a25f5506521765296142553963b19f47570e865
2023-04-26 16:51:14 -07:00
Muir Manders
6624a28997 allow handlers to propagate specific HttpErrors
Summary: Previously any outer error returned by an EdenApiHandler got turned into a 500. With this change, we no longer allow the generic `Into<anyhow::Error>` propagation. This allows for specialized HttpError propagation that retains response code.

Reviewed By: quark-zju

Differential Revision: D45296090

fbshipit-source-id: bb21518e5f8c77f578eec6d42a2582c474b5d1e9
2023-04-26 16:51:14 -07:00
Muir Manders
1c498ee665 translate_id: simplify handler a bit
Summary:
Use the CommitId directly as HashMap key to get rid of some per-type bookkeeping.

This minor change allows my next diff for xrepo translation to be significantly simpler.

Reviewed By: markbt

Differential Revision: D45019175

fbshipit-source-id: eb369b9e2d51345482590bbbbd9a1758b140b309
2023-04-26 16:51:14 -07:00
Muir Manders
d1f0dab4de introduce EdenApiContext object
Summary:
I want to enable EdenApiHandlers to fetch other repo objects, but that requires various other objects not currently available. I don't want to complicate the handler signature with multiple additional args, so introduce a context object that can contain the dependent objects (i.e. RequestContext and ServerContext).

I tucked the path and query extractors into the context since they are barely used by any handlers (in fact, the path extractor is not used at all).

Reviewed By: markbt

Differential Revision: D45019176

fbshipit-source-id: ec4427d2f134277e89a8c48018f29c5f56cdc60d
2023-04-26 16:51:14 -07:00
Youssef Ibrahim
3c4b3f792a commit_graph: implement range_stream
Summary: Implements a stream that yields all changesets that are simulatenously a descendant of one changeset and a descendant of another, in topological order.

Reviewed By: markbt

Differential Revision: D45156176

fbshipit-source-id: 6c70d40252b5e2402ec1718e6cbe4c35ec8e9c1e
2023-04-26 14:15:50 -07:00
Mark Juggurnauth-Thomas
c592cabeec scsc: improve help text for info --path
Summary: Make this help text more helpful.  Also record that `--bookmark-info` and `--path` are mutually exclusive.

Reviewed By: MichaelCuevas

Differential Revision: D45315761

fbshipit-source-id: 150c80e1e1369c3f0c76d6708e9453fb64e3e7e0
2023-04-26 14:03:40 -07:00
Rajiv Sharma
b63beffc2d EdenAPI: Changes for ContentMetadataV2 and Blake3
Summary:
The `ContentMetadataV2` provides the seeded blake3 hash for each created file. This information needs to be passed to `buck` which interacts with `EdenAPI` through `EdenFS`. The relevant endpoints in `EdenAPI` are `trees` and `files` which were modified in the previous diff to support the new hash and are used here.

NOTE: This diff was already landed (D44010967) but then had to be reverted (D45156142) since it was causing build issues for EdenFS on ARM64 MacOS. More context [here](https://fb.workplace.com/groups/learningrust/permalink/3405570553032635/)

Reviewed By: quark-zju

Differential Revision: D45226440

fbshipit-source-id: 051dee9898d2441d6a03c10809988c6b99f36ab4
2023-04-26 12:04:21 -07:00
Liubov Dmitrieva
1b7455d14b prefetch expensive bookmarks separately
Summary:
prefetch expensive bookmarks separately

this is to avoid timeouts until we have streaming support and ublock rollout
for AOSP repo

also, this provides better ux since we notify users that slow fetch is being executed

I also noticed that the commitcloud.remotebookmarkssync config option wasn't mentioned in the help. So, add it to avoid confusion.

Reviewed By: quark-zju, zzl0

Differential Revision: D44998087

fbshipit-source-id: f24bd959f02380ff0d7ff4f30dbe7e1647403329
2023-04-26 10:18:31 -07:00
Jan Mazur
8c1b00b5b4 build RPM with buck2
Summary: See attached task

Reviewed By: mitrandir77, RajivTS

Differential Revision: D45309155

fbshipit-source-id: 4d7f1fde4b41609a1e71a8e261ca9f6d38ad8e7b
2023-04-26 03:42:55 -07:00
David Tolnay
4114b89e5e Update tracing-subscriber from 0.3.16 to 0.3.17
Reviewed By: zertosh

Differential Revision: D45286804

fbshipit-source-id: bb49b1b850f150a865577411de6bb5a0d91b7a20
2023-04-25 15:59:50 -07:00
Mark Juggurnauth-Thomas
f3c3011443 scs_server: add commit and range counts to blame data
Summary:
This data may be useful for analysing the blame history of the file.

* `approx_commit_count` is the total number of commits in the blame history of the file.  It is approximate as some merged in commits may be omitted.

* `distinct_range_count` is the number of distinct ranges in the blame, which may indicate the file's complexity.

Reviewed By: RajivTS

Differential Revision: D45218574

fbshipit-source-id: c0c399f525f8c047a0415cf9d6f6e3483c033700
2023-04-25 14:26:32 -07:00
Ilia Medianikov
78a5d29413 mononoke: reject pushes and bookmark moves if they come outside of VPN
Reviewed By: johansglock, mitrandir77

Differential Revision: D44470707

fbshipit-source-id: 76a86d5c9996a0d5eccca731e85a32cef3078980
2023-04-25 13:47:11 -07:00
Emerson Ford
5a461e2154 fix unit tests broken by changes to Thrift client error formatting
Summary: bunch of unit tests that relied on the specific error formatting weren't caught by CI and are failing. this fixes them by changing their error formatting to use `{:#}`.

Reviewed By: markbt

Differential Revision: D45245281

fbshipit-source-id: 6b0c9c5f3a3ecb594292d2a658ecce457f007e7e
2023-04-25 13:26:21 -07:00
Youssef Ibrahim
27ef609539 commit_graph: replace DifferenceOfUnionsOfAncestorsNodeStream callsites with ancestors_difference_stream conditional on a tunable
Summary: Directs DifferenceOfUnionsOfAncestorsNodeStream callsites to use commit_graph().ancestors_difference_stream instead conditional on a tunable (enable_new_commit_graph_ancestors_difference_stream) being set to true.

Reviewed By: markbt

Differential Revision: D45042733

fbshipit-source-id: ca508d9b1a2e9efd7b45d1ee834f7587a7d886c3
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
4b84687d67 commit_graph: implement ancestors_difference_stream
Summary: Implements a streamable variant of ancestors_difference to be used as a replacement for DifferenceOfUnionsOfAncestorsStream

Reviewed By: Croohand

Differential Revision: D45042732

fbshipit-source-id: aa7377512866038172899545ee9c43a2d6db39f7
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
47d9d4764d test_repo_factory: enable double writing to the new commit graph in test repos
Summary: Use ChangesetsCommitGraphCompat when constructing Changesets in TestRepoFactory to enable double writing to the new commit graph

Reviewed By: mitrandir77, singhsrb

Differential Revision: D45227317

fbshipit-source-id: 6ce1809a2e30d930f8edef1efda0f9bef53b2a7c
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
c9f4ba76a0 mononoke_api: remove Repo::new_test and Mononoke::new_test
Summary: Replaced by using TestRepoFactory directly and adding the extra config to the default config.

Reviewed By: RajivTS

Differential Revision: D45227320

fbshipit-source-id: bd93d1a2fd3a10398ca1cfd4b647a32627b83179
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
fadb030b3f mononoke_api: remove Repo::new_test_lfs
Summary: Replaced by using TestRepoFactory directly with overrided config.

Reviewed By: RajivTS

Differential Revision: D45227316

fbshipit-source-id: 9be089f7645ec0a9070b538e37d64f33d4a5c222
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
b219f34a26 test_repo_factory: add method for building warm bookmarks cache
Summary: Has the same behaviour as the contruction of warm bookmarks cache in Repo::new_test_common. To keep the same behaviour this required making TestRepoFactory into an async builder and modifying all of its callsites.

Reviewed By: RajivTS

Differential Revision: D45227318

fbshipit-source-id: 51303d48bebc0c4b915a359a7d0942bf485e8db5
2023-04-25 12:45:33 -07:00
Youssef Ibrahim
ab75fb2901 warm_bookmarks_cache: add a sync method
Summary: Adds a sync method that awaits the completion of all ongoing updates. Mostly useful for tests to avoid adding artificial sleeps.

Reviewed By: RajivTS

Differential Revision: D45227319

fbshipit-source-id: 9f3a9c7d063ad065b913db521a27624041b2400a
2023-04-25 12:45:33 -07:00
David Tolnay
99c31b35ff Update clap from 4.1.11 to 4.2.4
Reviewed By: zertosh

Differential Revision: D45278284

fbshipit-source-id: d3aa28a3158b6b3c228c1f364b7c643d93766133
2023-04-25 12:13:11 -07:00
David Tolnay
b5d3aab8ce Update ref-cast from 1.0.12 to 1.0.16
Reviewed By: zertosh

Differential Revision: D45278283

fbshipit-source-id: 85f83923f4a18e87b60a8ab68ab731fe74fd2a8c
2023-04-25 12:08:03 -07:00
Mark Juggurnauth-Thomas
62d92b31f0 scs_server: support preparation of derived data in create stack
Summary:
When creating a stack, make it possible to request that a derived data type is prepared as part of creating the stack.  Since the data for the stack is in local cache, this should be faster than it would otherwise be.

This is a simple initial implementation.  It requires that the data is already derived for the parents of the stack, and does not support parallel derivation of the different types, nor types that include interdependencies.  In fact, we only support fsnodes and skeleton manifests right now.

Differential Revision: D45216982

fbshipit-source-id: c6ca7b265b1e6219a1193c51d0a984794aa34965
2023-04-25 10:55:54 -07:00
Mark Juggurnauth-Thomas
dd66bf21dd scs_server: add support for preparing skeleton manifests
Summary:
Add support for skeleton manifests as a type of derived data that can be prepared.

The current enum for derived data types does not follow best practices and uses zero.  Fix this now by adding a new variant for `FSNODE`.  Once server support is available, we will remove `FSNODE_NEW` and switch to that value for `FSNODE`.

Differential Revision: D45216983

fbshipit-source-id: b0714ef6f9121139cc8d4602a5a8d1beaac00a3f
2023-04-25 10:55:54 -07:00
Mark Juggurnauth-Thomas
9113ec3663 mononoke_api: extract preparation of derived data to an api method
Summary: Move the preparation of derived data into a `mononoke_api` method in preparation for re-use.

Differential Revision: D45216984

fbshipit-source-id: ee99379685a202018b4c32b4b56e2930755d723a
2023-04-25 10:55:54 -07:00
Mark Juggurnauth-Thomas
8e5c2efd05 tests: increase wait time for bookmark updates
Summary: When tests are run in parallel, it can take more than a couple of seconds for the server update to become visible.  Increase the wait to up to to 10 seconds.

Reviewed By: RajivTS

Differential Revision: D45229687

fbshipit-source-id: 24bc9607c285a4098c35a4105b8deac7916a7591
2023-04-25 08:47:39 -07:00
Clara Rull
b6f6bd9254 Make client follow master
Reviewed By: YousefSalama

Differential Revision: D45052574

fbshipit-source-id: 9f76ea1e005c92208a3a11987d0c49f1e5cb553c
2023-04-25 07:46:32 -07:00
Rajiv Sharma
08dd7b8ff6 Upload raw git tags during repo import
Summary: Like in the previous diffs, this diff uploads the raw git tags during repo import through `gitimport`.

Differential Revision: D45118571

fbshipit-source-id: f5a6bb9b5805235e9f66f97ab3a58bd165ef475c
2023-04-21 11:59:38 -07:00
Rajiv Sharma
5a76b73fe1 Upload raw git trees associated with commit during git import
Summary: The previous diff uploaded raw git commit data while the commit gets imported in Mononoke through gitimport or remote-gitimport. This diff ensures that the git `tree` associated with the commit also gets  uploaded in Mononoke.

Differential Revision: D45085959

fbshipit-source-id: cf4f4a5ebd0d077972f75fe9c6a8d1dfc5067180
2023-04-21 11:59:38 -07:00
Rajiv Sharma
53d0bcb32a Upload raw git commits during git import
Summary:
With the `upload_object` method in place, this diff utilizes the new uploader method to upload the raw git commit in Mononoke store before creating its corresponding Changeset at Mononoke end.

This diff has the following changes:
- Modified the `get_object` method in `GitReader` to return the raw git content (i.e. header + body bytes of git object) along with the parsed `GitObject`
- Added the `read_raw_commit` method in the `gitimport_objects` library to read the raw commit bytes
- Modified the `ExtractedCommit` type to contain the raw bytes of the commit as well
- Modified all modes of `gitimport` execution to upload the raw git commit before creating the corresponding changeset at Mononoke end
- Made changes in integration test to validate the commit upload behavior

Differential Revision: D45082135

fbshipit-source-id: f339b2851646996be7f43f02458ea5afabb9ca48
2023-04-21 10:13:50 -07:00
Rajiv Sharma
fa889aad25 Implement upload_objects for Direct and Remote Git Uploader
Summary:
This diff includes the following changes:
- Introduces the `upload_object` method in the `GitUploader` trait for uploading raw git-objects (e.g. commit, tree, tag) in the mercurial mirror of the repo
- Implements the `upload_object` method in `Direct` and `Remote` implementations of the `GitUploader` trait allowing the objects to uploaded from both `gitimport` and `remote-gitimport`

This diff just introduces this method, follow-up diffs will use it for uploading different commit objects.

Differential Revision: D45046811

fbshipit-source-id: 9b4e6a295ec22e06294e410735e67877e6d0ef10
2023-04-21 10:13:50 -07:00
Rajiv Sharma
98426e3b65 Restructure mononoke_api git methods to exist as free functions
Summary:
The existing `mononoke_api` git methods were defined under `RepoContext` which relies on a specific type of `Repo` facet container as defined in `mononoke_api` crate. These methods can easily be used through SCS which serves as an external entry point into the `mononoke_api` crate. `remote-gitimport` uses SCS and thus can leverage the necessary endpoints.

However, `gitimport` (or `direct-gitimport`) directly references the logic behind these methods. To ensure that we don't repeat ourselves, there are two alternatives.
- Make `gitimport` use the same `Repo` facet container as the one in `mononoke_api` crate
- Decouple the git methods from `RepoContext` and define them with explicit `facet` dependencies

I chose the later since using the same facet container would have made `gitimport` use a much bulkier `Repo` definition than is necessary. I also made some changes in the `create_annotated_tag` method which are as follows:
- Removed the `start_write()` statement which was essentially an authorization check to validate if writing to the repo is allowed. This check makes sense when validating an external caller (e.g. SCS) but direct references of the library should be allowed
- Removed `CreateChangeset` permission check since we are not actually creating a changeset that corresponds to a commit. Additionally, any auth checks need to be performed at the call-site (e.g. SCS) and not in the API
- Removed the `allowed_no_parents` check since any changeset created for representing a `Tag` object will not have a parent. Infact the concept of parent is invalid for a tag.
- Replaced the returned `MononokeError` into `GitError` to maintain consistency with other methods
- Replaced the instance `save_changeset` method with the struct-level `save_changeset` method. The new method doesn't log to the scribe category thus preventing users tailing it from receiving an invalid commit creation notification. Additionally, the new method doesn't consider any bubble changes but they are anyway irrelevant in the context of these git methods.

Differential Revision: D45046639

fbshipit-source-id: 7ff02cde3fd356eb7a18f5ca12e6c478e23ee315
2023-04-21 10:13:50 -07:00
Mark Juggurnauth-Thomas
e6ef902125 blame: make blame v2 the default version
Summary: In preparation for deleting blame v1, make blame v2 the default.

Differential Revision: D45044338

fbshipit-source-id: c9c71a148b42f4a3301d6c4fd0de5ad7ed321a3e
2023-04-21 05:58:38 -07:00
Mark Juggurnauth-Thomas
0e00d50d56 walker: switch to blame v2
Summary:
Allow the walker to walk the blame v2 graph.

Since the walker is the main user of blame in the integration tests, we can make v2 the default for the integration tests, too.

Differential Revision: D45044294

fbshipit-source-id: 52c991dd81be78053ffc0a6953caf8a068ef59e3
2023-04-21 05:58:38 -07:00
Mark Juggurnauth-Thomas
96b376b90c benchmark_bulkops: convert to clap4
Differential Revision: D45114047

fbshipit-source-id: f99ebe71b61827079db259a9644f21ba11508950
2023-04-21 04:52:41 -07:00
Mark Juggurnauth-Thomas
f9211aa47f bulkops: move benchmark to the benchmarks directory
Summary: This is a benchmark, so put it with the other benchmarks.

Differential Revision: D45114045

fbshipit-source-id: c524c76671d4183f6baa71ca9cd4c3cdfc402dac
2023-04-21 04:52:41 -07:00
Genevieve (Genna) Helsel
ecc11aef2b Back out "EdenAPI: Changes for ContentMetadataV2 and Blake3"
Summary:
Original commit changeset: a755f0750ed3

Original Phabricator Diff: D44010967

need to revert to fix our release

https://www.internalfb.com/intern/sandcastle/job/36028797946731051/insights

Reviewed By: xavierd

Differential Revision: D45156142

fbshipit-source-id: 6e5362cf609f69cdbfeb7da30981227f93d42b65
2023-04-20 14:43:37 -07:00
Mark Juggurnauth-Thomas
8a13aec1c0 remove upload_globalrevs
Summary: This tool was used for the original import of globalrevs.  We are now the source of truth for globalrevs, so it is no longer needed.

Differential Revision: D45112829

fbshipit-source-id: 8ff106c66de74a79e6cd963ca48bd1875d6ee44c
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
242b35e606 remove rechunker
Summary: This tool was used to rechunk the filestore.  The filestore is always chunked now, so this tool is no longer needed.

Differential Revision: D45112830

fbshipit-source-id: cd03dd06f7dc55a6b47b8fc338accf9d300977d2
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
d91fbd8a26 remove manual_scrub
Summary: This tool was used for the initial population of the XDB blobstore.  It has been superseded by the walker, and can now be deleted.

Differential Revision: D45112828

fbshipit-source-id: 134e2c2b761fd27a9b096df4d64404bc14c89c43
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
80f85f9f0b remove configlint
Summary: This tool lints toml-format configs which we don't use in production any more, and as such the tool is unused.

Differential Revision: D45112827

fbshipit-source-id: a4f7783144ab782adba5f0a0fb346e8cb542ad97
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
e39509da38 remove compute_commit_stats
Summary: This tool was used early on to compute commit stats, but is no longer needed as it has been superseded by other data.

Differential Revision: D45112824

fbshipit-source-id: e88282647e8e3ed85a95ff2a9b15d9212851b8ff
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
f40e7dd509 remove regenerate_hg_filenodes
Summary: This tool was introduced to fix up the problem with linknodes pointing at commit cloud commits, however that has long since been resolved, so the tool is no longer needed.

Differential Revision: D45112822

fbshipit-source-id: 350b770e9a3499a8bad8aca29badc3e20a02f168
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
c23f9454a2 remove hook_tailer
Summary: General-purpose running of hooks has been superseded by the source control service `run_hooks` method.

Differential Revision: D45112823

fbshipit-source-id: 0093953da8fbf4289260058e7db076c2537bf262
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
bbd13dbe99 remove hyper_repo_builder
Summary: This was used for an experiment with very large repos which has now concluded.  Remove the code so that it doesn't need to be maintained.

Differential Revision: D45112825

fbshipit-source-id: 2591ab469ddf40ab8155c9d3713208f9bc3e5463
2023-04-20 07:38:19 -07:00
Mark Juggurnauth-Thomas
bffb54e05e repo_listener: depend on ReadyFlagService from mononoke_app
Summary: Switch from the deprecated cmdlib to `mononoke_app` as a dependency.  The type originates in `mononoke_app` and is simply re-exported from cmdlib, so this is a no-op change.

Reviewed By: RajivTS

Differential Revision: D45092104

fbshipit-source-id: ff8999a68c9707131a5e499b67f6d96492066b28
2023-04-19 07:44:27 -07:00
Mark Juggurnauth-Thomas
223f01b67a server/monitoring: delete unused crate
Summary: This library doesn't seem to be used anymore, so let's delete it.

Reviewed By: RajivTS

Differential Revision: D45092106

fbshipit-source-id: 46d477e6847b876ee2ece74d5e7ca69c787ce32a
2023-04-19 07:44:27 -07:00
Mateusz Kwapich
e0fbffe411 migrate the rest of the tests to use new macro
Summary: Look at at all the lines of code we could delete!

Reviewed By: YousefSalama

Differential Revision: D45057185

fbshipit-source-id: c454a4bd70527460bf4a727aa3ebe57b3becab4d
2023-04-18 07:28:59 -07:00
Mateusz Kwapich
4c1c4ee5f5 port the test for add_recursive to all storages
Summary:
I didn't want to repeat myself too much so I'm introducing macro that will do
that for me.

Reviewed By: YousefSalama

Differential Revision: D45057186

fbshipit-source-id: 6e13a5a72c6ad463982611ce11a16f937dcd9386
2023-04-18 07:28:59 -07:00
Mateusz Kwapich
79391ece39 don't look up into legacy changesets when not needed
Summary:
The add_recursive would try to access the parents from changesets table
even if they're not there yet (in some places we're racing to inster them to
both tables at the same time).

For that we need to:
 * process changesets in reverse topological order
 * check edges_map before trying to fetch parrents from legacy changesets table
 * skip fetching parents if the parent will be processed in the same function call

Reviewed By: YousefSalama

Differential Revision: D45057189

fbshipit-source-id: 7906c610c7a4f8473647796e0c56962e074a035f
2023-04-18 07:28:59 -07:00
Mateusz Kwapich
4ae0dc7077 test showcasing the problem with add_recursive
Summary:
`add_recursive` has problem when adding many changesets not present in the
legacy changesets table. This test showcases the problem, the next diffs will
attempt to fix it.

Reviewed By: YousefSalama

Differential Revision: D45057188

fbshipit-source-id: 56297b7e2d47c6ec65023e9782ac0e18012a4319
2023-04-18 07:28:59 -07:00
Mateusz Kwapich
c9548e2228 add more context annotations
Summary: Those helped me to localize the source of errors. I might as well commmit them.

Reviewed By: YousefSalama

Differential Revision: D45057187

fbshipit-source-id: 694d9596dec030e65b0d29590068103fb1b70ca9
2023-04-18 07:28:59 -07:00
Rajiv Sharma
66388d0f95 Getting file metadata implementation
Summary:
**Context**
D37136735 introduced a new type called `ContentMetadataV2`, to include more information about a file. For example, if a file is binary.

We want to modify the file_info endpoint in SCS, so that users can directly query the metadata for a file.

**This diff**
Implement the modified version of file_info endpoint using the ContentMetadataV2

Reviewed By: markbt

Differential Revision: D43537343

fbshipit-source-id: 98554366a725636d4cd6989fb7e2d9b5fe29d5e4
2023-04-18 07:11:02 -07:00
Rajiv Sharma
ecacdbbd25 Modify the file_info endpoint to support additional metadata
Summary:
**Context**
D37136735 introduced a new type called `ContentMetadataV2`, to include more information about a file. For example, if a file is binary.

We want to modify the file_info endpoint in SCS, so that users can directly query the metadata for a file.

**This diff**
Modify Thrift data type, and the function signature for the endpoint

Reviewed By: markbt

Differential Revision: D43537344

fbshipit-source-id: 6076703f67923e0fa95676b0db812a75fb6c3650
2023-04-18 07:11:02 -07:00
Pierre Chevalier
26711c6a5d Restore pre-clap4 behaviour for flags
Summary:
These have broken production as the behaviour was changed so that `--foo` would no longer be valid when it used to be.

The behaviour changed inadvertently when migrating these CLIs to clap 4.

Differential Revision: D45081836

fbshipit-source-id: ffa7a2a2b1c04c860082bb2770eaa2cde1e7519f
2023-04-18 07:01:03 -07:00
Rajiv Sharma
1337135d0a EdenAPI: Changes for ContentMetadataV2 and Blake3
Summary: The `ContentMetadataV2` provides the seeded blake3 hash for each created file. This information needs to be passed to `buck` which interacts with `EdenAPI` through `EdenFS`. The relevant endpoints in `EdenAPI` are `trees` and `files` which were modified in the previous diff to support the new hash and are used here.

Reviewed By: muirdm, markbt

Differential Revision: D44010967

fbshipit-source-id: a755f0750ed39719b1f0e6895b7ca81a405fcfed
2023-04-14 08:46:55 -07:00
Rajiv Sharma
c8912e4211 Expose ContentMetadataV2 and Blake3 in EdenAPI
Summary: The `ContentMetadataV2` provides the seeded blake3 hash for each created file. This information needs to be passed to `buck` which interacts with `EdenAPI` through `EdenFS`. The relevant endpoints in `EdenAPI` are `trees` and `files` which are modified in this diff to support the new hash.

Reviewed By: quark-zju

Differential Revision: D43977390

fbshipit-source-id: bd9a264dc4483574a7a46e7ce4f9109910f18f2d
2023-04-14 08:46:55 -07:00
generatedunixname89002005287564
9146c01505 Reviewed By: zertosh
Differential Revision: D44994052

fbshipit-source-id: 2cb53e0c9b2719b2b41b12b71d730981bd2d59c4
2023-04-14 05:53:51 -07:00
Mark Juggurnauth-Thomas
bc9b8fbdce scsc: restore default help and switch to -H for host
Summary: The clash between `-h` for both `--help` and `--host` was inadvertent.  Switch to `-H` for `--host` to disambiguate.  It seems clap4 handles this clash less well than clap3 did.

Reviewed By: clara-9

Differential Revision: D44994925

fbshipit-source-id: c4195500cecd2c796e4765c2fbe6047df2f57593
2023-04-14 04:33:46 -07:00
Mark Juggurnauth-Thomas
77efa04681 walker: remove dependency on old cmdlib
Summary: The walker was migrated to the new cmdlib, but still depended on the old one for a couple of structs.  Remove these dependencies.

Differential Revision: D44886561

fbshipit-source-id: 122d8aa01269b49651b95bd431b52045f91b88bc
2023-04-14 03:02:56 -07:00
Mark Juggurnauth-Thomas
3f179e196f lfs_server: use cmdlib_caching::CachelibSettings directly
Summary: LFS server uses the new command library, so no need to import the old one just for this struct.

Differential Revision: D44886560

fbshipit-source-id: 8b8869c9cf717aa622f374468ab061dff0ef349f
2023-04-14 03:02:56 -07:00
Mark Juggurnauth-Thomas
8528fa3aff benchmark_storage_config: migrate to clap 4
Summary: Migrate the storage config benchmark to clap 4.

Differential Revision: D44712483

fbshipit-source-id: dbf96cc33256370a33be3e8a127412a4888b307b
2023-04-14 03:02:56 -07:00
Mark Juggurnauth-Thomas
ca0310a18b benchmark_storage_config: move to benchmarks directory
Summary: This is a benchmark so put it with the benchmarks.

Reviewed By: mitrandir77

Differential Revision: D44712484

fbshipit-source-id: e81a383ca1b89b87dc64577bbc42c56740599bf4
2023-04-14 03:02:56 -07:00
Mark Juggurnauth-Thomas
0a30fb114e benchmark_filestore: migrate to clap 4
Summary: Migrate the filestore benchmark to clap 4.

Differential Revision: D44711492

fbshipit-source-id: fb3c297ef058d661a4ba913a95e50a4938713c28
2023-04-14 03:02:56 -07:00
Mark Juggurnauth-Thomas
0980227ff8 benchmark_filestore: move to benchmarks directory
Summary: This is a benchmark so put it with the benchmarks.

Reviewed By: mitrandir77

Differential Revision: D44711493

fbshipit-source-id: adb9ce812423a11fae4f6c6a368d755780606944
2023-04-14 03:02:56 -07:00
Muir Manders
d24a45984d clone: escape slashes in repo name
Summary:
Canonical repo names can/will have slashes in them. We shouldn't convert slashes to directories on disk; just a bad idea.

When choosing the clone destination, use the basename. It could make sense to clone "foo/bar" into "foo_bar" instead of just "bar", but let's maintain the existing/expected behavior for now.

For internal uses, we percent encode the reponame. For example, the hgcache directory for "foo/bar" will be "foo%2Fbar". This is to minimize chance of collision. If we named the cache dir "foo_bar", that would collide unpleasantly with a repo named "foo_bar".

I relaxed reponame inference a bit to allow slashes in URLs like "test:foo/bar". This was purely so I could test with a reponame containing slashes.

A better long term approach is to use the hash of a canonicalized URL, but that is a bigger change.

Reviewed By: quark-zju

Differential Revision: D44857514

fbshipit-source-id: 4fa0b83a0660b81e89fc96b50ecbeb93869dd2b2
2023-04-13 18:37:07 -07:00
Mark Juggurnauth-Thomas
34cb109590 benchmarks/simulated_repo: remove simulated repo benchmark
Summary: This benchmark was used during development of Mercurial data derivation, however it is very synthetic and we haven't used it in a long time.  Remove it to ease the burden of maintenance.

Reviewed By: mitrandir77

Differential Revision: D44707860

fbshipit-source-id: 6dd2ac893b4020a0c77847c4f10848ba20d96e38
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
0911a84ac3 mercurial_derivation: use instrumented blobstore and database
Summary: Replace the usage of `benchmark/simulated_repo`'s repository with an ordinary test repository with instrumented blobstore (via `DelayedBlobstore`) and database (via `SqliteCallbacks`).  This removes this dependency on this code.

Reviewed By: mitrandir77

Differential Revision: D44707861

fbshipit-source-id: 49d4c2b43aa4dc64b10d94e21d8d242c97e05415
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
e533299ac8 sql: add sqlite callbacks
Summary:
We want the ability to observe and change the behaviour for sqlite connections.  Add the ability to register callbacks that are called whenever the multithreaded sqlite connection is acquired.

No change in behaviour yet.  We will use these in a future diff.

Reviewed By: mitrandir77

Differential Revision: D44707859

fbshipit-source-id: f8156e294bbc51b612a6e38604804b4f815ed919
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
79aec45cef mercurial_derivation/test: move blobrepo test to mercurial derivation
Summary: The blobrepo test is actually a test of mercurial derivation, so move it there.

Differential Revision: D44676336

fbshipit-source-id: 2f7f002a91171a7081ceacb3c6f10b9c62824bfd
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
ff47f69198 derived_data/test: reorganise file layout
Summary: Move the library down into its own test directory with a `src` directory.

Differential Revision: D44676334

fbshipit-source-id: cd65adaf2b4a445f13b05d700be7a30492cadb97
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
de3117ffcc derived_data/filenodes_derivation: reorganise file layout
Summary: Reorganise filenodes derivation so that it matches mercurial derivation.

Differential Revision: D44676333

fbshipit-source-id: bb5e11cb5a8344f3f7e812e1e53360355b1ce36b
2023-04-13 06:39:07 -07:00
Mark Juggurnauth-Thomas
b4a51d76b7 derived_data/mercurial_derivation: reorganise file layout
Summary: Rename to `mercurial_derivation` and create a proper `src` directory.  I plan to make this change consistently across all derived data types, but will start with Mercurial derived data so that I can add a test.

Differential Revision: D44676335

fbshipit-source-id: aae67df807575e532636dd46c4655f135d2d57b0
2023-04-13 06:39:07 -07:00
Thomas Orozco
a029499590 third-party/rust: clean up an unused fixup
Summary: Missed removing it in D44951990, doesn't do anything.

Reviewed By: zertosh

Differential Revision: D44955773

fbshipit-source-id: 158281265eed8ba20cf931d4a37d335012fac614
2023-04-13 06:22:13 -07:00
Thomas Orozco
3e4187c3c9 third-party/rust: unfork prost
Summary: PR got landed!

Reviewed By: IanChilds

Differential Revision: D44951990

fbshipit-source-id: 1d60be52ffc292965e7ce55ec098a9be3acb6aea
2023-04-13 05:07:06 -07:00
Liubov Dmitrieva
89ca08ca45 follow up clean up dead code
Summary:
follow up clean up dead code

forgotten in earlier diff

Reviewed By: YousefSalama

Differential Revision: D44931222

fbshipit-source-id: 6ec965ae5c7851693432fadc9b71df6a967259bb
2023-04-13 02:26:55 -07:00
Liubov Dmitrieva
45f72cf652 deprecate skip list based version of api
Summary:
deprecate skip list based version

this is part of the effort to deprecate skip lists infra known as **Skip Lists Deprecation**

this endpoint is not called, it is safe to remove it server side first

we don't need to keep both for checking correctness, we passed that phase!

Reviewed By: YousefSalama

Differential Revision: D44916005

fbshipit-source-id: 662cfa20ad44346011126e0ae3aae69deb719dbc
2023-04-12 14:39:46 -07:00
Liubov Dmitrieva
39687024b1 fix test
Summary: change test to call correct endpoint

Reviewed By: YousefSalama

Differential Revision: D44915161

fbshipit-source-id: 81deaf9ab1b66a1cc5fdff2fbd1eedc0c1aef79d
2023-04-12 14:39:46 -07:00
Pierre Chevalier
512037a028 Migrate from clap 3 to clap 4
Summary:
See the list of breaking changes upstream:
https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#400---2022-09-28

Reviewed By: markbt

Differential Revision: D44704538

fbshipit-source-id: a651f3c37a5f0de852ac26332131c0d70d697811
2023-04-12 09:15:41 -07:00
Liubov Dmitrieva
3d7819efab log duration for origin request
Summary:
log duration for the origin request

so that we will be able configure replay in a more flexible way

Reviewed By: clara-9

Differential Revision: D44910760

fbshipit-source-id: 8d716376702283e24bb4151eb0a68b8bc2e57e6f
2023-04-12 05:56:04 -07:00
Mark Juggurnauth-Thomas
064d46dfd1 mononoke_api: when diffing, filter out missing copy sources
Summary:
An invalid bonsai changeset or mutable rename could lead to a copy source that does not exist.

For Mercurial derived data, we already ignore this.  Do the same for general diffing.

Reviewed By: mitrandir77

Differential Revision: D44909673

fbshipit-source-id: ac754e0e483e75976afb07078e57bc1f33008a17
2023-04-12 05:28:09 -07:00
Mark Juggurnauth-Thomas
515b140897 repo_factory: construct sql more consistently
Summary:
In the repo factory, we do different things for sql connection creation in tests and prod.  In prod we cache `MetadataSqlFactory` instances for each metadata database configuration, and request a new connection from the cached factory each time.  In tests, this doesn't work, as requesting a new sqlite connection from the factory is the same as opening the file again, which can be slow for large numbers of connections, so instead we cache connections directly in the repo factory, which isn't really the right place.

We can fix this by making the `MetadataSqlFactory` handle the caching of sqlite connections for us.  This makes the repo factory consistent between prod and test.  It also means the `MetadataSqlFactory` can hold on to the original connection to the sqlite database and perform the creation queries directly, rather than having to hold it separately in the wrapper around `SqlConnections`, and we can deduplicate the code for opening the database, too.

Reviewed By: mitrandir77

Differential Revision: D44665118

fbshipit-source-id: 1c7d45ac1900d5f2b36285e01159924d0cdb09eb
2023-04-12 01:48:40 -07:00
Mark Juggurnauth-Thomas
8ea1da962c backsyncer: remove connections from TargetRepoDbs
Summary: These connections are no longer used, so they and their setup code can all be removed.

Differential Revision: D44635160

fbshipit-source-id: 4407a9318086b61942523cf551988e394c6df2e1
2023-04-12 01:48:40 -07:00
Mark Juggurnauth-Thomas
6224b73493 tests_utils: extract random repo generation from simulated repo benchmark
Summary: This is already used by a couple of other tests, so it makes sense to move it out of the benchmark.

Differential Revision: D44635161

fbshipit-source-id: 41414b66b380ea1d5635c6131df4fa3f3084fcfc
2023-04-12 01:48:40 -07:00
Mark Juggurnauth-Thomas
5ca0d3803d walker: stop logging ODS stats per blob type
Reviewed By: mitrandir77

Differential Revision: D44752057

fbshipit-source-id: 28d22fd6ab74a82feb5d80da3d34445d6a06445b
2023-04-11 14:38:55 -07:00
Clara Rull
4a173f7127 Migrate commit validator to Clapv3
Summary: Migrate commit validator tool to Clapv3

Differential Revision: D44744111

fbshipit-source-id: ccd68c9d1e11b51121f55968ee5470f6d1ec477d
2023-04-11 11:23:51 -07:00
Rajiv Sharma
7ed783094a Add support for git-extra-headers
Summary: The previous diffs added support in SCS and remote-gitimport for including the `git-extra-headers` as part of the mirrored commits in Mononoke. This diff adds similar support for gitimport.

Differential Revision: D44869271

fbshipit-source-id: 5941b0c8729cd972188cc758837c6c1f1b0f72a1
2023-04-11 08:22:40 -07:00
Rajiv Sharma
d6437e07c8 Log the blobstore key while healing ContentMetadataV2
Summary: The current healing logs just mention that a CMv2 blob was healed, but there is no mention of the actual blobstore key that it healed. This diff updates that.

Reviewed By: mitrandir77

Differential Revision: D44164682

fbshipit-source-id: c156a930716499fb1b5c7b248ce11d6bf88f8281
2023-04-11 05:28:18 -07:00
Rajiv Sharma
0551fadccd Enable double writing of ContentMetadata
Summary: To maintain backwards compatibility for a while, we will be writing both the new `ContentMetadataV2` and the old `ContentMetadata` blobs. This will be behind a tunable which will be removed once we can verify that the code works as expected with `ContentMetadataV2`

Reviewed By: markbt

Differential Revision: D44221076

fbshipit-source-id: 95c01a96198a99e53ab3ea4f1b04b1ba78f4b298
2023-04-11 05:10:37 -07:00
Rajiv Sharma
e5b45f5bf2 ContentMetadataV2: Everything, Everywhere, All At Once
Summary: D44136799 was the backout diff for backing out all the ContentMetadataV2 changes made so far. This was due to the reason that the changes were landed before the backfilling was completed. This diff is the revert of the backout, to be landed when the backfilling is properly completed.

Reviewed By: YousefSalama

Differential Revision: D44195175

fbshipit-source-id: 2872c699cc7c41cf436a1c7123e01a5190db7ece
2023-04-11 05:10:37 -07:00
Andres Suarez
f28416d323 Update various deps to remove windows-sys <0.45.0
Reviewed By: diliop

Differential Revision: D44825274

fbshipit-source-id: 91a11c1bdf8bca7a4bee7e839d8f5a36d19a555c
2023-04-10 13:26:13 -07:00
Andres Suarez
73afd9815a Remove rust-analyzer
Summary:
rust-analyzer is now built elsewhere see D44593330 and
https://fb.workplace.com/groups/rust.language/posts/24528978643390753

Reviewed By: diliop

Differential Revision: D44809188

fbshipit-source-id: 41ea8980601dc1237e6fdcfc84193d1b038c3553
2023-04-07 20:27:41 -07:00
Youssef Ibrahim
f2ae8faeb7 tunables: add special keys :override: and :default: to by-repo tunables
Summary: Sometimes it's desirable to set the value for a by-repo tunable for all repos (e.g. to roll out a change everywhere after testing on some of the largest repos, or to quickly roll back) or to specify a default value, and right now the only two ways of doing this is either to specify the value for every single repo separately, or to have another non-by-repo tuanble that overrides it. Instead let's have two special keys: ":override:" and ":default:", so whenever we try to lookup a by-repo tunable we first check if it's set for ":override:" and use its value if so, otherwise we lookup the repo specific value, otherwise we lookup the value for ":default:".

Reviewed By: markbt, RajivTS

Differential Revision: D44750394

fbshipit-source-id: d8fe074ec700f69e52129dfa7de87b7972d11012
2023-04-06 10:36:48 -07:00
Mark Juggurnauth-Thomas
64be5511f5 context: reset the scuba sequence counter for loops and edenapi requests
Reviewed By: singhsrb

Differential Revision: D44715322

fbshipit-source-id: ea71ba6ea513916b95129b3e9c60677f70a499be
2023-04-05 15:20:52 -07:00
Barys Skarabahaty
caad6a5862 switch env_logger to 0.10
Summary:
There is a new `Target::Pipe` that could be used to redirect logs to a file. So updating to the latest version which doesn't add any breaking changes.

Also, updating the deprecated call sites:
```
xbgs -sl 'env_logger::from_env' \
| arc linttool debugfilterpaths --take RUSTFMT \
| xargs sed -i 's/env_logger::from_env/env_logger::Builder::from_env/'

arc f
```

Reviewed By: dtolnay

Differential Revision: D44671457

fbshipit-source-id: 6734f2839731b189564d3b7ceffcd95410fe02e8
2023-04-05 14:02:08 -07:00
Muir Manders
b6e6497203 blame: support fetching blame data from EdenAPI
Summary:
If experimental.edenapi-blame is configured and the repo has an edenapi client, the annotate command will fetch blame data from the new blame endpoint.

Currently this doesn't support any of the whitespace options since the server only provides whitespace sensitive blame data. We can probably emulate the whitespace insensitive behaviors locally with more work.

Reviewed By: mitrandir77

Differential Revision: D44596604

fbshipit-source-id: 73d7462d0ded2d6941b704dfb0294e52f462879a
2023-04-05 12:05:57 -07:00
Muir Manders
911de56fb9 handlers: add "blame" handler
Summary:
This handler simply exposes the existing blame derived data over EdenAPI.

The main work is re-indexing the commit index so it can be a simple list instead of a VecMap.

Any error is propagated in-band in the results. I was a little surprised to learn that errors within the HandlerResult stream are ignored (i.e. not propagated to client). It seems like the stream items should have an envelope type to allow automatic Result propagation from server to client.

Reviewed By: quark-zju

Differential Revision: D44596606

fbshipit-source-id: 0ae9d501a35e3e930fd4cbe710fd3e76f493312c
2023-04-05 12:05:57 -07:00
Muir Manders
5853e03874 utils: make to_hg_path operate on MPath
Summary:
The one existing user has MPath in hand (and so does my upcoming code).

Also, defer the error context to avoid copying bytes (again) when there is no error. Note that the ParseError returned by RepoPathBuf::from_utf8 itself contains the bad bytes, but there doesn't seem to be a good way to share those bytes without losing context.

Reviewed By: mitrandir77

Differential Revision: D44596605

fbshipit-source-id: d9b1f635a7e5b90828f934707845a2efcb5c08a5
2023-04-05 12:05:57 -07:00
Egor Tkachenko
f5b4489fc2 Derive the latest underived commit for bookmark instead of all one-by-one.
Summary:
Currently WBC on each bookmark change will try to find all underived cs_ids and will request derivation for them one-by-one. This is redundand because both old path (using derivation manager) and new path (DDS) doing that discovery internally and will derive all dependency.
This diff just removing the part when WBC asks for derivation of each commits and just requests the latest underived commit, however it will still doing discovery of underived commits.
The next step would be to add an API for DDS to answer queries about derived bookmarks locations. This way we could remove discovery part completely.

Reviewed By: RajivTS

Differential Revision: D44536860

fbshipit-source-id: 3867abdf095141b89da44242a35327da02ab05f8
2023-04-05 10:09:48 -07:00
Rajiv Sharma
06c3d8a71b Populate git extra headers in gitimport
Summary: Now that the dependent logic is in place, this diff parses the git commits and extracts the git headers. It then passes these git headers while creating the corresponding changeset at Mononoke end using SCS's `repo_create_commit` method.

Differential Revision: D44705976

fbshipit-source-id: 464695e273908ef7642514b08158be4affc32ac2
2023-04-05 08:22:28 -07:00
Liubov Dmitrieva
dd4c17e918 introduce h2 support
Summary:
Introduce **h2** support into mononoke server.

Remove alpn crate that repeats the standard "select_next_proto" method

Server now offers the following protocols: hgcli, h2, http/1.1 in this order in protocol negotiation.

We will select the first protocol supported by the server which is also supported by the client.

This will add h2 support server side but won't change protocols currently used (because h2 is not offered client side right now, while http/1.1 is explicitly set).

We then later will switch **only** Eden Api Traffic to H2 by enabling the following config client side via slow rollout:

```
[edenapi]
http-version=2
```

We might need to tune some settings on proxygen side before that.

Wireproto traffic will continue to be obliged to set http/1.1 client side explicitly, which is totally fine because it needs web socket upgrade.

###  At a high level, HTTP/2:

* is binary, instead of textual
* is fully multiplexed, instead of ordered and blocking
can therefore use one connection for parallelism
* uses header compression to reduce overhead
* allows servers to “push” responses proactively into client caches

Reviewed By: mzr

Differential Revision: D44540283

fbshipit-source-id: 560d80d68d5d364adee122881d12cf61ba9f1695
2023-04-05 03:53:22 -07:00
Youssef Ibrahim
61d2cfda56 commit_graph_compat: clean up enable_writing_to_new_commit_graph and enable_reading_from_new_commit_graph
Summary:
Double writing is enabled for all repos for a long time, so it's safe to delete enable_writing_to_new_commit_graph.
enable_reading_from_new_commit_graph was never used since we needed more granular tunables.

Reviewed By: Croohand

Differential Revision: D44624559

fbshipit-source-id: a06a0f2079bb735e93d72d0d24bbc7ae684600a7
2023-04-05 03:20:07 -07:00
Manu Bretelle
9d7b96ec41 sync with latest upstream now that changes have been merged
Summary:
The latest "main" contains all the patches that we were carrying on my
fork so far. Bonus point, hyperx is not a depedency anymore so we can also get
rid of this.

Reviewed By: zertosh

Differential Revision: D44682428

fbshipit-source-id: cbb1da18edce7478a5454d1a3ba70bd8767e089c
2023-04-04 15:55:35 -07:00
Thomas Orozco
22e700ccf3 (reland) rust/third-party: update to futures 0.3.28
Summary:
Note: this is a re-land of D44623815, which was was reverted because of a land race with D44626072

In particular this fixes `FlattenUnordered` having a nasty deadlock, but also
some other  bugs:

```
# 0.3.28 - 2023-03-30

* Update to syn 2. This raises MSRV of utility crates to 1.56. (#2730, #2733)
* Fix bug in `FlattenUnordered` (#2726, #2728)

# 0.3.27 - 2023-03-11

* Add `TryFlattenUnordered` (#2577, #2590, #2606, #2607)
* Add `AbortHandle::is_aborted` (#2710)
* Add `AbortRegistration::handle` (#2712)
* Make `BiLock` strict-provenance compatible (#2716)

# 0.3.26 - 2023-01-30

* Add `Either::as_pin_mut` and `Either::as_pin_ref` (#2691)
* Add `Shared::ptr_eq` and `Shared::ptr_hash` (#2691)
* Implement `FusedStream` for `Buffered` (#2676)
* Implement `FusedStream` for all streams in `ReadyChunks` (#2693)
* Fix bug in `FuturesOrdered::push_front` (#2664)
* Remove `Fut::Output: Clone` bounds from some `Shared` methods (#2662)
* Remove `T: Debug` bounds from `Debug` implementations of `mpsc` and `oneshot` types (#2666, #2667)

# 0.3.25 - 2022-10-20

* Fix soundness issue in `join!` and `try_join!` macros (#2649)
* Implement `Clone` for `sink::Drain` (#2650)

# 0.3.24 - 2022-08-29

* Fix incorrect termination of `select_with_strategy` streams (#2635)

# 0.3.23 - 2022-08-14

* Work around MSRV increase due to a cargo bug.
```

Reviewed By: zertosh

Differential Revision: D44632588

fbshipit-source-id: bdd87cb02b3aef63a65b1f9b852579225adfedbd
2023-04-04 10:14:43 -07:00
Mark Juggurnauth-Thomas
a7bf8e9615 caching_ext: add bypass for filling no-op memcache
Summary: When calling `fill` methods on a no-op memcache, we do all the work to serialize the data and then throw it away.  Add a quick check at the start of the fill method to exit early.

Reviewed By: YousefSalama

Differential Revision: D44503801

fbshipit-source-id: fd490bb5cce70ee1bca931e55e1671faec09e894
2023-04-03 13:48:10 -07:00
Mark Juggurnauth-Thomas
cb0bd67f70 commit_graph: don't prefetch if we only have a hint
Summary: The `Prefetch::Hint` variant indicates that prefetching is possible, but should not be acted upon unless an intermediate caching layer determines that the prefetch should be included.  That means when we ask for the target, we shouldn't return a hinted target.

Reviewed By: liubov-dmitrieva

Differential Revision: D44498446

fbshipit-source-id: 56a0fb3b09de985cca9989335375daf972e43276
2023-04-03 13:48:10 -07:00
Mark Juggurnauth-Thomas
5110cf02c6 commit_graph: do not look-up memcache for prefetches
Summary: If we have missed in cachelib, and been asked to prefetch, then memcache fetches are actually slower than the prefetch would be, even if memcache is warm. Instead, go straight to the database and prefetch from there.

Reviewed By: mitrandir77

Differential Revision: D44498103

fbshipit-source-id: 944c26d553a770e054f38f478cf2bd475afa413f
2023-04-03 13:48:10 -07:00
Mark Juggurnauth-Thomas
daf0d17391 commit_graph: prefetch first parents when computing ancestors difference
Summary: When computing ancestors difference, we need all of the commits on the `head` branches, not just the skew binary steps.  Prefetch all of them.

Reviewed By: YousefSalama

Differential Revision: D44498105

fbshipit-source-id: acf08930361f03c76685a94fff2c5a41a99089b3
2023-04-03 13:48:10 -07:00
Mark Juggurnauth-Thomas
69ad9115f3 commit_graph: make prefetch steps a parameter of prefetch
Summary: Make the number of steps taken a parameter of prefetching, so that we can vary it based on prefetch type.

Reviewed By: YousefSalama

Differential Revision: D44498104

fbshipit-source-id: 9d24af68ea620fd11a18d9dbaa822fc9848fdd3c
2023-04-03 13:48:10 -07:00
Mark Isaacson
3463e3d61b Revert D44623815: rust/third-party: update to futures 0.3.28
Differential Revision:
D44623815

Original commit changeset: 343ddb9277e1

Original Phabricator Diff: D44623815

fbshipit-source-id: 2d99e8d24fd9b13343dfeb082788b0a6258fbe8c
2023-04-03 09:25:13 -07:00
Thomas Orozco
159cf5c5e6 rust/third-party: update to futures 0.3.28
Summary:
In particular this fixes `FlattenUnordered` having a nasty deadlock, but also
some other  bugs:

```
# 0.3.28 - 2023-03-30

* Update to syn 2. This raises MSRV of utility crates to 1.56. (#2730, #2733)
* Fix bug in `FlattenUnordered` (#2726, #2728)

# 0.3.27 - 2023-03-11

* Add `TryFlattenUnordered` (#2577, #2590, #2606, #2607)
* Add `AbortHandle::is_aborted` (#2710)
* Add `AbortRegistration::handle` (#2712)
* Make `BiLock` strict-provenance compatible (#2716)

# 0.3.26 - 2023-01-30

* Add `Either::as_pin_mut` and `Either::as_pin_ref` (#2691)
* Add `Shared::ptr_eq` and `Shared::ptr_hash` (#2691)
* Implement `FusedStream` for `Buffered` (#2676)
* Implement `FusedStream` for all streams in `ReadyChunks` (#2693)
* Fix bug in `FuturesOrdered::push_front` (#2664)
* Remove `Fut::Output: Clone` bounds from some `Shared` methods (#2662)
* Remove `T: Debug` bounds from `Debug` implementations of `mpsc` and `oneshot` types (#2666, #2667)

# 0.3.25 - 2022-10-20

* Fix soundness issue in `join!` and `try_join!` macros (#2649)
* Implement `Clone` for `sink::Drain` (#2650)

# 0.3.24 - 2022-08-29

* Fix incorrect termination of `select_with_strategy` streams (#2635)

# 0.3.23 - 2022-08-14

* Work around MSRV increase due to a cargo bug.
```

Reviewed By: zertosh

Differential Revision: D44623815

fbshipit-source-id: 343ddb9277e1703104e516d07fe0610b5020930a
2023-04-03 08:30:49 -07:00
David Tolnay
b16ffe2361 Unfork and update reqwest
Reviewed By: zertosh

Differential Revision: D44556211

fbshipit-source-id: 4a4b924163db5270f956aff58e0e2087d115715c
2023-03-30 18:48:13 -07:00
Andres Suarez
c50f383869 Update tempfile from 3.4 to 3.5
Reviewed By: quark-zju

Differential Revision: D44524245

fbshipit-source-id: 167471d01b0afbbc34ced88574dbfb09799aadf6
2023-03-30 17:11:37 -07:00
Pierre Chevalier
95d005132a Fix flaky cross-repo-globalrevs test
Summary:
This test used to be detected as flaky in mode/dev-rust-oss and flaky, but not detected as such in mode/opt.

This was due to a race condition between fresh and warm bookmarks, which take a while to update due to WBC.

Using the helper functions to wait for bookmarks to get warm, or directly querying fresh ids, fixes the issue.

Reviewed By: RajivTS

Differential Revision: D44543648

fbshipit-source-id: f70b16609fe995341b84a77e590efdc3d71b4fdf
2023-03-30 11:53:36 -07:00
Pierre Chevalier
5c2ec7a021 Really fix test that sometimes breaks contbuild
Summary:
D44297278 was an attempt at fixing this test, but the regex for lines with DEBUG
wasn't actually correct as it's not actually the first pattern in the strings being grepped.
It may be preceded by some spaces.

Yesterday, we saw a contbuild breakage caused by this.
https://www.internalfb.com/intern/sandcastle/job/9007200167370789/insights

Relax the grep step to achieve the intent of the previous diff.

Reviewed By: RajivTS

Differential Revision: D44536438

fbshipit-source-id: a40719f4669b55b2442715bc9350b8dcce7a9747
2023-03-30 05:09:43 -07:00
Mateusz Kwapich
dc7a5cea3e separate out tests with disabled network access
Summary:
Running tests with network access disabled is much slower. Let's separate those
test targets out so on CI we run with and without network access disabled. For
iterating during developement the tests with network access enabled are
usually enough.

In this diff I:
 * add `disable_all_network_access_target` option to `dott_test` rule that adds the extra test target disabling network access
 * convert existing opt-out list into options on test target - this required  separating some targets as the config is now on per-target not per-test level

Reviewed By: clara-9

Differential Revision: D44474156

fbshipit-source-id: 780fc81c24b22e2dcae98901cd604dc50f16c70c
2023-03-30 04:31:24 -07:00
Mark Juggurnauth-Thomas
6b5bb09b71 sql_commit_graph_storage: implement prefetching of changeset edges
Summary:
Implement prefetching of commit graph edges via recursive common table expressions.

Prefetching can be performed either by the first parent edge, or by the skip tree skew ancestor edge.  We can add more edges later on, however the nature of the `mononoke_queries!` macro means each one needs its own, only slightly customized, version of the SQL query that performs the operation.

Reviewed By: liubov-dmitrieva

Differential Revision: D43455724

fbshipit-source-id: 75f19533f1f4e9d118a098469bbe3f8afb5f7f92
2023-03-28 05:25:45 -07:00
Mateusz Kwapich
1f3635f8a2 disallow deleting files in native pushes
Summary:
The `native_push_only_deny_patterns` contains the list of paths that should be
changed only via pushrebase operations.

I think the `native_push_only_deny_patterns` should be moved into its own hook
but let's start from fixing current behaviour and refactor later.

Reviewed By: liubov-dmitrieva

Differential Revision: D44433734

fbshipit-source-id: 2da93e84763cdfb7ee997cb148d4eac288fba27f
2023-03-28 05:05:33 -07:00
Ilia Medianikov
e9f9002dda scs/land_stack: log small repo commits to mononoke_new_commit category
Summary:
During cross-repo pushrebases, we need to log new commits both in large and small repos. But currently, due to the code organization, it is not too hard to forget logging in the small repo. Which is what happened in case of SCS land_stack method.

This land path was not covered, and only large repo commits were logged. For example, this led to most public opsfiles commits being missing from the category (sync to opsfiles_backup uses different code path and exposes the discrepancy):
{F912075962}
(https://fburl.com/scuba/mononoke_new_commit/8q0nbq8i)

Reviewed By: markbt

Differential Revision: D44187074

fbshipit-source-id: bba2bf112fc9326ae5fc177d421ec936a2bb5322
2023-03-27 09:28:24 -07:00
Mark Juggurnauth-Thomas
8aced3e694 cmdlib: move tokio runtime out of environment
Summary:
The environment is passed into the async runtime via an `Arc`.  If the last reference to the environment is dropped from within the runtime, then we end up destroying the runtime from within the runtime, which is an error.

Move the runtime out of the environment, and store it in the `MononokeApp` (new) or on the stack in `main` (old).  This means the runtime will live on the stack outside of the async runtime, and so execution of all async code should be complete when they are dropped.

Reviewed By: YousefSalama

Differential Revision: D44299775

fbshipit-source-id: 9a93ba49a8bbf376defdd0b5ddb1d6546b5ff12b
2023-03-27 07:13:45 -07:00
Liubov Dmitrieva
881cbac1ff rename "edenapi_replay_unsampled_duration_threshold_ms" to
Summary: rename to match edenapi_req_dumper_sample_ratio

Reviewed By: markbt

Differential Revision: D44416302

fbshipit-source-id: a7693c5e6d02e2c802b7da9702eb7ac2cad00c42
2023-03-27 06:59:37 -07:00
Liubov Dmitrieva
e09402f047 improve proxygen health check to take into account requests load
Summary:
Improve proxygen health check to take into account requests load. Configurable with a tunable.

Let's separate two completely different health checks because otherwise it is very confusing, and now we can configure them differently.

One is used for tupperware **/health**, and I created another one for monitoring VIP health  **/proxygen/health_check**.

**Background:**

During the overloads, we can see request load is very high (number of concurrently running requests), this is a good signal to see that a server is overloaded. So let's set up a limit like **20K requests** load and fail health check for a while until load decreases, so traffic can be automatically diverted to other tasks.

https://fburl.com/scuba/mononoke_test_perf/my8rnt9n

In a normal situation load is never higher 10K, see MAX metric

https://fburl.com/scuba/mononoke_test_perf/aqdf7pwm

Threshold can be configured via a tunable

**Current set up:**

At the moment we use nginx health check (default)

It’s configured to have health check every 10000ms https://www.internalfb.com/code/configerator/raw_configs/ti/teams/server_health/traffic_proxygen.nginx.json

**Current Alerts:**

The VIP health is based on the health check of the backend and the VIP has an alert will escalate to our oncall if some become unhealthy

https://www.internalfb.com/code/configerator/[master]/raw_configs/ti/alerts/vip-alerts/scm-mononoke-intern.detector

https://www.internalfb.com/code/configerator/[master]/raw_configs/ti/alerts/vip-alerts/scm-mononoke-intern_fail_open.detector

It will fire a major alert at **65%** capacity and then a ubn at **50%** capacity, this is per **DC**.

The alert is specific for us, we can reconfigure if we need

**New health check**

We can configure a custom health check using this editor:

https://www.internalfb.com/intern/traffic/editor?backend_workspace[0]=source_control_services.scm_mononoke&backend=source_control_services.scm_mononoke

We can create a new one like https://www.internalfb.com/intern/traffic/editor?backend_workspace[0]=source_control_services.scm_mononoke&health_check_workspace[0]=source_control.scm_mononoke_healthcheck&health_check=source_control.scm_mononoke_healthcheck

**New monitoring**

We can reconsider if **65% capacity and then a ubn at 50% capacity per DC** is what we need.

**TW health check has a different purpose**

TW will kill a task if health check fails for a configured period of time. For out tasks restarts are expensive.

https://www.internalfb.com/intern/wiki/Tupperware/Monitoring/Service_Health/#task-lifecycle-and-healt.

Reviewed By: clara-9

Differential Revision: D44369243

fbshipit-source-id: 3a2a1a1f83f1b17217e44026d19eb7c317859f7d
2023-03-27 06:44:07 -07:00
Liubov Dmitrieva
d401d3b747 improve README
Summary: improve README

Reviewed By: YousefSalama

Differential Revision: D44416831

fbshipit-source-id: 783fd3515e7b8ddcb344d5595a0a0ac90e04a865
2023-03-27 06:30:06 -07:00
Pierre Chevalier
7ff2ceffb5 Unflake segmented changelog test
Summary:
This test has been flaky practically since its creation, although below the threshold to be detected as such some of the times.
Looking at its journal, it failed its first stress run and more than half
of the stress runs thereafter (failed 1920 of them, passed 1519 of them).

The assumption that the test makes that we will always take the local path first
is not stable and has never been.

Match the test's expectations to the actual behaviour of mononoke for now.

If the behaviour is problematic, let's tackle it in its own time.

Note that this test was written here D34276252 in reaction to a change to
segmented changelog here D34041066 and the discussion on that diff is relevant
to establish the correctness of the code.

Reviewed By: RajivTS

Differential Revision: D44297278

fbshipit-source-id: 07f42fc11ca0aa637b59b5fc46263b65d624e0a4
2023-03-27 05:11:34 -07:00
Egor Tkachenko
bdd11d99e8 Add logging when service requests remote derivation
Summary: After enabling remote derivation we've lost related to derivation logging in the parent scuba table (like SCS server). This diffs add log tags, which indicates when we requested remoted derivation and when it was finished. In case of the error we already had the logging in place.

Reviewed By: Croohand

Differential Revision: D44297304

fbshipit-source-id: 1e2f6e279e111ce01b2feaf950a11c7b69a314cf
2023-03-27 01:36:08 -07:00
Pierre Chevalier
7ef796bc1c Derive Default on Enums
Summary:
In Rust 1.68.0, the `derivable_impls` clippy lint [got smarter](https://github.com/rust-lang/rust-clippy/pull/10161).
Fix all instances of that lint in Mononoke, mute one that's impractical to address.

Reviewed By: markbt

Differential Revision: D44378068

fbshipit-source-id: 473a051a7001d9596db43f47b56cbad5f5db7efe
2023-03-24 13:41:24 -07:00
Pierre Chevalier
c0a82f23bd Remove useless into_iter() calls
Summary:
In Rust 1.68.0, the `useless_conversion` clippy lint [got smarter](https://github.com/rust-lang/rust-clippy/pull/10020).
Fix all instances of that lint in Mononoke.

Reviewed By: markbt

Differential Revision: D44378069

fbshipit-source-id: acfd6c77c6a400830c378b4040661323e7232441
2023-03-24 13:41:24 -07:00
Mark Juggurnauth-Thomas
7adc50cf69 edenapi: monitor long-running requests
Summary: If an EdenAPI request is taking too long, we currently have no signal into this until it either completes or is cancelled.  As for wireproto, add logs for long-running requests.

Reviewed By: liubov-dmitrieva

Differential Revision: D44340299

fbshipit-source-id: e24bed96505964c519ea85748207670ded3baacb
2023-03-24 11:05:45 -07:00
Mark Juggurnauth-Thomas
917e1865f3 edenapi: add tunable limit for large tree metadata
Reviewed By: mitrandir77

Differential Revision: D44334056

fbshipit-source-id: b5c79c767876caba4720191b97180eaea202c78e
2023-03-24 11:05:45 -07:00
Mark Juggurnauth-Thomas
e78f4fba36 stats: log streams stats when streams are cancelled
Summary:
When streams are cancelled we lose all of their stats, as they only get logged after the stream is polled to completion.

Make the stream stats callback synchronous (we don't actually use its async nature), which means we can call it from a `Drop` implementation, allowing us to log the stats even when the stream is not completed.

To distinguish the two cases, we add a "completed" flag, which is true if the stream was polled to completion.

This also makes `completion_time` optional, as we don't have a value for this if the stream was never polled at all when it got dropped.

`TimedStream` had an implicit fuse-like nature (once completed the stream would never yield anything again), which we rely upon, so make sure this property is maintained.

Reviewed By: liubov-dmitrieva

Differential Revision: D44331959

fbshipit-source-id: 5a7d9875a4d7fd4276c304b6c30ff45c6b990b38
2023-03-24 11:05:45 -07:00
Mark Juggurnauth-Thomas
efddf499d1 virtually_sharded_blobstore: ensure future is removed even if cancelled
Summary:
As Croohand pointed out on D44183928, if the shared future is cancelled, the `WeakShared` will linger in the collection until the next read of that key.  If the read of that key never comes, it will never be cleaned up.

Switch to a scopeguard, that we move into the future.  This will execute the code to remove the shared future whether the future succeeds, fails, or is dropped.

Reviewed By: Croohand

Differential Revision: D44342772

fbshipit-source-id: 37fb15d126d8289d61ab33f64f6e1cf9f7a8550d
2023-03-24 10:02:48 -07:00
Ilia Medianikov
6ae2f500f4 mononoke/scribe_logging: override WhenceScribeLogged to always log to prod instead of default
Summary:
In production we use Logger to log to Scribe (e.g. to "mononoke_new_commit" category). It has WhenceScribeLogged enum field which can be "default", "prod", "sandbox", etc.

Without override, Logger sets "default" value that usually resolves to "prod", **but** it resolves to "sandbox" if code is run from devserver. "sandbox" means we log data to "/sandbox" category instead of usual place.

This is confusing/harmful for us since we only configure to use Logger while working with prod data. For example, if we run SCS locally and land to prod using "land_stack", the commit will go to prod while logging will go to sandbox category. On the other hand, if we run Mononoke Bootstrap to work with a test repo, we don't use Logger at all so the "sandbox" category has no benefit.

We can add more complexity to the Mononoke logging configuration, so we are able to override WhenceScribeLogged in any way we want. But for now, I suggest overriding it in place with "prod" value since we only use Logger in prod. Later we can even simplify the config by removing the old way of logging directly to Scribe and leave just two options: test (log to file) and prod (log via Logger using the "prod" override).

Reviewed By: markbt

Differential Revision: D44118890

fbshipit-source-id: 8d4b9faa6f1f2da1faa96db35dd567102ccde34d
2023-03-24 08:39:35 -07:00
Jeremy Fitzhardinge
3fe40d1f02 third-party/rust: update tracing-subscriber for Option<Filter>
Summary: Import https://github.com/tokio-rs/tracing/pull/2402 until it lands.

Reviewed By: zertosh

Differential Revision: D41689583

fbshipit-source-id: f1923244fcc652ba4dfcd6064aa37926a2b79bc7
2023-03-23 12:41:48 -07:00
Mark Juggurnauth-Thomas
2fa948e8a5 warm_bookmarks_cache: add warmer for bssm
Summary: Basename suffix skeleton manifests are not been warmed by the warm bookmark cache.  This means requests that need these are slowed down while they are derived.  Add a warmer for them.

Reviewed By: yancouto

Differential Revision: D43906545

fbshipit-source-id: e1f77b5fe2a7a4512bfc49bf8047afef9b441fa9
2023-03-23 10:09:00 -07:00
Liubov Dmitrieva
26fb45f25f do not sample out slow requests
Summary:
do not sample out slow requests in edenapi replay

we already don't sample them in mononoke test perf

if we also don't sample here, we will have more insight in those and also we will be able to replay

Reviewed By: clara-9

Differential Revision: D44258777

fbshipit-source-id: 597fc475062b23eb24b0c61024eea9046b808420
2023-03-23 04:13:52 -07:00
Mark Juggurnauth-Thomas
931e89a1cd virtually_sharded_blobstore: deduplicate reads of large blobs
Summary: Deduplicate reads of large blobs by using a shared future for any in-flight reads.  If another read for the same key comes in after then we will read it again, but there should be at most one read in flight for a particular key at a time.

Reviewed By: Croohand

Differential Revision: D44183928

fbshipit-source-id: d6911422a6e16b3dd246dd48cbce4390e6856940
2023-03-23 02:22:35 -07:00
Mark Juggurnauth-Thomas
7eae254179 virtually_sharded_blobstore: make it possible to convert Ticket to static lifetime
Summary: Make it possible for tickets to become `'static` by using `std::borrow::Cow` for the borrowed values, and converting to the owned variant if needed.  We will use this to shared futures that hold a ticket.

Reviewed By: Croohand

Differential Revision: D44262842

fbshipit-source-id: 2c549b2f2f3724c6485b41463b973273211dfe77
2023-03-23 02:22:35 -07:00
Mark Juggurnauth-Thomas
d3b53a9bfd virtually_sharded_blobstore: move awaited check to inner struct of Ticket
Summary:
The `awaited` boolean on the `Ticket` structure and corresponding `Drop` makes it impossible to move out of the fields of `Ticket`.  This is inconvenient, especially since it only enables a unit test check.

Move the field to a structure that's internal to the `Ticket`.  We still check for failure to await, as dropping the `Ticket` with a `CheckAwait` that hasn't been marked as awaited will still panic during tests when the inner `CheckAwait` gets dropped.

Reviewed By: Croohand

Differential Revision: D44270321

fbshipit-source-id: 29429c40243b31dcc1a5046969b85fb7a15fd0aa
2023-03-23 02:22:35 -07:00
Mark Juggurnauth-Thomas
b1c504f22c mononoke_api: remove success log for new commit graph
Summary: This log was useful while we were testing the new commit graph, but now it is too noisy and should be removed.

Reviewed By: liubov-dmitrieva

Differential Revision: D44297423

fbshipit-source-id: c9969d4a0b4709ea2065f19508ae6b51a7ee6baf
2023-03-23 01:30:34 -07:00
Andres Suarez
71f5bdec8b Unfork daemonize
Summary:
daemonize-0.5.0 has been released:
https://crates.io/crates/daemonize/0.5.0

Reviewed By: diliop, dtolnay

Differential Revision: D44303114

fbshipit-source-id: 69f7b0d091b92b31cb1b595198f31aeb41bfb601
2023-03-22 11:23:15 -07:00
Andres Suarez
29266dbdee Unfork and update bindgen
Summary:
Both waiting-in PRs have been merged and released:

- https://github.com/rust-lang/rust-bindgen/pull/2319
- https://github.com/rust-lang/rust-bindgen/pull/2326

Adding `artifact = "bin"` removes the need for the `lib.rs` patch:

- 357927634f

Reviewed By: jsgf

Differential Revision: D44301594

fbshipit-source-id: d5ac1b54b099655e8e87974e42439bcd32aa5aed
2023-03-22 11:23:15 -07:00
Mateusz Kwapich
18fee6dffd flush bookmark cache in the pull test
Summary:
Sometimes the tests run so fast that we're being served stale version of the
bookmarks.

This may cause the test to occasionally take the fast path where it expects to take the slow path, and has caused this test to be flaky since its creation (although not always flaky enough to be marked as such).

Differential Revision: D44298928

fbshipit-source-id: 046ce5bc4e005f3d443794202352bfdc5c80895a
2023-03-22 09:55:41 -07:00
Rajiv Sharma
c48b5fe53a Publish liveness metric for ConfigUpdater process
Summary: Youssef accidentally discovered that config hot reloading was not working for SCS server when working on an oncall task. He then went ahead and fixed that issue in D44206206. However, we did not get any notification or alert about this problem and it would have stayed hidden much longer had we not accidentally detected it. This diff adds a liveness metric for the `ConfigUpdater` which will keep publishing every 5 mins as long as the `MononokeConfigs` object is live.

Reviewed By: YousefSalama

Differential Revision: D44293235

fbshipit-source-id: 6f54831c8b1f2154a23c021a7d2d8f01615a7d70
2023-03-22 07:03:04 -07:00
Mark Juggurnauth-Thomas
696884ceb6 gotham_ext: add stream stats gathering
Summary:
A gotham request consists of two parts.  The first part is a future, in which the handler resolves the request and produces the response headers.  The second part is the body which may optionally be a stream.  We added collection of future stats for the first part, but the majority of work may actually be done when computing the stream for the body.

In this diff we add stats collection for that body stream, if it is used.  Since this is separate from the future stats we already collected, we prefix the scuba columns with "stream_" to make it clear this is the stream.

Reviewed By: liubov-dmitrieva

Differential Revision: D44260233

fbshipit-source-id: 9820d3f30fb147740a95d8afc2fc1bf1fcc16aab
2023-03-22 04:40:35 -07:00
Jeremy Fitzhardinge
0dc6076e71 third-party/rust: update tempfile to 3.4
Summary:
Removes need for patch.

It had already been updated to 3.4 but this just formalizes it.

Reviewed By: jasonwhite

Differential Revision: D44274378

fbshipit-source-id: d17ecbbee06c7df30f689eb859fb31fdf07d8d44
2023-03-21 15:25:59 -07:00
Liubov Dmitrieva
6d9ab31217 bump request_id len
Summary:
bump request_id len

Currently there are conflicts even within the same date https://fburl.com/scuba/mononoke_test_perf/ti2v0ka8
This is confusing. Let's bump.

Differential Revision: D44255577

fbshipit-source-id: 12d4f0ff8a7589da2057d1557fb651583551e329
2023-03-21 09:46:09 -07:00
Mark Juggurnauth-Thomas
cc8c4a2f2d throttledblob: fix Display name
Summary: The `ThrottledBlob` impl of `Display` erroneously calls itself `ReadOnlyBlobstore`.  Fix it.

Reviewed By: mitrandir77

Differential Revision: D44222306

fbshipit-source-id: 2f4e3ef27322a7842f7fcb5ac6436fb91bc1230f
2023-03-20 12:41:57 -07:00
Yan Soares Couto
3e41a10a42 hg_sync: Use unredacted blobstore
Summary:
We need to copy redacted commits as well, to maintain consistency, otherwise we can't progress the sync.

This is stopping the www import to fbsource.

Reviewed By: RajivTS

Differential Revision: D44217272

fbshipit-source-id: c6c03df1ebc6310688a134b1bfdcb3e19fc3daa7
2023-03-20 09:29:30 -07:00
Youssef Ibrahim
56833294b0 don't drop MononokeApp in wait_until_terminated before termination signal to avoid dropping ConfigHandle
Summary:
When MononokeApp is dropped, the ConfigHandle inside of it gets dropped, and the config updater thread stops receiving updates causing config hot reloading to stop working. This was happening in scs, the land service, and the derived data service (not sure if this is also happening in Mononoke server).
This diff adds an explicit drop in the server closure in wait_until_terminated to make sure MononokeApp is not dropped before receiving a termination signal.

Reviewed By: Croohand

Differential Revision: D44206206

fbshipit-source-id: 7322f516c0dcbf4668cba811bdb582f0e5e2f11c
2023-03-20 06:54:27 -07:00
Liubov Dmitrieva
1d5e907ae0 remove dead code
Summary:
remove dead code

left over from earlier clean up

Reviewed By: YousefSalama

Differential Revision: D44131387

fbshipit-source-id: 20601b5e32777d8b2952120e95a24930ef4d2159
2023-03-20 02:54:29 -07:00
Andres Suarez
18aabd8811 graphql-parser: use upstream rev
Summary:
vmagro deleted his forked and now broke Reindeer importing. Please be
more careful.

https://github.com/graphql-rust/graphql-parser/pull/66 has been merged
but not released.

Reviewed By: dtolnay

Differential Revision: D44198593

fbshipit-source-id: 287f0f3f6860cdf16deb7be80448c2962a9f10a6
2023-03-18 14:44:48 -07:00
Rajiv Sharma
7959a58c3a Backing out ContentMetadataV2 stuff
Summary: Backing out ContentMetadataV2 stuff since the backfilling for that data has not yet been done and live traffic would see quite laggy performance if we did it directly in Prod Mononoke. So backing out for now until backfilling is fully complete.

Reviewed By: YousefSalama

Differential Revision: D44136799

fbshipit-source-id: ca403f89b8215f2dfd5582dda7499f1618944f2a
2023-03-17 06:24:03 -07:00
Rajiv Sharma
fbb376053a Generate missing Blake3 alias on x-repo file copy
Summary: Due to backfilling `ContentMetadataV2` in phases, there are some cases where the metadata exists but the `Blake3` alias doesn't. When copying the alias, if the alias is not present, let's regenerate it.

Reviewed By: markbt

Differential Revision: D44132513

fbshipit-source-id: 4185ece38db350b0069dff485a40166bb0cb1c4d
2023-03-17 03:06:23 -07:00
Thomas Orozco
9fd1e0b4d2 third-party/rust: update perf-event
Summary: To get `exclude_user()`

Reviewed By: dtolnay

Differential Revision: D44131122

fbshipit-source-id: f23b67394db0e20cb4e2071a188ae3c5c7b8fe15
2023-03-17 00:53:36 -07:00
Rajiv Sharma
35bd5a1fc9 Remove unused import
Summary: As in title

Reviewed By: YousefSalama

Differential Revision: D44132682

fbshipit-source-id: bb805c3545df700cfb67e3f32cf5957a4a620eac
2023-03-16 07:52:44 -07:00
Mark Juggurnauth-Thomas
0f1585f8cf mononoke_api: bound buffering of create changeset futures
Summary:
Create changeset uses `FuturesUnordered` and `FuturesOrdered`.  These are unbounded, so with very large changesets, we may try to do too much work at once.  Switch to `buffered` and `try_for_each_concurrent` so that we can add bounds.

As always, the numbers are somewhat arbitrary: 10 commits at a time, and up to 1000 files at a time.

Reviewed By: mitrandir77

Differential Revision: D44056862

fbshipit-source-id: 6284c207e3768ec0b16371dcd24db53afc0d98d6
2023-03-15 13:50:02 -07:00
Mark Juggurnauth-Thomas
98f52eeaf9 mononoke_api: switch to changesets_creation::save_changesets
Summary: Remove another dependency on the blobrepo crate by migrating to the underlying feature code.

Reviewed By: yancouto

Differential Revision: D44054973

fbshipit-source-id: 612de351beb2d7bffcd98cff629eb787c0184890
2023-03-15 13:50:02 -07:00
Mark Juggurnauth-Thomas
c300bfb676 scs_server: implement repo_create_stack
Summary: Implement the `repo_create_stack` method by calling `RepoContext::create_changeset_stack`.

Reviewed By: mitrandir77

Differential Revision: D44032674

fbshipit-source-id: c3bd9f320579a7c73c1dd47af2290a630aaa789d
2023-03-15 13:50:02 -07:00
Mark Juggurnauth-Thomas
930bacf080 scs_server: extract conversion of create commit parameters
Summary: Extract the code that converts create commit parameters to the internal types.  These methods will be used for creating stacks as well as for creating single commits.

Reviewed By: yancouto

Differential Revision: D44032677

fbshipit-source-id: 25aaeeb129d4523d51bfc27d375180f09c282555
2023-03-15 13:50:02 -07:00
Mark Juggurnauth-Thomas
074ef428e6 mononoke_api: allow creation of stacks of commits
Summary:
Add `create_changeset_stack` to `RepoContext` to allow creation of a stack of commits in one operation.

In addition to previous checks, we must build a stack of the accumulated changes for each of the earlier commits in the stack so that we can check that the stack is internally consistent.  For example, a file can only be deleted once in the stack, or it can be created and then deleted in the same stack.

Reviewed By: mitrandir77

Differential Revision: D44032676

fbshipit-source-id: f08a7df39c52c9de9d6efc728321112ac5ee60f8
2023-03-15 13:50:02 -07:00
Mateusz Kwapich
284370e1cb log max_poll_time
Summary:
Let's see if we have long poll problem anywhere which could *greatly*
contribute to any latency spikes.

Reviewed By: markbt

Differential Revision: D44059679

fbshipit-source-id: c8cb37d65e084de1500bee14773ca8229fb07a0c
2023-03-15 12:30:25 -07:00
Mateusz Kwapich
ee15619eca log futures stats
Summary:
So far we didn't log poll_count and poll_time for edenAPI requests which limits
our introspection into their problems.

This adds logging to both ways of defining handlers: old and new one - this is a bit unfortunate but I don't think I can dig into finishing the migration now.

Reviewed By: liubov-dmitrieva

Differential Revision: D44059681

fbshipit-source-id: c9cdba1fe8e9657bcffa19fd149bb20a1951bfde
2023-03-15 12:30:25 -07:00
Mateusz Kwapich
c0682f390a test scuba logging
Summary:
I want to improve EdenAPI scuba logigng but we had no proper test for logging
since D34346264 changed this test not test anything!

Reviewed By: liubov-dmitrieva

Differential Revision: D44059680

fbshipit-source-id: 44754d433fbc62d66f726cf88757bca496b0dd0d
2023-03-15 12:30:25 -07:00
Thomas Orozco
d599fb15a7 third-party/rust: vendor a fork of perf-event
Summary:
For https://github.com/jimblandy/perf-event/pull/29 which sets CLOEXEC by
default.

Reviewed By: edward-shen

Differential Revision:
D43983384

Privacy Context Container: L1123788

fbshipit-source-id: 478c0e11bd815e916094b48ce7763b4dfc3e5f79
2023-03-15 10:34:47 -07:00
Mark Juggurnauth-Thomas
c2d538b33e mononoke_api: extend create commit checks to support stacked changes
Summary:
The create commit method performs a number of checks to ensure that the requested commit is valid.  This is in addition to the bonsai changeset checks that ensure that a bonsai changeset is internally consistent.

Extend these methods so that they can operate when changes are stacked.  The checks use a path tree of stacked changes to validate that file operations earlier in the stack are consistent with file operations of each commit.

Reviewed By: mitrandir77

Differential Revision: D44032675

fbshipit-source-id: e245dd997d57dee1aebe76605c80bff9e3586be9
2023-03-15 09:33:51 -07:00
Mark Juggurnauth-Thomas
529ccbbc14 mononoke_api: reorganize create changeset method
Summary: Reorganize the create changeset method so all non-async work is done up-front.

Reviewed By: yancouto

Differential Revision: D44032678

fbshipit-source-id: 73cb051a354b47df69a334fe6fb60fb2f1a65e7d
2023-03-15 09:33:51 -07:00
Mark Juggurnauth-Thomas
22da0b9166 mononoke_api: gather parameters for create_changeset
Summary: We will want to pass vectors of these around for creating stacks, so collect them together in a struct.

Reviewed By: yancouto

Differential Revision: D44032680

fbshipit-source-id: f507dea3c9344b90619152c534e53b425e79d2a1
2023-03-15 09:33:51 -07:00
Mark Juggurnauth-Thomas
bebac6d00d scs_server: implement repo_upload_file_content
Summary: Implement the `repo_upload_file_content` method, which stores file content ahead of a call to `repo_create_commit` or `repo_create_stack`.

Reviewed By: yancouto

Differential Revision: D44032679

fbshipit-source-id: 5d25202e84da831e27cd5f107027446029e1c8dc
2023-03-15 09:33:51 -07:00
Mark Juggurnauth-Thomas
e5210494ba scs: add methods for uploading file content and creating stacks
Summary:
Add new source control thrift methods for:

* Uploading file contents ahead of creating new commits.  This will allow thrift clients to upload in parallel and before attempting to create commits.

* Creating a stack of commits in one go.  Currently this is a sequential operation as the commit hash of the first commit is needed to make it the parent of the second commit.  The new method allows the stack to be created in a single operation.

Reviewed By: yancouto

Differential Revision: D44032681

fbshipit-source-id: b8f8cf4cfbce1d13cb4e5e5e0d3e6975ee338273
2023-03-15 09:33:51 -07:00
Liubov Dmitrieva
680d5f1c14 increase insert rate
Summary:
increase insert rate on 20%

As discuss this is a simple change that may or may not help but also safe, so
we proceed.

Reviewed By: mitrandir77

Differential Revision: D44089651

fbshipit-source-id: 96b46c1415d49a762fa929ddba3da3dae741961d
2023-03-15 08:51:52 -07:00
Pierre Chevalier
d080efb3ed Fix flaky tests
Summary:
These two tests:
```
eden/mononoke/tests/integration/facebook:remote-gitimport - test-remote-gitimport-merge-partially-imported.t (run-tests)
eden/mononoke/tests/integration/facebook:remote-gitimport - test-remote-gitimport.t (run-tests)
```
are marked as flaky.

Running locally, I could see occasionally:
* timeouts to connect to scs
* timeouts to receive answers from scs
from `scsc` and `remote_gitimport`

Increase the connection timeout to 5s and the receive timeout to 30s for all of these.

Reviewed By: markbt

Differential Revision: D44066722

fbshipit-source-id: 37e24c653bb097b5f6be1b892e18bb249fc9553e
2023-03-15 03:44:25 -07:00
Clara Rull
16df09f37b Remove memcache_blobstore_no_lease
Summary: The implementation of `new_memcache_blobstore` and `new_memcache_blobstore_no_lease` is exactly the same, I'm removing `new_memcache_blobstore_no_lease` to simplify the code as leases in Memcache aren't used anymore

Reviewed By: genevievehelsel

Differential Revision: D44029035

fbshipit-source-id: 602ea8a92056f885e70b861f940d505b49d12a2b
2023-03-14 13:58:36 -07:00
Liubov Dmitrieva
4de59bec30 bump len of the unique id
Summary:
bump len of the unique id

len 5 gives 1048576 ids that not enough since usage of Eden Api is growing

Reviewed By: clara-9

Differential Revision: D44024880

fbshipit-source-id: 92b525e5f408791fc066974d38f4c7186a985f15
2023-03-14 05:07:22 -07:00
Liubov Dmitrieva
ec66989858 log the request in human readable format
Summary:
log the request in human readable format

if the request is rather small, log its content in human readable format for
debugging purposes

Reviewed By: clara-9

Differential Revision: D44027385

fbshipit-source-id: 9194462be4415aedb26be90b858bbae2803f8dfa
2023-03-14 03:50:31 -07:00
Liubov Dmitrieva
5ad0a68c90 add logging of request_id, so that we could match with perf trace
Summary:
add logging of request_id, so that we could match with perf trace
table

this is very nice for debugging, because we can find a slow request in the perf
table and then find it in the replay table as well to learn the request's content if
logged (we don't log uploads requests but most fetch type of requests are
logged) and try to repro the issue using hg debugedenapi command.

Reviewed By: clara-9

Differential Revision: D44024786

fbshipit-source-id: 0884f7479a5bfc068106f14536edc4ea2ab80ee3
2023-03-14 03:50:31 -07:00
Haitao Mei
c992872120 fix the flakiness of test-multiplexed-wal.t
Summary:
This diff fixes the flakiness of `test-multiplexed-wal.t`. The root cause is the eventual consistency model we used for writing data into blobstore (3 places).

We now manually flush everything, to eliminate the flakiness.

Reviewed By: yancouto

Differential Revision: D44027781

fbshipit-source-id: ee4fed562908fc7a200e41883540c9c4ef52af22
2023-03-13 16:20:50 -07:00
Haitao Mei
f0366b438a tets: fix test-edenapi-mutation.t
Summary:
We found 2 failure tests listed here, for commitgraph and commitgraph_v2 respectively:
https://www.internalfb.com/intern/testinfra/testconsole/testrun/6755399583562643/

This diff is going to fix the itegration tests to include the new debug messages introduced by D42453084

Differential Revision: D44024623

fbshipit-source-id: ffe9c9e71018f5bb3a4de6096e33f1b8c710d358
2023-03-13 16:20:50 -07:00
Pierre Chevalier
33e53cc463 Work around clippy crash in multiplexedblob_wal
Summary:
Before this change,
```
arc rust-clippy //eden/mononoke/blobstore:multiplexedblob_wal-unittest
```
failed ungraciously with:
```
File changed: fbcode//eden/mononoke/blobstore/multiplexedblob_wal/src/multiplex.rs
File changed: fbcode//eden/fs/store/git/GitBackingStore.cpp
Action failed: fbcode//eden/mononoke/blobstore:multiplexedblob_wal-unittest (rustc bin-pic-shared-metadata/multiplexedblob_wal_unittest-metadata bin,pic,metadata [clippy])
Remote command returned non-zero exit code 101
Reproduce locally: `frecli cas download-action e2c5c9e58703ce3c526ab116fd1cce8c0302c307:94`
stdout:
stderr:
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/tools/clippy/clippy_lints/src/ptr.rs:234:49

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.67

query stack during panic:

#0 [analysis] running analysis passes on this crate

end of query stack

Buck UI: https://www.internalfb.com/buck2/8802c9ab-ae8f-4b18-83a4-2b4992bc8f5b
RE: reSessionID-26b8008f-93cc-402a-bdde-fff3596ed795  Up: 1.0 KiB  Down: 0 B
Jobs completed: 5. Time elapsed: 50.7s. Cache hits: 0%. Commands: 1 (cached: 0, remote: 1, local: 0)
BXL SUCCEEDED
```

I found out the issue was happening in the `cloned` macro with the `key` by progressively isolating the code that was causing issues.

This code is equivalent, but happens not to hit this clippy bug.

Reviewed By: yancouto

Differential Revision: D44027145

fbshipit-source-id: 678e8d870754162665aa7d50c5839e116b5af186
2023-03-13 13:51:04 -07:00
Mark Juggurnauth-Thomas
e3eae493ea tests: only enable local cache for fbcode builds
Reviewed By: yancouto

Differential Revision: D44020476

fbshipit-source-id: 6325dc6a9a23b2882a0a6b607743ba767943c837
2023-03-13 10:40:05 -07:00
Pierre Chevalier
1f2ed299a9 Add endpoint to create a tag annotation
Summary:
Until now, we could use `BookmarkCategory` to create bookmarks referring to branches, tags or notes; but we didn't have a mechanism to create a tag annotation, which makes the difference between a lightweight tag and an annotated tag (notes should also always be annotated).

With this change, we have all the mechanics to create, delete or move any bookmark that can be imported from git.

Differential Revision: D43775948

fbshipit-source-id: 5241f94f190fcfa8c64747fd862cf70a3ed8909d
2023-03-10 12:14:25 -08:00
Yan Soares Couto
49b4c42949 Fix clippy warnings (2/2)
Summary:
This fixes the remaining clippy errors.

The only thing l haven't fixed is that clippy crashes when trying to parse `eden/mononoke/blobstore:multiplexedblob_wal`. This doesn't generate warnings and the command still succeeds, but it's annoying. I haven't been able to track down why, so I'm leaving it be.

Reviewed By: YousefSalama

Differential Revision: D43980977

fbshipit-source-id: 28ddcce5894903d6e0f980cd04b586dc1afc00c6
2023-03-10 09:41:25 -08:00
Yan Soares Couto
72eb05a1bd Fix clippy lints (1/N)
Summary: This fixes a lot of clippy lints. In particular, I didn't yet fix the mutable_key ones because we might want to disable that rule instead.

Differential Revision: D43979960

fbshipit-source-id: b5d0da42480f9a30bba38d31dca60a2fb810a0b3
2023-03-10 09:41:25 -08:00
Yan Soares Couto
3595428d86 mononoke_hg_sync_job: Remove old futures
Summary:
Removes dependency to futures_old. It still needs some compats because it still uses old futures from other libraries.

This makes us clone a lot less stuff and makes the code clearer.

Differential Revision: D43979027

fbshipit-source-id: d2e065df7626aa9e3cf4b3606caf999a21c56c20
2023-03-10 09:41:25 -08:00
Pierre Chevalier
738551d927 Make move_bookmark category-aware
Summary: While moving tags is not a common operation, it can happen so we should support it.

Differential Revision: D43909899

fbshipit-source-id: 19e9c4bb65aa496c91736bd2aff36ef8c7318e98
2023-03-10 07:51:29 -08:00
Pierre Chevalier
432faefab3 Make delete_bookmark category-aware
Summary: Prior to this change, we could only delete bookmarks of category branch, which is the default value.

Differential Revision: D43909898

fbshipit-source-id: 4f7b2f9df3167397d3a69542382961858444d8f4
2023-03-10 07:51:29 -08:00
Pierre Chevalier
92029093f2 Make resolve_bookmark category-aware
Summary:
This allows us to refer explicitely to a specific bookmark whether it's a tag, a note or a branch.

Prior to this change, we could only refer to bookmarks of type `Branch` (which is the default value and the case for any bookmark that was not imported from a git repository).

Differential Revision: D43909897

fbshipit-source-id: f767a3bcf236652aae48b63a4724355187282a46
2023-03-10 07:51:29 -08:00
Pierre Chevalier
10b7b85628 Make create_bookmark category-aware
Summary:
This allows user of this API to create bookmarks that can represent git tags or git notes in addition to the default bookmarks that map to git branches.

Note that annotated tags are not covered in this diff. What differentiates a lightweight tag from an annotated tag is the changeset it points at. Creating the changeset is independent from creating the bookmark.

Differential Revision: D43775947

fbshipit-source-id: 6865c091a29917528fccfdca6db1af26a6f1fcb4
2023-03-10 07:51:29 -08:00
Pierre Chevalier
5229b13ec8 Add category column
Summary:
This was intentionally omitted when the `BookmarkCategory` was introduced in D43444397.

The reasoning behind that omission was that this is used during `move_bookmark` and tags are not expected to move.

While tag moves are more rare than branch moves, they can still happen:
git provides a mechanism for moving them (`git tag -f`) and it can also occur indirectly if a tag is removed and re-added somewhere else in git, followed by a push, where live git sync will need to move the bookmark.

Don't special-case the category in the bookmark_update_log: tags and notes should behave like any other bookmarks.

Note: D43908929 is the configerator counterpart to this change and should land and rollout first.

Differential Revision: D43908709

fbshipit-source-id: 4423dc6dc9a5e7f2ffe9d4e8f62741f7ee38a831
2023-03-10 07:51:29 -08:00