Commit Graph

23 Commits

Author SHA1 Message Date
Pavel Aslanov
01ea2d3917 remove BlobRepo dependancy from hg blob fetch|upload functionality
Summary:
This is prerequisite step before moving hg blob `fetch|upload` functionality to mercurial crate.
- Use `Arc<dyn Blobstore>` instead of `RepoBlobstore`
- do not use `BlobRepo` in `UploadHg*` and `fetch_*` structures and functions

Reviewed By: ikostia

Differential Revision: D16963058

fbshipit-source-id: be36599cb430a342348cc077885b2f32eaa4ee47
2019-08-23 09:38:32 -07:00
Stanislau Hlebik
ce6ce44d50 mononoke: rename Manifest/Entry to HgManifest/HgEntry
Summary:
We now have two Manifest and two Entry traits and it makes it very confusing.
The old Manifest trait (and related EmptyManifest struct and Entry trait) are
mercurial-specific, while new Manifest trait is generic over all kinds of
manifests (unodes, mercurial etc).

In ideal state we should have only new Manifest trait, but it'd require quite a
big refactoring. In short term let's at least rename Manifest to HgManifest and
Entry to HgEntry to make distinction clearer.

Reviewed By: krallin

Differential Revision: D16886032

fbshipit-source-id: 80e3999fae3e89347448579caf7aafec56705500
2019-08-20 01:12:49 -07:00
Stanislau Hlebik
1270d709a8 mononoke: remove Logger from BlobRepo
Summary:
It's used only in a very few places, and most likely that's by accident. We
pass logger via CoreContext now

Reviewed By: krallin

Differential Revision: D16336953

fbshipit-source-id: 36ea4678b3c3df448591c606628b93ff834fae45
2019-07-17 08:31:56 -07:00
Pavel Aslanov
1a0aaa136a remove MemoryManifest implementation
Summary: `MemoryManifest` is not longer used anywhere

Reviewed By: farnz

Differential Revision: D16148769

fbshipit-source-id: f4e63fed3d56ade122560d271bd5701110c5dab8
2019-07-12 07:31:06 -07:00
Andres Suarez
9a90a484f8 Apply rustfmt to all rust files
Reviewed By: jsgf

Differential Revision: D14578283

fbshipit-source-id: 9b4a7b1fd445fd033b64c6af04ee52b27eefb616
2019-07-10 19:36:32 -07:00
Jeremy Fitzhardinge
2ae6f7c3e8 Convert scm/mononoke/blobrepo_utils to Rust 2018
Summary:
Rust 2018 updates to:
  //scm/mononoke/blobrepo_utils:blobrepo_utils
  //scm/mononoke/blobrepo_utils:blobrepo_utils-unittest
  //scm/mononoke/blobrepo_utils:blobrepo_utils_test
  //scm/mononoke/blobrepo_utils:blobrepo_utils_test-rust-build-info-lib

Reviewed By: StanislavGlebik

Differential Revision: D15465939

fbshipit-source-id: fffb4c0383b0b5d0c5288ea8df647ce72f892637
2019-05-28 15:19:49 -07:00
Laurence Emms
491abcd4a8 Removed HgNodeHash from known()/lookup()/heads()/between() methods in
Summary:
Removed references to HgNodeHash in repo_client in the specified functions. In
addition, updated other files due to type related dependencies.

Reviewed By: StanislavGlebik

Differential Revision: D14543934

fbshipit-source-id: b0d860fe7085ed4b91a62ab1e27fb2907a642a1d
2019-05-21 12:24:52 -07:00
Kostia Balytskyi
e561682ecd mononoke: rename crates to contain underscores instead of dashes
Summary: Let's not use dashes in crate names.

Reviewed By: StanislavGlebik

Differential Revision: D14341596

fbshipit-source-id: 85a7ded60cf2e326997ac70ee47a29116af97590
2019-03-06 07:18:28 -08:00
Lukas Piatkowski
515a2909eb monononoke hashes: remove usages of borrows of hashes which are Copy
Summary: The Copy trait means that something is so cheap to copy that you don't even need to explicitly do `.clone()` on it. As it doesn't make much sense to pass &i64 it also doesn't make much sense to pass &<Something that is Copy>, so I have removed all the occurences of passing one of ouf hashes that are Copy.

Reviewed By: fanzeyi

Differential Revision: D13974622

fbshipit-source-id: 89efc1c1e29269cc2e77dcb124964265c344f519
2019-02-06 15:11:35 -08:00
Stanislau Hlebik
67f220c89c mononoke: fix pushrebasing an empty commit
Summary:
Previously pushrebasing an empty commit failed because we assumed that root
manifest of a commit is always sent in a bundle. This diff removes this
assumption

Reviewed By: lukaspiatkowski

Differential Revision: D13818556

fbshipit-source-id: 44e96374ae343074f48e42a90c691b21e3c41386
2019-01-28 14:40:40 -08:00
Lukas Piatkowski
5d9a151d85 mononoke: pass CoreContext down to blobstore
Reviewed By: jsgf

Differential Revision: D13324220

fbshipit-source-id: af7a2a650338ea66e504ea0acae1d103af10f8e3
2018-12-04 11:40:15 -08:00
Lukas Piatkowski
08db0a35eb mononoke: pass CoreContext down to bonsai-hg-mapping
Reviewed By: aslpavel

Differential Revision: D13277450

fbshipit-source-id: 97cfbd917b321727bb4d960c91a784787660eb5b
2018-11-30 10:14:22 -08:00
Stanislau Hlebik
e6b9f3e0f7 mononoke: read bookmarks from local replica
Summary:
Currently we read all bookmarks from primary replica a few times during `hg
pull`. First time when we do listkeys, second time when we get heads.
That might create a high load on primary replica.

However the delay between primary and secondary replicas is fairly small, and so it
*should* be fine to read bookmarks from secondary local replica as long as there is only
one replica per region (because if we have a few replicas per region, then
heads and listkeys response might be inconsistent).

Reviewed By: lukaspiatkowski

Differential Revision: D13039779

fbshipit-source-id: e1b8050f63a3a05dc6cf837e17a448c3b346b723
2018-11-23 01:19:04 -08:00
Stanislau Hlebik
f30cd25c1b mononoke: fix blobrepo utils tests
Summary:
Recently blobrepo_utils_tests started to deadlock. And it looks like it happens
because of `Future::wait()` in blobrepo_utils_tests macro - https://fburl.com/2jho0i2e.

I've added some logging in Mononoke and tokio code and got the following
sequence of events:
1) A test calls `Future::wait()`. Note that this blocks one of the worker threads
from the threadpool.
2) In `VisitOne::visit()` function (https://fburl.com/wmxvt7mq) the work is
split between the threads with `tokio::spawn()` function.
3) `tokio::spawn()` adds a future to some worker thread's queue.
4) If this worker thread is the thread that called `Future::wait()` then we get
a deadlock - recently spawned future can't complete because a thread is
blocked, and thread is blocked because `Future::wait()` waits for the spawned
future to complete.

This diff fixes by avoiding using `Future::wait()` and using tokio::spawn
instead.

Reviewed By: farnz

Differential Revision: D13021358

fbshipit-source-id: 6f1adda43f9460dc952e5794c2fa147b234731ee
2018-11-12 03:38:22 -08:00
Lowik Chanussot
395b124f5d Make get_manifest_by_nodeid accept HgManifestId
Summary: Make get_manifest_by_nodeid accept HgManifestId and correct all calls to get_manifest_by_nodeid.

Reviewed By: StanislavGlebik

Differential Revision: D10298425

fbshipit-source-id: 932e2a896657575c8998e5151ae34a96c164e2b2
2018-10-11 06:50:16 -07:00
Stanislau Hlebik
9abd29d4c3 mononoke: use ChangesetId in Changesets
Summary:
Alas, the diff is huge. One thing is changing Changesets to use ChangesetId.
This is actually quite straightforward. But in order to do this we need to
adapt our test fixtures to also use bonsai changesets. Modifying existing test
fixtures to work with bonsai changesets is very tricky. Besides, existing test
fixtures is a big pile of tech debt anyway, so I used this chance to get rid of
them.

Now test fixtures use `generate_new_fixtures` binary to generate an actual Rust
code that creates a BlobRepo. This Rust code creates a bonsai changeset, that
is converted to hg changeset later.
In many cases it results in the same hg hashes as in old test fixtures.
However, there are a couple of cases where the hashes are different:
1) In the case of merge we are generating different hashes because of different
changed file list (lukaspiatkowski, aslpavel, is it expected?). this is the case for test
fixtures like merge_even, merge_uneven and so on.
2) Old test fixtures used flat manifest hashes while new test fixtures are tree
manifest only.

Reviewed By: jsgf

Differential Revision: D9132296

fbshipit-source-id: 5c4effd8d56dfc0bca13c924683c19665e7bed31
2018-08-06 10:36:43 -07:00
Rain ⁣
06f619717f blobrepo_utils: rename BonsaiVerify to BonsaiMFVerify etc
Summary: This verifier works on manifests -- we'll need other ones for filenodes etc.

Reviewed By: StanislavGlebik

Differential Revision: D9105976

fbshipit-source-id: 939b72b6a3f69b716385315f69a57e91d71a45f3
2018-08-02 12:37:02 -07:00
Pavel Aslanov
2fdc5ddd70 get/generate hg changeset from bonsai changeset
Summary:
This code adds generation of mercurial changeset from bonsai changeset:
  - now handles move file info
  - updates filenodes and changesets tables

Reviewed By: StanislavGlebik

Differential Revision: D9027741

fbshipit-source-id: b10ae9a87565f2e1e9f59954c45815b844033fa5
2018-07-31 11:36:14 -07:00
Rain ⁣
e284a0dac2 bonsai-utils/diff: add ChangedReusedId state
Summary: See the doc comment for what this state represents and why it is necessary.

Reviewed By: StanislavGlebik

Differential Revision: D9025772

fbshipit-source-id: b0588d037365194bbf2d9889ead60237ef097359
2018-07-31 10:36:31 -07:00
Rain ⁣
58ca0b1c3f bonsai-verify: add a way to weaken checks for merge commits older than a date
Summary: This is a workaround for buggy commits produced by older versions of treemanifest.

Reviewed By: farnz

Differential Revision: D9018502

fbshipit-source-id: 71f2aeeaee01500a1a73814dc9c4979ef2c79746
2018-07-29 21:21:33 -07:00
Stanislau Hlebik
ff04a36412 mononoke: rename BlobChangeset and ChangesetContent
Summary:
These types are Hg specific. Since we are going to add bonsai changeset
creation soon, let's make it clear in the types

Reviewed By: farnz

Differential Revision: D8911359

fbshipit-source-id: 8b6cc45122402d7b7e074e66d904d979030de705
2018-07-26 10:09:31 -07:00
Rain ⁣
b42e67a0ed tool to verify bonsai changeset roundtripping
Summary:
The goal of this tool is to verify that bonsai changesets roundtrip with the same hashes. This uses the `ChangesetVisitor` stuff introduced in the previous diff to walk over a specific number of changesets.

I've been using this tool for a few days, and it's shaken out a number of bugs in the Bonsai support in Mononoke, and even found old bugs in Mercurial. So it's been a pretty useful exercise overall.

Reviewed By: farnz

Differential Revision: D8817725

fbshipit-source-id: b6976e8ff9024098c695e82383d98d95b2701e1b
2018-07-23 23:53:10 -07:00
Rain ⁣
8d24accf43 blobrepo_utils: add a parallel changeset visitor
Summary:
This allows parallel walks across thousands of changesets.

In my testing with the Bonsai verification tool this seemed to work well,
keeping my cores saturated almost all the time.

Something to pay attention to is the way cancellation works -- it seems to make
sense, but I could have gotten something subtly wrong :)

Reviewed By: farnz

Differential Revision: D8909719

fbshipit-source-id: f7f47df479431bca05f2cd1508c9c9a4e8a2af50
2018-07-23 14:23:00 -07:00