Commit Graph

3313 Commits

Author SHA1 Message Date
Stanislau Hlebik
5afc48a292 mononoke: move bookmark in change_target_config conditionally
Summary:
Do a similar change to change_target_config as we've done for add_sync_target
in D29848378. Move bookmark only if it points to an expected commit. That would
prevent make it safer to deal with cases where the same change_target_config
was executing twice.

Reviewed By: mojsarn

Differential Revision: D29874803

fbshipit-source-id: d21a3029ee58e2a8acc41e37284d0dd03d2803a3
2021-07-24 03:55:08 -07:00
Stanislau Hlebik
4f632c4e8b mononoke: create bookmark in add_sync_target
Summary:
This is the first diff that tries to make megarepo asynchronous methods
idempotent - replaying the same reqeust twice shouldn't cause corruption on the
server. At the moment this is not the case - if we have a runaway
add_sync_target call, then in the end it moves a bookmark to a random place,
even if there was another same successful add_sync_target call and a few others on
top.

add_sync_target should create a new bookmark, and if a bookmark already exists
it's better to not move it to a random place.

This diff does it, however it creates another problem - if a request was successful on mononoke side, but we failed to deliver the successful result to the client (e.g. network issues), then retrying this request would fail because bookmark already exists. This problem will be addressed in the next diff.

Reviewed By: mojsarn

Differential Revision: D29848378

fbshipit-source-id: 8a58e35c26b989a7cbd4d4ac4cbae1691f6e9246
2021-07-24 03:55:08 -07:00
Michael Voznesensky
7ed41f2b36 Bump configerator, add support for config driven no parent commits
Summary: As discussed, extends Mononoke service to support commits w/o parents for the AI Infra usecase.

Reviewed By: markbt

Differential Revision: D29810303

fbshipit-source-id: f07fd7f1521ffe1cea85f1f54e71fe37fc39bb62
2021-07-23 13:40:18 -07:00
Stanislau Hlebik
d1e86ab457 mononoke: add more logging to add sync target call
Summary: It's nice to be able to keep track of what's going on

Reviewed By: mwdevine

Differential Revision: D29790543

fbshipit-source-id: b855d72efe8826a99b3a6a562722e299e9cbfece
2021-07-22 14:52:03 -07:00
Yan Soares Couto
3f8de3336a Add bubble id to upload files call
Summary:
Added an optional argument to `/upload/file`, that allows specifying a bubble id, which will be used to upload the file into the ephemeral blobstore instead of the main one.

This is necessary in order to create a snapshot, as all files must be in the ephemeral blobstore.

Reviewed By: liubov-dmitrieva

Differential Revision: D29734333

fbshipit-source-id: c1dcf8d5a78819925f8defbfbd7d06b0f6a9e973
2021-07-22 13:47:12 -07:00
Yan Soares Couto
681a5305e3 Use NonZeroU64 as BubbleId
Summary: Insert id's are always positive, so let's use `NonZeroU64` instead of `u64`. This is more restricted, which is good, but also has the added benefit that `Option<NonZeroU64>` doesn't use any additional space, because of compiler optimizations.

Reviewed By: StanislavGlebik

Differential Revision: D29733877

fbshipit-source-id: 8a0e1a1bd84bcedbba51840f1da8f8cac79bca42
2021-07-22 13:47:12 -07:00
Yan Soares Couto
16fbc46f2c Add ephemeral handle
Summary: Ephemeral handle is a blobstore that's built from a bubble and a "main blobstore", which first attempts to read from the ephemeral blobstore, but falls back to the main one. Will be used to read/write stuff in snapshots.

Reviewed By: liubov-dmitrieva

Differential Revision: D29733408

fbshipit-source-id: f15ae9d3009632cd71fafa88eac09986e0b958e7
2021-07-22 13:47:12 -07:00
Liubov Dmitrieva
bf41088ef2 Move EdenApi Uploads code from commit cloud extension to core
Summary:
Move EdenApi Uploads code from commit cloud extension to core

So this can be later used for pushes as well. The code is not commit cloud specific.

The function takes revs and returns uploaded, failed lists that are also revs.

Reviewed By: yancouto

Differential Revision: D29846299

fbshipit-source-id: e3a7fbc56f0b651c738dc06da7fdb7cde4feedf7
2021-07-22 11:52:57 -07:00
Mark Juggurnauth-Thomas
3dca04d257 tests: update test-backfill-derived-data.t
Summary: This test is overly reliant on exact logging output, and the output has changed.  Update the test for the new output, and make it a bit more lenient in the process.

Reviewed By: StanislavGlebik

Differential Revision: D29787827

fbshipit-source-id: 3e8aa77d2edcf3d0ca95c0d17d0b4e3845b78ae3
2021-07-22 09:34:14 -07:00
CodemodService Bot
0a402ce760 Daily common/rust/cargo_from_buck/bin/autocargo
Reviewed By: krallin

Differential Revision: D29841733

fbshipit-source-id: c9da8e0324f402f3b9726f2733b51de56abde8f6
2021-07-22 09:22:41 -07:00
Liubov Dmitrieva
33ab763498 Improve integration tests coverage for hg cloud upload and hg cloud sync
Summary:
Improve integration tests coverage for `hg cloud upload` and `hg cloud sync` with enabled upload.

This includes end2end tests for uploading mutation information, pulling commits from another repo,
generally how uploads behaves after a rebase, after file moves, after editing a commit message, how copy_from data has been preserved.

Reviewed By: markbt

Differential Revision: D29816436

fbshipit-source-id: 2aa421c8479683721984e13d537c34df8b1ca2d1
2021-07-22 08:31:19 -07:00
Liubov Dmitrieva
34fb6f721e update test certificates for another 10 years rather than the default 1 year
Summary: update test certificates for another 10 years rather than the default 1 year

Reviewed By: markbt

Differential Revision: D29846930

fbshipit-source-id: 98bc139c21e4d9e4cb5bab46485d849345bcc43d
2021-07-22 08:18:48 -07:00
Mark Juggurnauth-Thomas
1f81d30c93 source_control_service: add tree_exists and commit_path_exists
Summary:
Add methods to easily determine whether a tree exists, or whether anything
(either a file or a tree) exists at a particular path.

Reviewed By: StanislavGlebik

Differential Revision: D29815982

fbshipit-source-id: f3fb1919545bdcb46ed663a0a514338dc137abee
2021-07-22 00:09:27 -07:00
Stanislau Hlebik
46827b3756 mononoke: remove unused method
Summary:
This is not used. Even though this method has the "right intention" (i.e. we
need to start marking long running requests as new), I'm not sure we can use it
as is. So let's just delete it for now.

Reviewed By: farnz

Differential Revision: D29817068

fbshipit-source-id: 84d392fea01dfb5fb7bc56f0072baf2cf70b39f4
2021-07-21 12:02:59 -07:00
Jan Mazur
4d602331a2 print underlying errors in debug mode
Summary: Currently we only print what's in the `error` annotation.

Reviewed By: krallin

Differential Revision: D29794843

fbshipit-source-id: a2c411208d7be8fd856dd9b3f82fd96a4ed37aee
2021-07-21 07:19:32 -07:00
Liubov Dmitrieva
9c75e9b2b0 bugfix: fix uninitalized state variable
Summary:
bugfix: fix uninitalized state variable and add a test

in rare cases it is used further down the code

Reviewed By: StanislavGlebik

Differential Revision: D29815203

fbshipit-source-id: e117df5575f025787d94f0a8ed4a171408e361d0
2021-07-21 05:38:51 -07:00
Stanislau Hlebik
eb0aebc24c mononoke: make sure we don't reload redaction config unnecessarily
Summary:
We seem to be reloading it every minute, even though we are supposed to reload
only when it's changed. That's probably not a huge deal, but we just get a
spammy stderr message. Let's remove it.

Reviewed By: yancouto

Differential Revision: D29789760

fbshipit-source-id: 65a39cca67636ae71befb963c78b6473b5b9f3fc
2021-07-21 01:32:43 -07:00
Stanislau Hlebik
5c7d31b3ae mononoke: fix integration tests
Summary:
mysql tests were failing because of invalid config with

```
+  E0719 14:48:27.582197 1846476 [main] eden/mononoke/cmdlib/src/helpers.rs:318] Execution error: unknown keys in config parsing: `{"blobstore.ephemeral_blobstore.?.metadata.?.filenodes", "blobstore.ephemeral_blobstore.?.metadata.?.mutation", "blobstore.ephemeral_blobstore.?.metadata.?.primary"}`
```

See example - https://www.internalfb.com/intern/testinfra/diagnostics/6473924511735259.562949979040542.1626706163/

This diff fixes it

Reviewed By: akushner

Differential Revision: D29812804

fbshipit-source-id: c71f7f38103194137523ca947e4b23819da37c35
2021-07-21 01:32:43 -07:00
Liubov Dmitrieva
26e149e737 rename cbor_stream => cbor_stream_filtered
Summary:
Rename to avoid confusion. The function filters errors from the underlying stream.

The first error and number of errors are logged to scuba but the errors are not passed to the client.

Reviewed By: kulshrax

Differential Revision: D29734930

fbshipit-source-id: 503adaa9e618d931a354011ef83c3ab22eb3b9bf
2021-07-20 03:50:09 -07:00
Yan Soares Couto
a47540a494 Add /ephemeral/prepare endpoint
Summary:
Using all the preparations added in the stack, this diff adds the `/:repo/ephemeral/prepare` endpoint to eden api.

It simply creates an ephemeral bubble and returns its id via the call.

Reviewed By: markbt

Differential Revision: D29698714

fbshipit-source-id: 5bc289cad97657db850b151849784e50a17a9da6
2021-07-19 09:53:04 -07:00
Yan Soares Couto
58448b16d5 Add ephemeral blobstore to inner repo
Summary: This allows ephemeral blobstore to be used in places that have a Repo context, like in the eden api, which will be used on the next diff to implement a new endpoint on eden api to create a bubble.

Reviewed By: markbt

Differential Revision: D29697657

fbshipit-source-id: b7e83c5c7c5e77243f0dba29c024d9f66ca4b2f9
2021-07-19 09:53:04 -07:00
Yan Soares Couto
e20022a088 Build ephemeral blobstore on repo factory
Summary:
Config for ephemeral blobstore and some code for creating ephemeral blobstores was already added, this diff ties them both together by making the ephemeral blobstore be build using the default config on RepoFactory, so it can be used as a Repo attribute easily in other places.

I was able to do this easily because I stopped using `BackingBlostore` and started simply using `dyn Blobstore` in the ephemeral blobstore. Using BackingBlobstore would require some significant changes, because:
1. Building of blobstores is not ergonomic, it is quite hard and requires a bunch of manual code to be able to build some subtrait of Blobstore.
2. A lot of the blobstores "wrappers" do not implement things like BlobstoreKeySource, which would need to be implemented individually (example: D29678881 (817948ca75) would be just the start).

Reviewed By: markbt

Differential Revision: D29677545

fbshipit-source-id: 0f5cffe6bdfece1aaa74339ef40376d1ff27e6c2
2021-07-19 09:53:04 -07:00
Yan Soares Couto
eccda5507b Use Reloader on segmented changelog periodic reloader
Summary:
Use the class added on previous diff on segmented changelog periodic reloader as well.

To do this, I needed to add some changes to reloader:
- Add auto implementation of `Loader` trait for functions
- Add a tokio notify, as that was used on tests in segmented changelog

Reviewed By: markbt

Differential Revision: D29524220

fbshipit-source-id: 957f21db91f410fcdabb0d1c16d5c4f615892ab6
2021-07-19 05:17:50 -07:00
Yan Soares Couto
817948ca75 Implement BlobstoreKeySource for Prefixer and Counting blobstores
Summary: If we ever want to start using things like BlobstoreKeySource more extensively, we'll need to implement it for a lot of blobstores. This starts that, though it's not used for now.

Reviewed By: ahornby

Differential Revision: D29678881

fbshipit-source-id: 918a169b8b934c6f5e1eefaba7d11dc220eb7c59
2021-07-19 05:04:34 -07:00
Aida Getoeva
0619e705ef mononoke/multiplex: put sync-queue lookup for get under the tunable
Summary: This is needed to disable sync-queue lookups and second blobstores lookups later on.

Reviewed By: StanislavGlebik

Differential Revision: D29663435

fbshipit-source-id: abb5109de6063158a7ff0a116a5c1d336bfdb43f
2021-07-17 17:00:16 -07:00
Aida Getoeva
008c99e5fa mononoke/multiplex: remove fail_if_unsure where possible
Summary: This just helps to understand where we definitely have to fail in case of "ProbablyNotPresent" and work on those in the future.

Reviewed By: StanislavGlebik

Differential Revision: D29663436

fbshipit-source-id: c8428115f3c9637114e3964c948123d473207d53
2021-07-17 17:00:16 -07:00
Stanislau Hlebik
5ce118e1c2 mononoke: remove segmented changelog from BlobRepo
Summary:
Segmented changelog is initialized in every BlobRepo, and that's quite annoying
- there's a lot of spam goes to stderr in jobs like hg sync job which don't use
segmented changelog at all.

At the same time segmented changelog is only used in mononoke api, so we can
just initialize segmented changelog in InnerRepo, and remove from BlobRepo
completely.

Reviewed By: markbt

Differential Revision: D29735623

fbshipit-source-id: 9137c9266169b7ef16b1c6c0b80cae896214203b
2021-07-16 11:10:00 -07:00
Stanislau Hlebik
e5f8b1588e mononoke: read just written sync target config
Reviewed By: markbt

Differential Revision: D29728973

fbshipit-source-id: b1d9020222c9d4494b206dabeb7e92c9c45d35b7
2021-07-16 07:43:08 -07:00
Liubov Dmitrieva
99ff270a78 Clean Up: remove everything about the infinitepush write path
Summary:
Remove everything about the infinitepush write path.

Infinitepush path has been splitted into 2 for migration purpose. It is now time to clean up.

Reviewed By: StanislavGlebik

Differential Revision: D29711414

fbshipit-source-id: c61799fe124e2def4254cdd45e550c82c501e514
2021-07-15 07:37:55 -07:00
Harvey Hunt
b3a504d191 mononoke: lfs: Remove throttle limits
Summary:
Now that the new `rate_limiting` crate is being used by LFS server we
can remove the throttle limits code and config.

Differential Revision: D29396505

fbshipit-source-id: 19638bd93ad9dea2638e8501837c6c13e4dd48ff
2021-07-15 04:09:51 -07:00
Mark Juggurnauth-Thomas
0914112d96 update test debug strings
Summary:
Integration tests rely on specific debug output.  This changed for `String`
in Rust 1.53, so update accordingly.

Reviewed By: yancouto

Differential Revision: D29696713

fbshipit-source-id: 751d72660f1d8772d754ab404192281857b32b2f
2021-07-14 10:18:30 -07:00
Meyer Jacobs
f564998c4f edenapi: add new file aux data attribute
Summary: Adds a new file attribute, `FileAuxData` (based on Mononoke's `ContentMetadata`)

Reviewed By: DurhamG

Differential Revision: D29557288

fbshipit-source-id: 59251ebe8ddf2009d7bcf44a83eab68d49c817de
2021-07-13 15:17:30 -07:00
Meyer Jacobs
6c21aa14c9 edenapi: implement file content attribute
Summary:
Implement the `content` attribute.

Introduce a new `FileContent` type which stores the hg file blob and metadata, and modify `FileEntry` to allow constructing `FileEntry` with optional `FileContent` builder-style.

Reviewed By: DurhamG

Differential Revision: D29647203

fbshipit-source-id: b956c294d03dc81affc90d7274b2e430a3556e96
2021-07-13 15:17:30 -07:00
Meyer Jacobs
7c0b422b37 edenapi: introduce file attributes support
Summary:
Add support for optional file attributes to EdenApi, with `content` there as a placeholder.

Modifies the `FileRequest` type, adding a vec of `FileSpec`, which allows the client to specify desired attributes per-key. The existing `keys` field will be treated as a request for the content attribute and may be used in combination with the new per-key attributes.

Reviewed By: DurhamG

Differential Revision: D29634709

fbshipit-source-id: 6571837f87d1635e8529490e10dbe4ba054b7348
2021-07-13 15:17:30 -07:00
Durham Goode
1183f14f11 treemanifest: disable flatcompat by default
Summary:
This was a hack to allow the tests to produce the same hashes as
before. Let's disable this and fix the remaining test failures. A future diff
will remove the feature entirely.

Where possible I changed input hashes to desc() and output hashes to globs so
hopefully future hash changes are a little easier.

Differential Revision: D29567762

fbshipit-source-id: cf5150c112c56b08f583feba80e5a636cc07db0a
2021-07-13 15:04:57 -07:00
Liubov Dmitrieva
6b9587c207 remove deprecated commands
Summary: Clean Up. Remove deprecated commands.

Reviewed By: singhsrb

Differential Revision: D29677591

fbshipit-source-id: c4da701e9eedaa2f4dcd59b3e95c924aede74bf7
2021-07-13 13:48:06 -07:00
Durham Goode
5cb2db12f1 tests: remove accidental treemanifestserver.py
Summary:
This was accidentally committed in an earlier diff. It's unused, so
let's delete it.

Reviewed By: krallin

Differential Revision: D29668138

fbshipit-source-id: 105bf466665c447c37c73462e102d8771d0368ee
2021-07-13 13:32:16 -07:00
Liubov Dmitrieva
990a246aa8 Support exchange of mutation information during changesets uploads
Summary:
Support exchange of mutation information during changesets uploads

Add new api for mutation information.

Add implementation for this new api.

Add client side support.

Reviewed By: markbt

Differential Revision: D29661255

fbshipit-source-id: 1d8cfa356599c215460aee49dd0c78b11af987b8
2021-07-13 01:56:06 -07:00
Mark Juggurnauth-Thomas
ba8784f812 scs_server: support blame_v2
Summary:
Allow SCS server to use blame V2 to serve blame requests, if it is enabled.

This uses `CompatBlame` so that it can use either blame V1 or blame V2.

Reviewed By: liubov-dmitrieva

Differential Revision: D29645410

fbshipit-source-id: 8d02e295995439c3b64e0128bdb5e6f5f6153159
2021-07-12 02:45:23 -07:00
Mark Juggurnauth-Thomas
7567684c3a admin: support blame_v2 in the blame subcommands
Summary:
Allow access to blame V2 in `mononoke_admin` by using `fetch_blame_compat`.

This uses `CompatBlame` to provide blame support using either blame V1 or blame V2.

Reviewed By: liubov-dmitrieva

Differential Revision: D29492859

fbshipit-source-id: 38c73690d36b57be73cec98ae2a013f16b3e0f7a
2021-07-12 02:45:23 -07:00
Mark Juggurnauth-Thomas
af0dbd16fd blame_v2: implement fetch_blame_compat
Summary:
Implement `fetch_blame_compat`, which will fetch either blame V1 or blame V2,
depending on the repo config, and return a compatibility adapter that can be
used by code to use both kinds.

Reviewed By: StanislavGlebik

Differential Revision: D29492857

fbshipit-source-id: 88d68ef2988e316642a5ebd9aa38b541c02c5da4
2021-07-12 02:45:23 -07:00
Mark Juggurnauth-Thomas
a11563a2a6 blame_v2: implement derivation of blame_v2
Summary:
Add `blame_version` to `BlameDeriveOptions`, and if this is set to `V2`, derive
a V2 blame root for the changeset.

Blame V2 and its roots are in a separate blobstore key space, so this derivation
is entirely independent of blame V1.

The key prefix for blame V2 roots is `derived_root_blame_v2`, even though this
is slightly different to the prefix for blame V1.  This is so that it matches
other derived data roots (e.g. unode V2).  Similarly, `BlameRoot` becomes
`RootBlameV2` so that it matches the other root types.

Blame V2 uses a separate mapping for blame roots, which contain the root
unode manifest id as additional data.

Differential Revision: D29492858

fbshipit-source-id: de2799040129e1ab90cc6bd8f775a6d47c607db7
2021-07-12 02:45:23 -07:00
Mark Juggurnauth-Thomas
d3400bc439 blame: extract mapping and derivation for v1 from derived module
Summary:
Split the `derived` module into `derive_v1`, which handles derivation of blame
V1, and `mapping_v1`, which handles the derived data mapping.

This is in preparation for introducing derivation of blame V2.

Reviewed By: StanislavGlebik

Differential Revision: D29463127

fbshipit-source-id: ae3add600ca62141e7f25713367680b667507da3
2021-07-12 02:45:23 -07:00
Mark Juggurnauth-Thomas
bbd0dcfa5d blame: extract function for fetching content
Summary:
Extract `fetch_content_for_blame` to a separate module so we can re-use it in
blame V2.

The method previously returned nested `Result`s, which can be confusing as in
most contexts, the blame being rejected is not actually an error.  Switch to an
explicit enum to make it clearer what the inner result represents.

Reviewed By: yancouto

Differential Revision: D29462095

fbshipit-source-id: 52ffcb4173a3b36f4b6cdafe4f42a4cafd993f49
2021-07-12 02:45:23 -07:00
Liubov Dmitrieva
43187d53ad edenapi: Implement uploading changesets in hg cloud upload command
Summary:
Implement using of uploading changesets in `hg cloud upload` command.

This is the last part for `hg cloud upload` - uploading changesets via Edenapi
test
```

```
# machine #2
liubovd {emoji:1f352}  ~/fbsource
 [15] → hg pull -r 0b6075b4bda143d5212c1525323fb285d96a1afb
pulling from mononoke://mononoke.c2p.facebook.net/fbsource
connected to twshared27150.03.cln3.facebook.com session RaIPDgvF6l8rmXkA
abort: 0b6075b4bda143d5212c1525323fb285d96a1afb not found!
```

```
# machine #1
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [6] →  EDENSCM_LOG="edenapi::client=info" ./hg cloud upload
Jul 11 13:26:26.322  INFO edenapi::client: Requesting lookup for 1 item(s)
commitcloud: head '0b6075b4bda1' hasn't been uploaded yet
Jul 11 13:26:26.472  INFO edenapi::client: Requesting lookup for 6 item(s)
commitcloud: queue 1 commit for upload
Jul 11 13:26:26.648  INFO edenapi::client: Requesting lookup for 1 item(s)
commitcloud: queue 0 files for upload
Jul 11 13:26:26.698  INFO edenapi::client: Requesting lookup for 4 item(s)
commitcloud: queue 4 trees for upload
Jul 11 13:26:27.393  INFO edenapi::client: Requesting trees upload for 4 item(s)
commitcloud: uploaded 4 trees
commitcloud: uploading commit '0b6075b4bda143d5212c1525323fb285d96a1afb'...
Jul 11 13:26:28.426  INFO edenapi::client: Requesting changesets upload for 1 item(s)
commitcloud: uploaded 1 commit
```

```
# machine #2
liubovd {emoji:1f352}  ~/fbsource
 [16] → hg pull -r 0b6075b4bda143d5212c1525323fb285d96a1afb
pulling from mononoke://mononoke.c2p.facebook.net/fbsource
connected to twshared16001.08.cln2.facebook.com session QCpy1x9yrflRF6xF
searching for changes
adding commits
adding manifests
adding file changes
added 895 commits with 0 changes to 0 files
(running background incremental repack)
prefetching trees for 4 commits

liubovd {emoji:1f352}  ~/fbsource
 [17] → hg up 0b6075b4bda143d5212c1525323fb285d96a1afb
warning: watchman has recently started (pid 93231) - operation will be slower than usual
connected to twshared32054.08.cln2.facebook.com session Hw91G8kRYzt4c5BV
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

liubovd {emoji:1f352}  ~/fbsource
 [18] → hg diff -c .
connected to twshared0965.07.cln2.facebook.com session rrYSvRM6pnBYZ2Fn
 diff --git a/fbcode/eden/scm/test b/fbcode/eden/scm/test
new file mode 100644
 --- /dev/null
+++ b/fbcode/eden/scm/test
@@ -0,0 +1,1 @@
+test
```

Initial perf wins:

Having a large stack of 6 commits (total 24 files changed), tested *adding a single line to a file at the top commit*. We can see at least 2X win but it should be more because I have tested with a local instance of edenapi service that runs on my devserver.

```
╷
╷ @  5582fc8ee  6 minutes ago  liubovd
╷ │  test
╷ │
╷ o  d55f9bb65  86 minutes ago  liubovd  D29644738
╷ │  [hg] edenapi: Implement using of uploading changesets in `hg cloud upload` command
╷ │
╷ o  561149783  Friday at 15:10  liubovd  D29644797
╷ │  [hg] edenapi: Add request handler for uploading hg changesets
╷ │
╷ o  c3dda964a  Friday at 15:10  liubovd  D29644800
╷ │  [edenapi_service] Add new /:repo/upload/changesets endpoint
╷ │
╷ o  28ce2fa0c  Friday at 15:10  liubovd  D29644799
╷ │  [hg] edenapi/edenapi_service: Add new API for uploading Hg Changesets
╷ │
╷ o  13325b361  Yesterday at 15:23  liubovd  D29644798
╭─╯  [edenapi_service] Implement uploading of hg changesets
```

```
# adding new line to a file test in the test commit, and then run:
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [8] → time hg cloud upload
commitcloud: head '4e4f947d73e6' hasn't been uploaded yet
commitcloud: queue 1 commit for upload
commitcloud: queue 0 files for upload
commitcloud: queue 4 trees for upload
commitcloud: uploaded 4 trees
commitcloud: uploading commit '4e4f947d73e676b63df7c90c4e707d38e6d0a93b'...
commitcloud: uploaded 1 commit

real	0m3.778s
user	0m0.017s
sys	0m0.027s
```

```
# adding another new line to a file test in the test commit, and then run:
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [11] → time hg cloud backup
connected to twshared30574.02.cln2.facebook.com session uvOvhxtBfeM7pMgl
backing up stack rooted at 13325b3612d2
commitcloud: backed up 1 commit

real	0m7.507s
user	0m0.013s
sys	0m0.030s
```

Test force mode of the new command that reupload everything:
```
devvm1006.cln0 {emoji:1f440}   ~/fbsource/fbcode/eden/scm
 [13] → time hg cloud upload --force
commitcloud: head '5582fc8ee382' hasn't been uploaded yet
commitcloud: queue 6 commits for upload
commitcloud: queue 24 files for upload
commitcloud: uploaded 24 files
commitcloud: queue 61 trees for upload
commitcloud: uploaded 61 trees
commitcloud: uploading commit '13325b3612d20c176923d1aab8a28383cea2ba9a'...
commitcloud: uploading commit '28ce2fa0c6a02de57cdc732db742fd5c8f2611ad'...
commitcloud: uploading commit 'c3dda964a71b65f01fc4ccadc9429ee887ea982c'...
commitcloud: uploading commit '561149783e2fb5916378fe27757dcc2077049f8c'...
commitcloud: uploading commit 'd55f9bb65a0829b1731baa686cb8a6e0c5500cc2'...
commitcloud: uploading commit '5582fc8ee382c4c367a057db2a1781377bf55ba4'...
commitcloud: uploaded 6 commits

real	0m7.830s
user	0m0.011s
sys	0m0.032s
```

We can see the time is similar to the current `hg cloud backup` command.

Reviewed By: markbt

Differential Revision: D29644738

fbshipit-source-id: cbbfcb2e8018f83f323f447848b3b6045baf47c5
2021-07-12 02:13:31 -07:00
Liubov Dmitrieva
f8784a6020 Add new /:repo/upload/changesets endpoint
Summary: add new /:repo/upload/changesets endpoint

Reviewed By: markbt

Differential Revision: D29644800

fbshipit-source-id: 7d17c9c7a52e0e528a1d2cb7ea323a9abf13cf93
2021-07-12 02:13:31 -07:00
Liubov Dmitrieva
804fc98c3f Implement uploading of hg changesets
Summary:
implement uploading of hg changesets

For now, reuse the upload code path from unbundle but calling it with empty filenodes and manifests.

Those are used for parents validation but this is not needed for us because we load trees and filenodes and their parents to construct the bonsai cs.

We might want to rewrite it to a cleaner code later and separate from unbundle but for now reusing the fucntion is the easiest way because we know the implementation is correct and also has logging.

Reviewed By: markbt

Differential Revision: D29644798

fbshipit-source-id: 27217d3061ab8d9712417facdbfbbc7e3aebfc5b
2021-07-12 02:13:31 -07:00
Jun Wu
5af32aa8b9 make are_heads_assigned work with duplicated heads
Summary: There is a code path that `heads` contain duplicated items. Be compatible with it.

Reviewed By: andll

Differential Revision: D29645743

fbshipit-source-id: ff73bc51e877c2d02fcfff28cd1001e70478f212
2021-07-09 18:24:25 -07:00
Stanislau Hlebik
d74cc69de4 mononoke: avoid creating deletion commit on megarepo mainline
Summary:
In previous diff we started creating deletion commits on megarepo mainline.
This is not great since it breaks bisects, and this diff avoids that.

The way it does it is the following:
1) First do the same thing we did before - create deletion commit, and then
create a merge commit with p1 as deletion commit and p2 as an addition commit.
Let's call it "fake merge", since this commit won't be used for our mainline
2) Generate manifest for our "fake merge", and then use this manifest to
generate bonsai diff. But this time make p1 an old target commit (i.e. remove
deleted commit as if it never exited).
3) Use generated bonsai diff to create a commit.

So in short we split the procedure in two - first generate and validate the
resulting manifest (this is what we use "fake merge" commit for), and then
generate bonsai changeset using this manifest. It's unfortunate that in order
to generate resulting manifest we actually need to create commit and save it to
blobstore. If we had in-memory manifests we could have avoided that, but alas
we don't have them yet.

This way of creating bonsai changesets is a bit unconventional, but I think it has the benefit of relying on tools that we have confidence that they work (i.e. bonsai_diff), and we don't need to reimplement all the bonsai logic again

Reviewed By: mitrandir77

Differential Revision: D29633340

fbshipit-source-id: eebdb0e4db5abbab9346c575b662b7bb467497c4
2021-07-09 05:23:43 -07:00
Stanislau Hlebik
58ffbc5cec mononoke: redo the way we create merge bonsai changesets in change_target_config
Summary:
Initially I just wanted to address comments from D29515737 (fa8796ae19) about unnecessary
manifest retraversals, but there were a few more problems:
1) We didn't detect file conflicts in the final merge commit correctly. For
example, if additions_merge commit added a file "dir/1.txt", but there's
already file "dir" in target changeset that we won't detect this problem.
2) What's worse is that we might produce invalid bonsai merge changeset
ourselves. Say, if we delete "source_1/dir/file.txt", and then add file
"source_1/dir" in additions merge commit then resulting bonsai changeset should
have "source_1/dir" entry in the bonsai changeset.

This diff does the following:
1) Adds more tests to cover different corner cases - some of them were failing
before this diff.
2) Improves logic to verify file conflicts
3) Instead of trying to generate correct merge bonsai changeset it simplifies
the task and creates a separate deletion commit.

Note that creating a deletion commit on the mainline is something we want to
avoid to not break bisects. This will be addressed in the next diff.

Reviewed By: mitrandir77

Differential Revision: D29633341

fbshipit-source-id: 8f755d852212fbce8f9331049bf836c1d0a4ef42
2021-07-09 05:23:43 -07:00